Beginner

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
One API key + OpenAI SDK
OpenRouter
Model routing
Failover
Billing
Providers
OpenAI
Anthropic
Google
60+ more

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

Free Tier
  • 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
Pay-as-you-go
  • 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
Price transparency

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 IDModelFree?
openai/gpt-4oGPT-4oPaid
anthropic/claude-sonnet-4-6Claude Sonnet 4.5Paid
google/gemini-2.5-proGemini 2.5 ProPaid
meta-llama/llama-3.2-3b-instruct:freeLlama 3.2 3BFree
google/gemma-3-12b-it:freeGemma 3 12BFree
mistralai/mistral-nemo:freeMistral NemoFree
qwen/qwen3-8b:freeQwen3 8BFree

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?

Page built: 01 Jun 2026