routerbase-gateway
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "routerbase-gateway":https://skillpi.com/zh/skills/deepskill-6d06ac883dea055845b5fe6d833858f984741de5b35a7212702a3b17a5996123。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
将 AI 应用与 RouterBase 集成,作为兼容 OpenAI 的网关。用于将 OpenAI SDK 调用迁移到 RouterBase、配置 ROUTERBASE_API_KEY、选择模型 ID、设计模型回退路由,支持聊天补全、流式响应、工具调用、JSON 模式以及通过 RouterBase 端点生成图像、视频或音频媒体。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
Frontmatter
name: routerbase-gateway
description: >-
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.
license: Apache-2.0
compatibility: "Requires a RouterBase account, ROUTERBASE_API_KEY, and an OpenAI-compatible client or HTTP client."
metadata:
author: zenlee123
version: "1.0.0"
category: data-ai
tags: ["routerbase", "openai-compatible", "model-routing", "llm", "media-generation"]RouterBase Gateway
Overview
Use routerbase as an OpenAI-compatible gateway for chat, model routing, and media generation. This skill helps an AI agent update existing OpenAI-style integrations, keep credentials server-side, choose RouterBase model IDs, 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.
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
RouterBase model availability and pricing can change as upstream providers change. When credentials are available, check the live catalog before recommending final production settings.
curl "https://routerbase.com/api/v1/models?task=chat" \
-H "Authorization: Bearer $ROUTERBASE_API_KEY"
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
Fallback only on transient failures such as timeouts, network errors, 429, or 5xx. Do not retry blindly on invalid credentials, invalid model IDs, validation errors, or policy errors.
const modelPlan = [
"anthropic/claude-sonnet-4-5",
"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;
}
}
6. Handle media endpoints by modality
Choose the endpoint based on the requested media type:
- Image:
POST https://routerbase.com/v1/images/generations - Video:
POST https://routerbase.com/v1/videos/generations - Speech:
POST https://routerbase.com/v1/audio/speech - Audio generation:
POST https://routerbase.com/v1/audio/generations
Image requests are typically synchronous. Video and audio generation may be asynchronous, so persist the task ID, poll with backoff, or use a callback URL when the app has a durable webhook receiver.
Examples
Example 1: Migrate an OpenAI SDK call
User request: "Move our existing OpenAI chat integration to RouterBase."
Output:
Changes made:
- Set base URL to https://routerbase.com/v1
- Read API key from ROUTERBASE_API_KEY
- Kept the existing chat.completions request shape
- Swapped the model to google/gemini-2.5-flash for the smoke test
Validation:
- Run the backend-only smoke test with ROUTERBASE_API_KEY set
- Confirm the selected production model against the live RouterBase catalog
Example 2: Design fallback routing
User request: "Pick a low-latency primary model and a stronger fallback for support chat."
Output:
Routing plan:
- Primary: google/gemini-2.5-flash for fast support replies
- Fallback: anthropic/claude-sonnet-4-5 for harder cases or transient failures
- Retry only on network errors, 429, and 5xx
- Do not retry invalid model IDs or authentication failures
Smoke test:
- Send 20 representative support questions
- Track latency, refusal rate, JSON validity, and escalation quality
Example 3: Create an image generation request
User request: "Generate a product-style image through RouterBase."
Output:
curl -X POST https://routerbase.com/v1/images/generations \
-H "Authorization: Bearer $ROUTERBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/imagen-4",
"prompt": "A clean product illustration of an AI model routing dashboard",
"aspect_ratio": "1:1",
"resolution": "1K"
}'
Guidelines
- Prefer small smoke tests before changing production traffic.
- Preserve OpenAI-compatible request shapes unless the selected model requires model-specific fields.
- For tool calling, keep standard
toolspayloads and test the exact schema. - For JSON outputs, use
response_formatwhen supported and validate the result in application code. - For async media jobs, store the task ID, status, request hash, result URL, and error details.
- Tell the user when model IDs, pricing, or feature support need a live catalog check.
- Keep logs free of API keys, private prompts, customer data, and temporary media URLs.
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 直接解决用户明确的核心任务痛点,帮助用户将 OpenAI SDK 调用迁移至 RouterBase
- 提供详细的模型选择、回退路由设计和媒体生成指导
- 涵盖多种实际应用场景,如 API 迁移、新集成、模型路由、媒体生成和调试
亮点
- 触发词精准完整,覆盖多种变体,边界清晰
- 详细列出了使用场景,包括 API 迁移、新集成、模型路由、媒体生成和调试
亮点
- Phase/步骤清晰,有出口条件,含端到端示例
- frontmatter完整,单文件≤500行
- 提供了详细的代码示例和实际应用场景
亮点
- 工具来源明确,参数正确,覆盖主要异常
- 不可逆操作有确认机制
- 提供了详细的错误处理和回退策略
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 22, 38, 41, 47, 54 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- routerbase.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。