The unified interface for LLMs.
Find the best models & prices for your prompts — through a single, OpenAI-compatible API.
- One API, 340+ models. Route requests to models from OpenAI, Anthropic, Google, Meta, Mistral, and many more — without changing your code.
- Better prices & uptime. Automatic fallbacks and price/performance routing across 90+ providers.
- OpenAI-compatible. Drop-in compatible with the OpenAI SDK — just change the base URL and key.
- No lock-in. Compare models, switch instantly, and pay as you go.
TypeScript — @openrouter/sdk
npm add @openrouter/sdkimport { OpenRouter } from "@openrouter/sdk";
const openRouter = new OpenRouter(); // reads OPENROUTER_API_KEY
const result = await openRouter.chat.send({
model: "openai/gpt-5.5",
messages: [{ role: "user", content: "Hello, how are you?" }],
provider: { sort: "price" }, // smart routing: cheapest provider first
stream: true,
});
for await (const chunk of result) {
console.log(chunk.choices[0].delta.content);
}Python — openrouter
pip install openrouterimport os
from openrouter import OpenRouter
with OpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) as open_router:
res = open_router.chat.send(
model="anthropic/claude-fable-5",
messages=[{"role": "user", "content": "Hello, how are you?"}],
provider={"sort": "price"}, # smart routing: cheapest provider first
)
print(res.choices[0].message.content)Go — go-sdk
go get github.com/OpenRouterTeam/go-sdkpackage main
import (
"context"
"log"
"os"
openrouter "github.com/OpenRouterTeam/go-sdk"
"github.com/OpenRouterTeam/go-sdk/models/components"
)
func main() {
s := openrouter.New(
openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
)
res, err := s.Chat.Send(context.Background(), components.ChatRequest{
Model: openrouter.Pointer("openai/gpt-5.5"),
Messages: []components.ChatMessages{
components.CreateChatMessagesUser(
components.ChatUserMessage{
Role: components.ChatUserMessageRoleUser,
Content: components.CreateChatUserMessageContentStr(
"Hello, how are you?",
),
},
),
},
}, nil)
if err != nil {
log.Fatal(err)
}
log.Println(res.ChatResult.Choices)
}Agents — @openrouter/agent · tools are auto-executed, responses streamable
npm add @openrouter/sdk @openrouter/agentimport OpenRouter from "@openrouter/sdk";
import { callModel, tool } from "@openrouter/agent";
import { z } from "zod";
const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
const weatherTool = tool({
name: "get_weather",
description: "Get the current weather for a location",
inputSchema: z.object({ location: z.string() }),
execute: async ({ location }) => ({ temperature: 72, condition: "sunny", location }),
});
const result = callModel(client, {
model: "anthropic/claude-fable-5",
input: "What is the weather in San Francisco?",
tools: [weatherTool] as const,
});
console.log(await result.getText()); // tools run automatically| Repo | What it is |
|---|---|
| typescript-sdk | Official TypeScript SDK — type-safe access to 400+ models in any JS/TS runtime |
| python-sdk | Official Python SDK — sync + async clients, Pydantic types |
| go-sdk | Official Go SDK — provider routing, guardrails, and analytics |
| typescript-agent | @openrouter/agent — tool orchestration, streaming, multi-turn agents |
| ai-sdk-provider | OpenRouter provider for the Vercel AI SDK |
| skills | Agent skills for building with OpenRouter |
| Repo | What it is |
|---|---|
| openrouter-examples | Examples of integrating the OpenRouter API |
| openrouter-examples-python | Calling OpenRouter models from Python |
| tool-calling | Tool calling demo for OpenRouter |
| sign-in-with-openrouter | Templates and skills for adding Sign In with OpenRouter |
| awesome-openrouter | Community list of apps built on OpenRouter |
- 🌐 Website: https://openrouter.ai
- 📚 Documentation: https://openrouter.ai/docs
- 🧠 Models & Pricing: https://openrouter.ai/models
- 📊 Rankings: https://openrouter.ai/rankings
- 💬 Community: https://discord.gg/openrouter


