FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Original HTTPS Page]

OpenRouter · GitHub

OpenRouter

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



The unified interface for LLMs.

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



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.

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 254 74

  2. python-sdk python-sdk Public

    Python 160 44

Repositories

Loading
Type
Select type
All Public Sources Forks Archived Mirrors Templates
Language
Select language
All Elixir Go JavaScript MDX Python Rust Svelte TypeScript
Sort
Select order
Last updated Name Stars
Showing 10 of 40 repositories
  • .github Public
    OpenRouterTeam/.github's past year of commit activity
    TypeScript 1 0 1 0 Updated Sep 23, 2026
  • docs Public
    OpenRouterTeam/docs's past year of commit activity
    MDX 8 12 13 6 Updated Sep 23, 2026
  • benchmark-harness Public

    OpenRouter TypeScript harness for reproducible LLM benchmarks and evaluations.

    OpenRouterTeam/benchmark-harness's past year of commit activity
    TypeScript 16 Apache-2.0 11 0 18 Updated Sep 23, 2026
  • terraform-provider-openrouter Public

    Official Terraform provider for OpenRouter — manage API keys, guardrails, workspaces, BYOK credentials, and observability destinations as infrastructure-as-code

    OpenRouterTeam/terraform-provider-openrouter's past year of commit activity
    Go 4 4 5 3 Updated Sep 22, 2026
  • OpenRouterTeam/typescript-sdk's past year of commit activity
    TypeScript 254 Apache-2.0 74 18 18 Updated Sep 23, 2026
  • typescript-agent Public

    OpenRouter Agent SDK

    OpenRouterTeam/typescript-agent's past year of commit activity
    TypeScript 27 16 2 9 Updated Sep 23, 2026
  • go-sdk Public
    OpenRouterTeam/go-sdk's past year of commit activity
    Go 70 Apache-2.0 16 5 2 Updated Sep 22, 2026
  • python-sdk Public
    OpenRouterTeam/python-sdk's past year of commit activity
    Python 160 Apache-2.0 44 17 4 Updated Sep 22, 2026
  • Switchyard Public Forked from NVIDIA-NeMo/Switchyard

    Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

    OpenRouterTeam/Switchyard's past year of commit activity
    Python 1 Apache-2.0 306 0 0 Updated Sep 22, 2026
  • skills Public
    OpenRouterTeam/skills's past year of commit activity
    TypeScript 262 46 15 80 Updated Sep 21, 2026

Back | FazBrowse Home | New Git URL