Technology RadarTechnology Radar

OpenRouter

inference
Trial

OpenRouter is a unified LLM API gateway that provides access to 100+ models — including Claude, GPT-4o, Gemini, Llama, DeepSeek, and Mistral — through a single OpenAI-compatible endpoint. It handles provider routing, failover, and cost comparison so your application doesn't have to.

Buy vs Build

OpenRouter is a pure buy: point your OpenAI SDK at https://openrouter.ai/api/v1, swap in your OpenRouter API key, and pick any model by ID. There is no infrastructure to run or manage.

Why It's in Trial

OpenRouter solves a real problem — locking into a single model provider makes applications brittle, and comparing models across providers requires juggling multiple SDKs, billing accounts, and rate limits. OpenRouter flattens this into one API and one bill.

However, the trade-off is that your prompts and completions transit through a third-party intermediary. For teams with strict data-residency or confidentiality requirements, this must be evaluated carefully. Anthropic, OpenAI, and others offer their own direct APIs for those scenarios.

When OpenRouter Matters

  • Model flexibility: Swap between Claude, GPT-4o, Gemini, and open-weight models by changing a model ID string — no SDK changes
  • Cost optimisation: Compare real-time pricing across providers; route cheaper models for lower-stakes tasks
  • Automatic fallback: Configure provider priority lists so requests automatically retry on a secondary provider if the primary is down or rate-limited
  • Prototyping and benchmarking: Evaluate 10 models against your eval set without maintaining 10 separate integrations
  • Access to new models early: OpenRouter often adds newly released models (including research previews and open-weight releases) within hours of launch

Supported Models

OpenRouter aggregates both proprietary and open-weight models:

Category Examples
Anthropic claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
OpenAI gpt-4o, gpt-4.1, o3, o4-mini
Google gemini-2.5-pro, gemini-2.0-flash
Meta (open-weight) llama-4-scout, llama-4-maverick, llama-3.3-70b
DeepSeek (open-weight) deepseek-v3, deepseek-r1
Mistral (open-weight) mistral-large, codestral
Others Qwen, Command R+, Grok, Nova, and 80+ more

Getting Started

Because OpenRouter is OpenAI-compatible, existing code requires minimal changes:

from openai import OpenAI

client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key="your-openrouter-api-key",  # or OPENROUTER_API_KEY env var
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-6",  # or "openai/gpt-4o", "meta-llama/llama-4-scout", etc.
    messages=[{"role": "user", "content": "Explain rate limiting"}]
)

For fallback routing, add a provider preference header:

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={
        "X-Title": "My App",
        "HTTP-Referer": "https://myapp.example.com",
    }
)

Key Characteristics

Property Value
Model coverage 100+ models across 20+ providers
API format OpenAI-compatible (/v1/chat/completions)
Pricing Per-token, at or near provider list price; no markup on most models
Free tier Yes — a selection of models available at no cost with rate limits
Data routing Prompts transit OpenRouter servers; review their privacy policy
Provider OpenRouter Inc.
Website openrouter.ai
Docs openrouter.ai/docs

Further Reading