* Environment variables for different client types: * * Direct API: * - ANTHROPIC_API_KEY: Required for direct API access * * AWS Bedrock: * - AWS credentials configured via aws-sdk defaults * - AWS_REGION or AWS_DEFAULT_REGION: Sets the AWS region for all models (default: us-east-1) * - ANT
()
| 71 | */ |
| 72 | |
| 73 | function createStderrLogger(): ClientOptions['logger'] { |
| 74 | return { |
| 75 | error: (msg, ...args) => |
| 76 | // biome-ignore lint/suspicious/noConsole:: intentional console output -- SDK logger must use console |
| 77 | console.error('[Anthropic SDK ERROR]', msg, ...args), |
| 78 | // biome-ignore lint/suspicious/noConsole:: intentional console output -- SDK logger must use console |
| 79 | warn: (msg, ...args) => console.error('[Anthropic SDK WARN]', msg, ...args), |
| 80 | // biome-ignore lint/suspicious/noConsole:: intentional console output -- SDK logger must use console |
| 81 | info: (msg, ...args) => console.error('[Anthropic SDK INFO]', msg, ...args), |
| 82 | debug: (msg, ...args) => |
| 83 | // biome-ignore lint/suspicious/noConsole:: intentional console output -- SDK logger must use console |
| 84 | console.error('[Anthropic SDK DEBUG]', msg, ...args), |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | export async function getAnthropicClient({ |
| 89 | apiKey, |
no test coverage detected