OpenRouter is a unified gateway that provides developers and organizations with a single, OpenAI-compatible API for 400-plus large-language models (LLMs) supplied by more than 60 different model providers.
Rather than managing multiple credentials, rate limits, and slightly different API dialects for each vendor, you can purchase credits once on OpenRouter and query any supported model with the same request format used by openai.ChatCompletion.create()
What problem does it solve?
Key Features
Huge model catalog
- Frontier models: GPT-4.1, Claude 3.7, Gemini 2.5 Pro, Mistral‐Medium, Perplexity Mixtral-8x22B, etc.
- Open-source models served on high-performance GPU clusters (Groq, Together, Nous, Databricks, etc.).
- All models are discoverable via the Models API that returns rich JSON metadata (context length, pricing, supported parameters, etc.).
Unified, OpenAI-style API
POST https://openrouter.ai/api/v1/chat/completions
Authorization: Bearer $OPENROUTER_API_KEY
Content-Type: application/json
{
"model": "anthropic/claude-3-sonnet",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}
• Works with any OpenAI SDK out of the box.
Provider & model routing
- Provider routing: If you specify multiple providers for the same model, OpenRouter will pick the best one based on latency or cost, and fail-over when necessary.
- Model routing: Provide a list of models and let OpenRouter fall back or A/B test automatically.
- Variants: append
:nitro,:floor,:online,:beta,:free, etc., to tweak routing behavior.
Privacy & logging controls
- Zero prompt / completion logging by default.
- Opt-in prompt logging for a 1 % discount.
- Fine-grained privacy settings (e.g., disallow routing to providers that log prompts for training).
Advanced capabilities
- Tool calling / function calling identical to OpenAI.
- Images & PDFs as input where supported by the underlying model.
- Structured Outputs JSON schema enforcement.
- Web-enabled variants to automatically include live search results.
- Reasoning tokens to pay for chain-of-thought only when you need it.
Enterprise features
- Custom data policies to restrict where prompts can be processed.
- Provisioning API for programmatic key management.
- SLAs, team management, and dedicated support (contact sales).
Pricing
OpenRouter does not add any markup to the per-token prices of the underlying provider. Instead, it charges a 5 % + $0.35 fee only when you purchase credits. Once credits are in your account:
- You pay the exact provider-listed price per prompt/completion token (or per image/request if applicable).
- BYOK (Bring Your Own Key) is supported with a 5 % usage fee deducted from your credits.
- Many community or open-source models are free, but have low daily rate limits (50-1000 req/day).
A small free credit allowance is provided to new accounts so you can test the API without entering payment information.
Pros & Cons
Pros
- Breadth of models: widest catalog on the market.
- OpenAI drop-in: minimal code changes to switch.
- Automatic fallbacks greatly improve production reliability.
- Transparent pricing with no inference markup.
- Edge-deployed infrastructure adds only ~25 ms latency overhead.
Cons
- You pre-pay credits; unused credits may expire after one year.
- Purchasing credits incurs a 5 % fee, so at very high volume direct provider billing might be cheaper.
- Some free models have strict rate limits and may throttle quickly.
- As a proxy layer, certain provider-specific features (e.g., OpenAI vector storage) are not exposed.
When to Use OpenRouter
- You want to benchmark many models quickly without opening new accounts.
- Your application must stay online even if Anthropic or OpenAI has an outage.
- You need cost or latency optimization across providers in real time.
- You prefer a single invoice and dashboard for all model usage.
Getting Started
-
Sign up at
https://openrouter.ai/(GitHub, Google, or crypto wallet). -
Buy credits (Stripe, AliPay, or USDC) or use the free starter allowance.
-
Generate an API key in the dashboard.
-
Replace your OpenAI base URL & key:
import openai openai.api_key = "YOUR_OPENROUTER_API_KEY" openai.base_url = "https://openrouter.ai/api/v1" -
Send a test request with any supported model slug—done!