一键导入
routerbase-model-gateway
Integrate RouterBase as an OpenAI-compatible model gateway for routing GPT, Claude, Gemini, media, audio, and embedding requests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Integrate RouterBase as an OpenAI-compatible model gateway for routing GPT, Claude, Gemini, media, audio, and embedding requests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | routerbase-model-gateway |
| description | Integrate RouterBase as an OpenAI-compatible model gateway for routing GPT, Claude, Gemini, media, audio, and embedding requests. |
| category | ai-ml |
| risk | safe |
| source | community |
| source_repo | zenlee123/routerbase-agent-skills |
| source_type | community |
| date_added | 2026-07-07 |
| author | zenlee123 |
| tags | ["routerbase","llm-routing","openai-compatible","model-gateway"] |
| tools | ["claude","cursor","gemini","codex","antigravity"] |
| license | MIT-0 |
| license_source | https://github.com/zenlee123/routerbase-agent-skills/blob/main/LICENSE |
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.
Identify the modality and hard constraints before choosing a model:
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);
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:
stream: true is set.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.
When converting an existing OpenAI SDK integration:
https://routerbase.com/v1.ROUTERBASE_API_KEY from server-side environment configuration.Use this table when recommending a model strategy:
| Use case | Primary model | Fallback model | Reason | Validation |
|---|---|---|---|---|
| Support chat | Provider/model ID | Provider/model ID | Low latency and acceptable quality | Streaming smoke test |
| Deep analysis | Provider/model ID | Provider/model ID | Strong reasoning, higher cost acceptable | Eval prompt plus human review |
Problem: The code works with one provider but fails after switching models. Solution: Re-test tool calling, JSON mode, streaming, and multimodal payloads for each selected model.
Problem: Fallback logic retries non-retryable errors. Solution: Retry only transient failures and fail fast on authentication, validation, and invalid model errors.
Problem: A model recommendation becomes stale. Solution: Re-check the RouterBase catalog and pricing page before finalizing the plan.
@api-analyzer - Use when the task is only to validate one API request shape.@langfuse - Use when the task needs production LLM observability, tracing, and evaluation.Use codex-profiles to run Codex CLI or Codex Desktop with isolated CODEX_HOME profiles for separate accounts, projects, and local state.
Give an AI agent a permanent network address, encrypted P2P messaging, and an installable app store via Pilot Protocol
A ship gate that runs before any production deploy: checks the silent failure modes that make a deploy 'succeed' while prod stays broken, then verifies the live revision instead of trusting deploy output.
Use Tree Ring Memory for local-first AI-agent memory lifecycle work: recall, evidence, audit, forgetting, and consolidation without transcript dumping.
Go in depth harness — fan-out web searches, fetch sources, adversarially verify claims, synthesize a cited report.
Schedule AI agent runs with cron, loops, or external clocks while avoiding unsafe tight autonomous timers.