import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { askClaude } from './lib/actions/send-prompt';
import { baseUrl } from './lib/common/common';
import { PieceCategory } from '@activepieces/shared';
import { extractStructuredDataAction } from './lib/actions/extract-structured-data';
export const claudeAuth = PieceAuth.SecretText({
displayName: 'API Key',
required: true,
description: `Follow these instructions to get your Claude API Key:
1. Visit the following website: https://console.anthropic.com/settings/keys.
2. Once on the website, locate and click on the option to obtain your Claude API Key.
`,
});
export const claude = createPiece({
displayName: 'Anthropic Claude',
auth: claudeAuth,
minimumSupportedRelease: '0.63.0',
logoUrl: 'https://cdn.activepieces.com/pieces/claude.png',
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
authors: ['dennisrongo','kishanprmr'],
actions: [
askClaude,
extractStructuredDataAction,
createCustomApiCallAction({
auth: claudeAuth,
baseUrl: () => baseUrl,
authMapping: async (auth) => {
return {
'x-api-key': `${auth.secret_text}`,
};
},
}),
],
triggers: [],
});