routerbase-model-gateway
できること
RouterBaseは、GPT、Claude、GeminiなどのさまざまなAIモデルとお使いのアプリケーションをつなぐ「通訳」のような役割を果たします。1つの入口からさまざまなモデルを利用でき、アクセスキーを外部に出さずに済みます。
使う場面
- ✓すでにOpenAI APIを使っているアプリケーションを、RouterBaseへ移行するとき。
- ✓テキスト、画像、音声など、作業内容に応じて使うAIモデルを選ぶとき。
- ✓リアルタイムの応答や特定の形式など、さまざまな機能のためにRouterBaseを設定してみるとき。
スキルのリンク
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/routerbase-model-gateway/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“アプリケーションを、OpenAI APIを直接使う代わりにRouterBaseを使うように設定するにはどうすればよいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
アプリケーションはRouterBaseにリクエストを送ります。RouterBaseは、それを最適なAIモデルへ転送します。異なるモデルとのやり取りはRouterBaseが担当し、アクセスキーも安全に保たれます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
RouterBase Model Gateway
Overview
Use routerbase when an application needs one OpenAI-compatible API surface for model routing across GPT, Claude, Gemini, image, video, audio, and embedding workloads. This skill helps agents migrate existing OpenAI SDK calls, document model-selection tradeoffs, and produce safe implementation snippets without exposing credentials.
RouterBase model availability, pricing, and provider capabilities can change, so treat examples as starting points and verify current catalog data before production recommendations.
When to Use This Skill
- Use when migrating an OpenAI-compatible client to RouterBase by changing the base URL and model ID.
- Use when selecting primary and fallback models for chat, reasoning, vision, media generation, audio, or embeddings.
- Use when debugging RouterBase request setup, headers, environment variables, streaming, tool calls, JSON mode, or multimodal payloads.
- Use when documenting an internal model-routing plan that balances cost, latency, quality, and provider redundancy.
How It Works
Step 1: Classify the Workload
Identify the modality and hard constraints before choosing a model:
- Modality: chat, vision, image, video, audio, embeddings, or mixed.
- Quality target: draft, production, high-stakes review, or automated background task.
- Runtime constraints: latency budget, context length, streaming, JSON mode, tool calling, and retry tolerance.
- Business constraints: price ceiling, provider preference, regional requirements, and fallback rules.
Step 2: Configure the OpenAI-Compatible Client
Keep the RouterBase API key server-side in an environment variable such as ROUTERBASE_API_KEY. Do not put keys in browser, mobile, or public repository code.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ROUTERBASE_API_KEY"],
base_url="https://routerbase.com/v1",
)
response = client.chat.completions.create(
model="google/gemini-2.5-flash",
messages=[{"role": "user", "content": "Write one sentence about model routing."}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ROUTERBASE_API_KEY,
baseURL: "https://routerbase.com/v1",
});
const response = await client.chat.completions.create({
model: "google/gemini-2.5-flash",
messages: [{ role: "user", content: "Write one sentence about model routing." }],
});
console.log(response.choices[0].message.content);
Step 3: Validate Model IDs and Capabilities
When credentials and network access are available, check the live catalog before locking in a model ID or price-sensitive recommendation.
curl "https://routerbase.com/api/v1/models?task=chat" \
-H "Authorization: Bearer $ROUTERBASE_API_KEY"
Confirm feature assumptions with a small request fixture:
- Streaming works when
stream: trueis set. - Tool calling accepts the exact schema used by the app.
- JSON mode returns parseable output and still passes application validation.
- Vision or media payloads use the expected OpenAI-compatible content shape.
Step 4: Design Fallbacks Conservatively
Use explicit application-level fallbacks unless the user's RouterBase account already has a smart-routing policy configured.
const modelPlan = [
"anthropic/claude-sonnet-4-6",
"google/gemini-2.5-flash",
];
for (const model of modelPlan) {
try {
return await client.chat.completions.create({ model, messages });
} catch (error) {
if (!isRetryableRouterBaseError(error)) throw error;
}
}
Treat transient network errors, timeouts, rate limits, and server errors as candidates for retry. Do not blindly retry authentication failures, invalid model IDs, validation errors, or policy refusals.
Examples
Migration Checklist
When converting an existing OpenAI SDK integration:
- Change the base URL to
https://routerbase.com/v1. - Read
ROUTERBASE_API_KEYfrom server-side environment configuration. - Replace the model name with a RouterBase model ID that matches the task.
- Preserve standard OpenAI request fields unless RouterBase documentation says otherwise.
- Run one minimal smoke test before shipping.
Routing Plan Format
Use this table when recommending a model strategy:
| Use case | Primary model | Fallback model | Reason | Validation |
|---|
…
よくある質問
「モデル」とは何ですか?
モデルとは、リクエストを処理するさまざまな種類の人工知能のことです。文章、画像、音声などを生成するものがあります。
APIキーをコードに直接書いてはいけないのはなぜですか?
APIキーをコードに直接書くのは、セキュリティ上のリスクがあります。コードを見られる人は誰でもキーを見て使えるため、料金が発生したり、不正利用されたりするおそれがあります。
「OpenAIクライアントの移行」とはどういう意味ですか?
すでにOpenAI APIを使うように作られたアプリケーションを、RouterBaseでも動くように調整することを指します。多くの場合、いくつかの設定を変更するだけで済みます。
詳細
作者による元の説明
Integrate RouterBase as an OpenAI-compatible model gateway for routing GPT, Claude, Gemini, media, audio, and embedding requests.
人気
- GitHubのスター
- 48k
- ランキング
- #5647
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
00-andruia-consultant
48kエージェントがAIプロジェクトの立ち上げや改善を支援します。コードを分析し、ツールを提案し、スペイン語で行動計画を作成します。
007
48kエージェントがセキュリティ監査と脅威モデリングを行えるようにします。攻撃や脆弱性からプロジェクトを守るのに役立ちます。
10-andruia-skill-smith
48kエージェントがAIツールの作成や改善を支援します。ツールの動作を定義し、ドキュメントを書き、構造を検証します。
20-andruia-niche-intelligence
48kエージェントが特定の業界に関する要約を作成できるようにします。信頼できる情報源を使って、プロジェクトの背景、ルール、利用パターン、リスクを把握するのに役立ちます。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。