routerbase-gateway
БесплатноБез исполняемых скриптовНе проверенIntegrate AI applications with RouterBase as an OpenAI-compatible gateway. Use when a user wants to migrate OpenAI SDK calls to RouterBase, configure…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
RouterBase Gateway
Overview
Use RouterBase as an OpenAI-compatible gateway for chat, image, video, and audio models. The base URL is https://routerbase.com/v1; documentation is at https://docs.routerbase.com. This skill helps an AI agent update existing OpenAI-style integrations, keep credentials server-side, choose RouterBase model IDs from the live catalog, and add practical fallback handling.
Instructions
When a user asks to integrate or debug RouterBase, follow these steps:
1. Identify the workflow
Classify the request as one of:
- API migration: changing an existing OpenAI-compatible app to RouterBase.
- New integration: adding RouterBase to a backend, script, CLI, or agent.
- Model routing: choosing primary and fallback models for cost, latency, quality, or modality.
- Media generation: calling image, video, speech, or audio generation endpoints.
- Debugging: fixing auth, endpoint, model ID, streaming, or response-shape issues.
2. Keep credentials safe
- Use
ROUTERBASE_API_KEYin server-side environment variables. - Never paste, print, log, or commit a real API key.
- Do not place RouterBase keys in browser code, mobile apps, public repos, screenshots, or client-side configuration.
- Mask secrets in reports, for example
sk-rb-...abcd. - RouterBase has three key kinds: the API key
sk-rb-...(calls models), a Management keysk-rb-prov-...(creates and revokes API keys, cannot call models), and BYOK credentials (your own upstream provider key). Per API key you can set rate limits, credit caps (hourly, daily, total) and an IP allow-list.
3. Use the OpenAI-compatible base URL
For most chat and SDK migrations, preserve the OpenAI request shape and change only the API key, base URL, and model.
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": "Summarize model routing in one sentence."}],
)
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 a short RouterBase smoke test." }],
});
console.log(response.choices[0].message.content);
4. Verify model IDs before production
Model IDs have the form vendor/name (for example google/gemini-2.5-flash, anthropic/claude-sonnet-4.5; note the dot in Anthropic versions). The model field also accepts the vendor's own name (claude-opus-4-8) or a listed alias, but not dated snapshot IDs such as claude-sonnet-4-5-20250929, which return 404. IDs and prices change, and some IDs shown in docs examples are not served, so check the live catalog before recommending final production settings. The OpenAI-format list answers without a key:
curl -s https://routerbase.com/v1/models | python3 -c "import sys,json; [print(m['id'], m['modality'], m.get('pricing')) for m in json.load(sys.stdin)['data']]"
Each entry has modality (chat, image, video, embedding), context_length, supported_parameters (look for tools, reasoning) and pricing. GET /v1/models/{id} returns one model. A separate dashboard catalog at /api/v1/models uses different IDs (chat.deepseek_v4_1_flash) that do not work in the model field.
For routing plans, document:
- Primary model.
- Fallback model.
- Why each model fits.
- Feature assumptions to test, such as streaming, tool calling, JSON mode, vision, or context length.
- A minimal smoke test request.
5. Add conservative fallback handling
Fall back only on transient failures: network errors, 429 (rate limited), 455 (upstream outage or timeout; the same status also carries insufficient_quota, so stop if the error body says credits are out) and 5xx. Do not retry 400 (bad parameters or content policy), 401, 402 (out of credits), 404 (unknown model) or 422. Rejected requests are not queued, so add exponential backoff on 429. The default limit is 20 new requests per 10 seconds per API key.
const modelPlan = ["anthropic/claude-sonnet-4.5", "google/gemini-2.5-flash"];
const isTransient = (error) =>
error.status === undefined || [429, 455].includes(error.status) || error.status >= 500;
async function chatWithFallback(messages) {
let lastError;
for (const model of modelPlan) {
try {
return await client.chat.completions.create({ model, messages });
} catch (error) {
if (!isTransient(error)) throw error;
lastError = error;
}
}
throw lastError;
}
Every response carries an x-request-id header; quote it when contacting support.
6. Handle media endpoints by mo
Установить routerbase-gateway в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл routerbase-gateway?
Integrate AI applications with RouterBase as an OpenAI-compatible gateway. Use when a user wants to migrate OpenAI SDK calls to RouterBase, configure ROUTERBASE_API_KEY, choose model IDs, design model fallback routes, call chat completions, stream responses, use tool calling or JSON mode, or generate image, video, or audio media through RouterBase endpoints.
Как установить скилл routerbase-gateway?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл routerbase-gateway запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic