OpenRouter Guide โ Access 300+ AI Models with One API Key (2026)
OpenRouter is a unified API gateway that gives you access to 300+ AI models from 60+ providers through a single endpoint. One API key, one credit balance, one integration โ and you can switch between Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM-5.1, Llama, Mistral, and hundreds more.
Update (April 24, 2026): DeepSeek V4 Pro and Flash are available on OpenRouter. See V4 OpenRouter setup.
Update (May 20, 2026): Gemini 3.5 Flash is now available on OpenRouter at
google/gemini-3.5-flash($1.50/$9 per 1M tokens). Itโs Googleโs fastest frontier model with 289 tok/s output speed.
Why OpenRouter?
Without OpenRouter, using multiple AI models means:
- Managing separate API keys for each provider
- Handling different billing systems
- Dealing with slightly different API formats
- No easy way to compare models
OpenRouter solves all of this with an OpenAI-compatible API. If your code works with OpenAIโs API, it works with OpenRouter โ just change the base URL and model name.
Quick start
1. Get an API key
Sign up at openrouter.ai and create an API key.
2. Make your first request
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="your-openrouter-key"
)
response = client.chat.completions.create(
model="anthropic/claude-opus-4.6",
messages=[{"role": "user", "content": "Write a Python web scraper"}]
)
print(response.choices[0].message.content)
Thatโs it. Change the model string to use any of 300+ models.
3. JavaScript/TypeScript
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://openrouter.ai/api/v1',
apiKey: 'your-openrouter-key',
});
const response = await client.chat.completions.create({
model: 'google/gemini-3.1-pro',
messages: [{ role: 'user', content: 'Explain WebSockets' }],
});
4. cURL
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-chat",
"messages": [{"role": "user", "content": "Hello"}]
}'
Pricing
OpenRouter charges a 5.5% platform fee on credit purchases. After that, you pay the providerโs rate for each model. Some highlights:
Free models (25+ available)
| Model | Quality | Rate limit |
|---|---|---|
| Qwen 3.6 Plus Preview | Excellent | 20 req/min |
| DeepSeek V3 (free) | Very good | 20 req/min |
| Gemma 4 27B | Good | 20 req/min |
| Llama 4 Scout | Good | 20 req/min |
Free models are capped at 20 requests/minute and 50/day for accounts with <10 credits.
Budget models (<$1/1M tokens)
| Model | Input | Output |
|---|---|---|
| DeepSeek Chat | $0.27 | $1.10 |
| Qwen 3.5 Flash | $0.065 | $0.26 |
| Qwen 3.5 Plus | $0.26 | $1.56 |
| GLM-5.1 | ~$1.00 | ~$2.30 |
Premium models
| Model | Input | Output |
|---|---|---|
| Claude Opus 4.6 | $15.00 | $75.00 |
| GPT-5.4 | $10.00 | $30.00 |
| Gemini 3.1 Pro | $3.50 | $10.50 |
Using OpenRouter with coding tools
With Aider
export OPENROUTER_API_KEY="your-key"
aider --model openrouter/anthropic/claude-opus-4.6
See our Aider guide for full setup.
With Claude Code
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_API_KEY="your-openrouter-key"
claude
With Continue.dev
In your Continue config:
{
"models": [{
"provider": "openrouter",
"model": "anthropic/claude-opus-4.6",
"apiKey": "your-openrouter-key"
}]
}
See our Continue.dev guide for details.
With Kimi CLI
export OPENROUTER_API_KEY="your-key"
kimi --provider openrouter --model anthropic/claude-opus-4.6
Model selection strategy
With 300+ models, choosing can be overwhelming. Hereโs a practical framework:
For coding
| Need | Model | Cost |
|---|---|---|
| Best quality | anthropic/claude-opus-4.6 | $$$ |
| Best value | deepseek/deepseek-chat | $ |
| Best open-source | z-ai/glm-5.1 | $$ |
| Best free | qwen/qwen-3.6-plus-preview | Free |
| Best local alternative | Run Ollama instead | Free |
For general tasks
| Need | Model | Cost |
|---|---|---|
| Best overall | anthropic/claude-opus-4.6 | $$$ |
| Best reasoning | deepseek/deepseek-reasoner | $$ |
| Best multimodal | google/gemini-3.1-pro | $$ |
| Best cheap | qwen/qwen-3.5-flash | ยข |
Advanced features
Fallback routing
response = client.chat.completions.create(
model="anthropic/claude-opus-4.6",
messages=[...],
extra_body={
"route": "fallback",
"models": [
"anthropic/claude-opus-4.6",
"openai/gpt-5.4",
"google/gemini-3.1-pro"
]
}
)
If Claude is down, OpenRouter automatically falls back to GPT-5.4, then Gemini.
Reasoning mode
response = client.chat.completions.create(
model="deepseek/deepseek-reasoner",
messages=[...],
extra_body={"reasoning": {"effort": "high"}}
)
# Access reasoning in response.choices[0].message.reasoning_details
Provider preferences
extra_body={
"provider": {
"order": ["Anthropic", "AWS Bedrock"], # Prefer direct Anthropic
"allow_fallbacks": True
}
}
Cost management
OpenRouter makes it easy to overspend. Tips:
- Set credit limits โ Configure max spend per day/month in the dashboard
- Use free models for testing โ Switch to paid only for production
- Monitor usage โ The dashboard shows per-model spending
- Use cheap models for simple tasks โ Qwen Flash at $0.065/1M is 230x cheaper than Claude Opus
- Cache responses โ OpenRouter doesnโt cache for you; implement it client-side
BYOK (Bring Your Own Key)
If you already have API keys from providers, you can use them through OpenRouter to get unified routing without the 5.5% markup:
extra_body={
"provider": {
"anthropic": {"api_key": "your-anthropic-key"}
}
}
Bottom line
OpenRouter is the best way to access multiple AI models without managing multiple integrations. The 5.5% fee is worth it for the convenience, fallback routing, and model flexibility. If youโre building anything that uses AI APIs, start with OpenRouter โ you can always switch to direct provider APIs later if the fee matters at scale.
FAQ
Is OpenRouter free?
OpenRouter itself doesnโt charge a subscription โ you pay per API call with a 5.5% markup over provider prices. Some models on OpenRouter are free (like certain Qwen variants), making it possible to use without spending anything.
How does OpenRouter pricing work?
OpenRouter charges the base provider price plus a 5.5% fee on each API call. You load credits into your account and pay per token used, with pricing varying by model โ from $0.065/1M tokens for cheap models to $75/1M for frontier models.
Can I use OpenRouter in production?
Yes, OpenRouter is production-ready with features like fallback routing, load balancing across providers, and high uptime. Many companies use it in production to avoid vendor lock-in and gain automatic failover between model providers.
Does OpenRouter support all models?
OpenRouter supports hundreds of models from major providers including OpenAI, Anthropic, Google, Meta, Mistral, and many open-source options. While it doesnโt have every model ever released, it covers all mainstream and most popular open-source models.
Related: Qwen 3.6 Plus (Free on OpenRouter) ยท Best Free AI APIs 2026 ยท GLM-5.1 API Guide ยท How to Choose an AI Coding Agent ยท MiMo V2.5 Pro vs DeepSeek V4-Pro ยท Migrate from GPT/Claude to Chinese Models