Skip to content
OpenRouterOpenRouter
© 2026 OpenRouter, Inc

Product

  • Chat
  • Rankings
  • Apps
  • Discover
  • Models
  • Providers
  • Pricing
  • Enterprise
  • Labs

Company

  • About
  • Blog
  • Careers
    Hiring
  • Privacy
  • Terms of Service
  • Support
  • Works With OR
  • Data

Developer

  • Documentation
  • API Reference
  • Developer Platform
  • Status

Connect

  • Discord
  • GitHub
  • LinkedIn
  • X
  • YouTube

Developer Platform

Build with every model.
From one platform.

One OpenAI-compatible API, typed SDKs in three languages, an agent framework, local devtools, and an MCP server — backed by 400+ models across 70+ providers with automatic fallback.

Get an API keyRead the docs

Everything you need to ship

Six products, one API key. Start with a single request and grow into a production agent without changing providers.

API

One OpenAI-compatible endpoint for 400+ models across 70+ providers, with automatic fallback when a provider fails.

https://openrouter.ai/api/v1

Client SDKs

The same typed client in TypeScript, Python, and Go — streaming, tools, and structured output behave identically in every language.

npm i @openrouter/sdk

Agent SDK

Type-safe tools, multi-turn loops, streaming, and stop conditions. Build production agents that route across every provider.

npm i @openrouter/agent

DevTools

Capture SDK telemetry in development and replay every request, token count, and error in a local web viewer.

npm install -g @openrouter/cli

MCP Server

Give any Model Context Protocol client — Claude Code, Cursor, or your own — access to all 400+ models.

https://mcp.openrouter.ai/mcp

Cookbook

Working recipes for agent harnesses, human-in-the-loop tools, evals, cost control, and image generation.

A few lines to production

Swap the model string to change providers. Nothing else about your code has to change.

import { OpenRouter } from '@openrouter/sdk';

const client = new OpenRouter({
  apiKey: process.env.OPENROUTER_API_KEY,
});

const response = await client.chat.send({
  model: 'anthropic/claude-sonnet-4',
  messages: [
    { role: 'user', content: 'Explain quantum computing in simple terms.' },
  ],
});

console.log(response.choices[0].message.content);
from openrouter import OpenRouter
import os

with OpenRouter(
    api_key=os.getenv("OPENROUTER_API_KEY")
) as client:
    response = client.chat.send(
        model="anthropic/claude-sonnet-4",
        messages=[
            {"role": "user", "content": "Explain quantum computing in simple terms."}
        ]
    )

    print(response.choices[0].message.content)
import { OpenRouter } from '@openrouter/sdk';

const client = new OpenRouter();

const stream = await client.chat.send({
  model: 'openai/gpt-4o',
  messages: [{ role: 'user', content: 'Write a short story about a robot.' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
from openrouter import OpenRouter
import os

with OpenRouter(
    api_key=os.getenv("OPENROUTER_API_KEY")
) as client:
    stream = client.chat.send(
        model="openai/gpt-4o",
        messages=[
            {"role": "user", "content": "Write a short story about a robot."}
        ],
        stream=True
    )

    for event in stream:
        content = event.choices[0].delta.content if event.choices else None
        if content:
            print(content, end="", flush=True)
// Multi-turn tool loops live in the Agent SDK: npm i @openrouter/agent
import { OpenRouter, tool, stepCountIs } from '@openrouter/agent';
import { z } from 'zod';

const openrouter = new OpenRouter();

const weatherTool = tool({
  name: 'get_weather',
  description: 'Get the weather for a location',
  inputSchema: z.object({
    location: z.string(),
  }),
  execute: async ({ location }) => {
    return { temperature: 72, condition: 'sunny' };
  },
});

const result = openrouter.callModel({
  model: 'openai/gpt-4o',
  input: 'What should I wear in San Francisco today?',
  tools: [weatherTool],
  stopWhen: stepCountIs(5),
});

console.log(await result.getText());
# The Client SDK returns tool calls for you to dispatch yourself.
from openrouter import OpenRouter
import os

with OpenRouter(
    api_key=os.getenv("OPENROUTER_API_KEY")
) as client:
    response = client.chat.send(
        model="openai/gpt-4o",
        messages=[
            {"role": "user", "content": "What should I wear in San Francisco today?"}
        ],
        tools=[{
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get the weather for a location",
                "parameters": {
                    "type": "object",
                    "properties": {"location": {"type": "string"}},
                    "required": ["location"],
                },
            },
        }]
    )

    print(response.choices[0].message.tool_calls)

Live in three steps

Most teams are through their first successful request in under five minutes.

  1. 1

    Get an API key

    Create a key from your dashboard. No subscription and no card required to start.

  2. 2

    Point your client at OpenRouter

    Already using the OpenAI SDK? Change the base URL and your key. Everything else stays put.

  3. 3

    Pick any model

    Use an author/slug string. Add fallbacks so a provider outage never becomes your outage.

  4. Read the full quickstart
Your first request
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "models": [
      "anthropic/claude-sonnet-4",
      "openai/gpt-4o",
      "google/gemini-2.5-pro"
    ],
    "messages": [
      { "role": "user", "content": "Hello!" }
    ]
  }'

Start building today

Free to get started. No subscription, no card required.

Get an API keyRead the docs