Overview
- Type: Cloud aggregator
- Cost: Pay-per-use, varies by model (see pricing)
- API Key Required: Yes
- Installation Required: No
- Official Website: https://openrouter.ai/
Prerequisites
Create an OpenRouter account
Sign up at openrouter.ai using your preferred authentication method.
Add credits (optional)
Navigate to Credits to add funds. OpenRouter offers free credits for trying models.
Generate an API key
Go to API Keys and create a new key. Copy it for use in AI Providers.
OpenRouter provides free credits when you sign up, allowing you to test different models before committing funds.
Setup in AI Providers
Select OpenRouter provider
In the AI Providers settings, click Create AI provider and select
OpenRouter as the provider type.Enter API key
Paste your API key from the API keys page into the
API key field.Select model
Click the refresh button to fetch the extensive list of available models, then select your preferred model (e.g.,
anthropic/claude-3.7-sonnet).Available Models
OpenRouter provides access to models from multiple providers. Here are some popular options:Premium Models
| Model ID | Provider | Description |
|---|---|---|
anthropic/claude-3.7-sonnet | Anthropic | Latest Claude, excellent quality |
openai/gpt-4o | OpenAI | GPT-4 Omni, multimodal |
google/gemini-2.0-flash-exp | Fast Gemini model | |
meta-llama/llama-3.3-70b-instruct | Meta | Powerful open model |
anthropic/claude-opus-4 | Anthropic | Highest quality Claude |
Cost-Effective Models
| Model ID | Provider | Description |
|---|---|---|
openai/gpt-3.5-turbo | OpenAI | Fast and affordable |
anthropic/claude-3-haiku | Anthropic | Quick responses |
google/gemini-flash-1.5 | Efficient and fast | |
meta-llama/llama-3.2-3b-instruct:free | Meta | Free tier option |
Specialized Models
| Model ID | Provider | Description |
|---|---|---|
perplexity/llama-3.1-sonar-huge-128k-online | Perplexity | Web search integration |
openai/o1-preview | OpenAI | Advanced reasoning |
qwen/qwen-2.5-72b-instruct | Qwen | Excellent multilingual |
Model availability and pricing change frequently. Check the OpenRouter models page for the most current list.
Key Features
Single API for Multiple Providers
Access models from:- OpenAI
- Anthropic
- Meta
- Mistral
- And many more
Free Models
Some models are available for free (with rate limits):- Look for models with
:freein their ID - Perfect for testing and development
- Community-supported options
Fallback Options
You can configure fallback models if your primary choice is unavailable or rate-limited.Model Routing
OpenRouter can automatically route to the best available model based on:- Availability
- Cost
- Performance
- Your preferences
Troubleshooting
Model Not Available
If a model shows as unavailable:- Check the models page for current availability
- Some models require specific provider access
- Try an alternative model from the same family
Insufficient Credits
If requests fail due to credits:- Check your credit balance
- Add more credits to your account
- Try a free model as an alternative
Rate Limits
Model ID Format
Always use the full model ID format:anthropic/claude-3.7-sonnetopenai/gpt-4ogoogle/gemini-flash-1.5
Pricing Considerations
OpenRouter pricing varies by model:- Premium models: Similar to direct provider pricing (sometimes slightly higher)
- Free models: No cost but rate-limited
- Competitive models: Often better value than direct access
- Use free models for development
- Compare prices on the models page
- Set spending limits in your account settings
- Monitor usage in your dashboard
Advanced Configuration
Custom Headers
OpenRouter supports custom headers for:- App identification
- User tracking
- Request routing
Model Parameters
Pass standard parameters:temperature- Control randomnessmax_tokens- Response lengthtop_p- Nucleus samplingstop- Stop sequences
Provider Preferences
You can specify provider preferences to:- Route to specific data centers
- Require certain provider features
- Optimize for cost or speed
Best Practices
- Start with free models: Test your integration without cost
- Compare models: Try different options for your use case
- Monitor costs: Check your usage regularly
- Set up fallbacks: Have backup models configured
- Use the right model: Balance cost, speed, and quality
Advantages of OpenRouter
- Flexibility: Switch between models without changing code
- Cost comparison: Easy to compare pricing across providers
- No multiple API keys: Manage everything through OpenRouter
- Community: Access to community-hosted models
- Reliability: Automatic failover to alternative providers
OpenRouter is particularly useful if you want to experiment with different models or need fallback options when primary models are unavailable.