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 OpenRouter Providers on OpenRouter Tokens routed per week

Website Docs Twitter Discord


Why OpenRouter?

  • 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.
OpenRouter performance

Quickstart with the OpenRouter SDKs

TypeScript@openrouter/sdk

npm add @openrouter/sdk
import { 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);
}

Pythonopenrouter

pip install openrouter
import 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)

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"
)

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/agent
import 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

🔧 Our open source

SDKs & agent tooling

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

Examples & integrations

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

Resources


Built with ❤️ by the OpenRouter team.

Pinned Loading

  1. typescript-sdk typescript-sdk Public

    TypeScript 218 67

  2. python-sdk python-sdk Public

    Python 142 33

Repositories

Showing 10 of 39 repositories

Top languages

Loading…

Most used topics

Loading…