How OpenRouter Works
OpenRouter is an API gateway that gives you access to 300+ AI models from 60+ providers through a single endpoint and a single API key. It is OpenAI-compatible — meaning you change one line of code and your existing OpenAI calls work with any model in the catalog.
The Core Idea
Without OpenRouter, using multiple AI providers means managing multiple API keys, multiple client libraries, different request formats, different rate limits, and different billing accounts. OpenRouter abstracts all of that into one interface.
Your app talks to OpenRouter; OpenRouter talks to whichever provider serves the model you requested
Using OpenRouter
OpenRouter's API is at https://openrouter.ai/api/v1 and uses the same request format as OpenAI. Change the base URL and API key:
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="sk-or-your_openrouter_key",
)
# Use any model from the catalog — just change the model name
response = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6", # Anthropic model via OpenRouter
messages=[{"role": "user", "content": "Hello!"}]
)
# Or a Google model
response = client.chat.completions.create(
model="google/gemini-2.5-pro",
messages=[{"role": "user", "content": "Hello!"}]
)
# Or a free model
response = client.chat.completions.create(
model="meta-llama/llama-3.2-3b-instruct:free",
messages=[{"role": "user", "content": "Hello!"}]
)Pricing
- 25+ free models available
- 50 free requests per day
- Rate limited (typically 20 req/min, 200/day per free model)
- No credit card required
- Includes Llama 3.2, Gemma 3, Qwen3, and others
- Buy credits; charged per token at provider rates + 5.5% platform fee
- No monthly fee
- No minimum spend
- Auto top-up available
- Volume discounts for high usage
OpenRouter passes through provider pricing with a 5.5% markup. If Claude Sonnet 4.5 costs $3/$15 per 1M tokens on Anthropic directly, it costs approximately $3.17/$15.83 via OpenRouter. The markup is worth it if you value the unified API, failover, and free models — many teams find the operational simplicity worth the small premium.
Model Naming Convention
OpenRouter model IDs follow provider/model-name. Free model variants are tagged with :free:
| OpenRouter ID | Model | Free? |
|---|---|---|
| openai/gpt-4o | GPT-4o | Paid |
| anthropic/claude-sonnet-4-6 | Claude Sonnet 4.5 | Paid |
| google/gemini-2.5-pro | Gemini 2.5 Pro | Paid |
| meta-llama/llama-3.2-3b-instruct:free | Llama 3.2 3B | Free |
| google/gemma-3-12b-it:free | Gemma 3 12B | Free |
| mistralai/mistral-nemo:free | Mistral Nemo | Free |
| qwen/qwen3-8b:free | Qwen3 8B | Free |
Checklist: Do You Understand This?
- Can you describe what OpenRouter does in one sentence?
- Can you make an OpenRouter API call using the OpenAI Python SDK?
- Do you know how to identify free vs paid models in the OpenRouter catalog?
- Do you understand how OpenRouter's 5.5% markup compares to direct provider pricing?