* Get or create the shared Anthropic client
()
| 17 | * Get or create the shared Anthropic client |
| 18 | */ |
| 19 | function getClient(): Anthropic { |
| 20 | if (!client) { |
| 21 | const apiKey = process.env.ADDIE_ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY; |
| 22 | if (!apiKey) { |
| 23 | throw new Error('ANTHROPIC_API_KEY or ADDIE_ANTHROPIC_API_KEY not configured'); |
| 24 | } |
| 25 | client = new Anthropic({ apiKey }); |
| 26 | } |
| 27 | return client; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Check if the API key is configured |
no outgoing calls
no test coverage detected