Skip to main content

Anthropic Claude

Anthropic's Claude models excel at complex reasoning and nuanced conversation.

Setup

1. Get API Key

  1. Go to Anthropic Console
  2. Sign in or create an account
  3. Navigate to API Keys
  4. 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

ModelContextBest ForCost (Input)
claude-opus-4200KMost capable$15.00/1M
claude-sonnet-4200KBalanced$3.00/1M
claude-3-5-haiku200KFast & 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:

ComponentTokensCost
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_TOKENS is set in .env
  • Typical value: 4096 or 8192

"Invalid API key"