Overview
OpenRouter aggregates models from:- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- Google (Gemini)
- Meta (Llama)
- Mistral, Cohere, and more
- 200+ models
- Automatic failover
- Usage-based pricing
- No commitment
Configuration
Environment Variable
Config File
Selecting Models
OpenRouter uses slash-separated model IDs:Features
Tool Calling
Native tool calling for compatible models:anthropic/claude-3.5-sonnetopenai/gpt-4-turbogoogle/gemini-pro
Automatic Fallbacks
OpenRouter automatically retries with alternative models if primary fails:Cost Tracking
Monitor spending:Request Format
OpenRouter uses OpenAI-compatible request format:Rate Limits
Varies by model and plan:- Free tier: 10 requests/minute
- Pay-as-you-go: 60 requests/minute
- Higher tiers: Contact OpenRouter
Pricing
Pay only for what you use. Prices vary by model:| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Claude 3.5 Sonnet | $3.00 | $15.00 |
| GPT-4 Turbo | $10.00 | $30.00 |
| Llama 3.1 70B | $0.59 | $0.79 |
Troubleshooting
'Invalid API key' error
'Invalid API key' error
'Model not found' error
'Model not found' error
Solution:Check model ID format (should be
provider/model-name):Rate limit errors
Rate limit errors
Solution:Add rate limiting: