Everything you need to ship
Seven products, one API key. Start with a single request and grow into a production agent without changing providers. That key covers text, image generation, video generation, text-to-speech, and speech-to-text models, documented in the multimodal guides.
80+ 社のプロバイダーの 600+ 個のモデルに対応する単一の OpenAI 互換エンドポイントで、プロバイダーに障害が発生すると自動的にフォールバックします。
https://openrouter.ai/api/v1TypeScript、Python、Go で同じ型付きクライアントを利用でき、ストリーミング、ツール、構造化出力はどの言語でも同じように動作します。
npm i @openrouter/sdk型安全なツール、マルチターンループ、ストリーミング、停止条件を利用できます。すべてのプロバイダーを横断してルーティングする本番環境向けエージェントを構築できます。
npm i @openrouter/agentプラットフォーム向けの再現可能でレビュー可能な設定を使い、OpenRouter を Infrastructure as Code として管理できます。
source = "OpenRouterTeam/openrouter"Claude Code、Cursor、独自のクライアントなど、あらゆる Model Context Protocol クライアントから全 600+ 個のモデルにアクセスできます。
https://mcp.openrouter.ai/mcpエージェントハーネス、人間が介在するツール、評価、コスト管理、画像生成に使える実用的なレシピです。
数行のコードで本番環境へ
モデル文字列を置き換えるだけでプロバイダーを変更できます。コードの他の部分を変更する必要はありません。
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)三つのステップで稼働開始
ほとんどのチームは五分以内に最初のリクエストに成功しています。
- 1
APIキーを取得
ダッシュボードからキーを作成してください。開始にサブスクリプションもカードも必要ありません。
- 2
クライアントの接続先を OpenRouter に設定
すでに OpenAI SDK をお使いですか?ベース URL とキーを変更してください。それ以外はすべてそのままです。
- 3
任意のモデルを選択
author/slug 形式の文字列を使用してください。プロバイダーの障害がサービスの障害につながらないよう、フォールバックを追加してください。
- クイックスタートの全文を読む
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!" }
]
}'