()
| 9 | }) |
| 10 | |
| 11 | async function main() { |
| 12 | try { |
| 13 | const msg = await client.messages.create({ |
| 14 | model: process.env.ANTHROPIC_MODEL || 'claude-sonnet-4-20250514', |
| 15 | max_tokens: 50, |
| 16 | messages: [{ role: 'user', content: 'Say "hello" and nothing else.' }], |
| 17 | }) |
| 18 | console.log('✅ API connection successful!') |
| 19 | console.log('Response:', msg.content[0].type === 'text' ? msg.content[0].text : msg.content[0]) |
| 20 | } catch (err: any) { |
| 21 | console.error('❌ API connection failed:', err.message) |
| 22 | process.exit(1) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | main() |
no test coverage detected