Skip to content
@OpenRouterTeam

OpenRouter

The unified interface for LLMs. Find the best models & prices for your prompts.
OpenRouter



The unified interface for LLMs.

Find the best models & prices for your prompts — through a single, OpenAI-compatible API.


Models on OpenRouterProviders on OpenRouterTokens routed per monthGlobal users on OpenRouter

WebsiteDocsTwitterDiscord


Why OpenRouter?

  • One API, 400+ 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.
OpenRouter performance

Quickstart with the OpenRouter SDKs

TypeScript@openrouter/sdk

npm add @openrouter/sdk
import{OpenRouter}from"@openrouter/sdk";constopenRouter=newOpenRouter();// reads OPENROUTER_API_KEYconstresult=awaitopenRouter.chat.send({model: "openai/gpt-5.5",messages: [{role: "user",content: "Hello, how are you?"}],provider: {sort: "price"},// smart routing: cheapest provider firststream: true,});forawait(constchunkofresult){console.log(chunk.choices[0].delta.content);}

Pythonopenrouter

pip install openrouter
importosfromopenrouterimportOpenRouterwithOpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) asopen_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)

Gogo-sdk

go get github.com/OpenRouterTeam/go-sdk
package main
import (
"context""log""os"
openrouter "github.com/OpenRouterTeam/go-sdk""github.com/OpenRouterTeam/go-sdk/models/components"
)
funcmain() {
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)
iferr!=nil {
log.Fatal(err)
}
log.Println(res.ChatResult.Choices)
}

Agents@openrouter/agent · tools are auto-executed, responses streamable

npm add @openrouter/sdk @openrouter/agent
importOpenRouterfrom"@openrouter/sdk";import{callModel,tool}from"@openrouter/agent";import{z}from"zod";constclient=newOpenRouter({apiKey: process.env.OPENROUTER_API_KEY});constweatherTool=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 }),});constresult=callModel(client,{model: "anthropic/claude-fable-5",input: "What is the weather in San Francisco?",tools: [weatherTool]asconst,});console.log(awaitresult.getText());// tools run automatically

🔧 Our open source

SDKs & agent tooling

RepoWhat it is
typescript-sdkOfficial TypeScript SDK — type-safe access to 400+ models in any JS/TS runtime
python-sdkOfficial Python SDK — sync + async clients, Pydantic types
go-sdkOfficial Go SDK — provider routing, guardrails, and analytics
typescript-agent@openrouter/agent — tool orchestration, streaming, multi-turn agents
ai-sdk-providerOpenRouter provider for the Vercel AI SDK
skillsAgent skills for building with OpenRouter

Examples & integrations

RepoWhat it is
openrouter-examplesExamples of integrating the OpenRouter API
openrouter-examples-pythonCalling OpenRouter models from Python
tool-callingTool calling demo for OpenRouter
sign-in-with-openrouterTemplates and skills for adding Sign In with OpenRouter
awesome-openrouterCommunity list of apps built on OpenRouter

Resources


Built with ❤️ by the OpenRouter team.

Pinned Loading

  1. typescript-sdktypescript-sdkPublic

    TypeScript 233 69

  2. python-sdkpython-sdkPublic

    Python 146 38

Repositories

Showing 10 of 38 repositories

Top languages

Loading…

Most used topics

Loading…