Anthropic Claude
Anthropic's Claude models excel at complex reasoning and nuanced conversation.
Setup
1. Get API Key
- Go to Anthropic Console
- Sign in or create an account
- Navigate to API Keys
- Create a new key
2. Configure Environment
LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-...your-api-key
ANTHROPIC_MODEL=claude-sonnet-4-20250514
ANTHROPIC_MAX_TOKENS=4096
Required Parameter
Anthropic requires ANTHROPIC_MAX_TOKENS to be set. This limits response length.
Available Models
| Model | Context | Best For | Cost (Input) |
|---|---|---|---|
claude-opus-4 | 200K | Most capable | $15.00/1M |
claude-sonnet-4 | 200K | Balanced | $3.00/1M |
claude-3-5-haiku | 200K | Fast & cheap | $0.80/1M |
Configuration Options
# Required
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MAX_TOKENS=4096
# Model selection
ANTHROPIC_MODEL=claude-sonnet-4-20250514
Cost Estimation
For a typical 3-minute session with Claude Sonnet:
| Component | Tokens | Cost |
|---|---|---|
| System + context | ~2500 | $0.0075 |
| User messages | ~200 | $0.0006 |
| Responses | ~1200 | $0.018 |
| Total | ~3900 | ~$0.03 |
Troubleshooting
"max_tokens is required"
- Ensure
ANTHROPIC_MAX_TOKENSis set in.env - Typical value: 4096 or 8192
"Invalid API key"
- Check your key at Anthropic Console
- Ensure billing is configured