byok-custom-model
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese🔑 BYOK — Custom LLM Models
🔑 BYOK — 自定义LLM模型
Add a custom LLM endpoint to the model selector. Bypasses the platform proxy — you supply your own API key, the agent hits the vendor / aggregator directly (OpenRouter, DashScope, Anthropic native, self-hosted, etc.).
The tool stays built-in. This SKILL.md is the reference doc + onboarding flow.
custom_models在模型选择器中添加自定义LLM端点。绕过平台代理——您提供自己的API密钥,Agent直接对接供应商/聚合器(OpenRouter、DashScope、Anthropic原生接口、自部署服务等)。
custom_modelsSee also
相关文档
- — broader model selection / OAuth context
config/context/references/model-onboarding.md - skill — for ChatGPT/Codex OAuth (different mechanism, NOT BYOK)
chatgpt-codex-onboarding
- — 更全面的模型选择/OAuth相关说明
config/context/references/model-onboarding.md - skill — 适用于ChatGPT/Codex的OAuth接入(机制不同,不属于BYOK范畴)
chatgpt-codex-onboarding
Onboarding flow — API-example first
接入流程 — 优先使用API示例
When a user wants to add a custom model, the first move is NOT to ask for or . Instead:
base_urlupstream_model- Ask the user to paste the provider's official API example from their docs (curl / requests sample). Tell them not to include a real API key — placeholders or fake keys are fine.
- Run . It auto-detects:
custom_models(action="parse_example", api_example="<pasted>")base_urlupstream_model- (openai vs anthropic)
wire thinking_mode- vendor-specific
request_params capabilities
- Review the parsed draft with the user (1 sentence summary), then call with the detected fields.
add - The call dispatches a secure input popup to collect the API key. The key goes straight to
add, never to chat history or tool results.workspace/.env - After success, the model appears in the selector as . User switches with
custom/<short-name>./model custom/<name>
Only ask for / directly if the user refuses to paste an example or already supplied them.
base_urlupstream_model当用户想要添加自定义模型时,第一步不要直接询问或。正确步骤如下:
base_urlupstream_model- 请用户粘贴供应商官方文档中的API示例(curl/请求示例)。提醒不要包含真实API密钥——使用占位符或假密钥即可。
- 执行。该工具会自动识别:
custom_models(action="parse_example", api_example="<粘贴的内容>")base_urlupstream_model- (openai或anthropic协议类型)
wire thinking_mode- 供应商特定的
request_params capabilities
- 向用户展示解析后的草稿总结(一句话概括),然后调用接口传入识别出的字段。
add - 调用会触发一个安全输入弹窗来收集API密钥。密钥将直接存入
add,绝不会进入聊天记录或工具结果中。workspace/.env - 成功后,模型会以的形式出现在选择器中。用户可通过
custom/<简称>切换模型。/model custom/<名称>
仅当用户拒绝粘贴示例或已自行提供/时,才直接询问这些参数。
base_urlupstream_modelCurated vendors — add_template
shortcut
add_template精选供应商 — add_template
快捷方式
add_templateFor these 9 vendors, skip entirely. Call — all fields auto-filled, the user only provides the API key via the secure popup.
parse_exampleadd_template(vendor="<id>")| vendor id | notes |
|---|---|
| Anthropic native API (Claude direct, not via Bedrock/Vertex) |
| OpenAI API direct |
| Alibaba DashScope |
| DeepSeek API |
| Moonshot |
| Xiaomi MiMo |
| Google AI Studio (NOT Vertex) |
| Google Gemma |
| Venice AI (privacy-first) |
Optional overrides the curated default — accepts any model id from for vendors with dynamic discovery.
upstream_modellist_vendor_models对于以下9个供应商,可完全跳过步骤。调用——所有字段会自动填充,用户仅需通过安全弹窗提供API密钥即可。
parse_exampleadd_template(vendor="<id>")| 供应商ID | 说明 |
|---|---|
| Anthropic原生API(直接对接Claude,而非通过Bedrock/Vertex) |
| OpenAI直接API |
| 阿里云DashScope |
| DeepSeek API |
| Moonshot(月之暗面) |
| 小米MiMo |
| Google AI Studio(非Vertex) |
| Google Gemma |
| Venice AI(隐私优先) |
可选参数可覆盖精选默认值——支持从获取的任何模型ID(针对支持动态发现的供应商)。
upstream_modellist_vendor_modelsDynamic vendor catalogs — list_vendor_models
list_vendor_models动态供应商模型目录 — list_vendor_models
list_vendor_modelsSome vendors ship new models often. Use to fetch the live catalog with capabilities (vision, tools, reasoning, privacy tier), pricing, and context length.
list_vendor_models(vendor="<id>")/modelsRequired when:
- User wants the latest model not in curated defaults
- User asks for a specific capability ("which Venice model supports vision?")
- User wants pricing comparison
Only works for vendors with in .
supports_dynamic_models: truetemplates部分供应商会频繁发布新模型。使用可获取实时目录,包含模型能力(视觉、工具调用、推理、隐私等级)、定价及上下文长度信息。
list_vendor_models(vendor="<id>")/models在以下场景中需使用该工具:
- 用户需要最新的非默认精选模型
- 用户询问特定能力(如“哪个Venice模型支持视觉功能?”)
- 用户需要对比定价
仅对中标记的供应商生效。
templatessupports_dynamic_models: trueActions reference
操作参考
| action | required | purpose |
|---|---|---|
| — | List curated vendor presets |
| | Live |
| | One-click registration for curated vendor (recommended path for 9 known vendors) |
| | Parse docs API example into a safe draft (non-curated vendors) |
| | Register from custom args (use after |
| — | Show all registered custom entries |
| | Inspect one entry |
| | Delete an entry |
| 操作 | 必填参数 | 用途 |
|---|---|---|
| — | 列出精选供应商预设 |
| | 获取实时 |
| | 一键注册精选供应商(推荐用于9个已知供应商的接入路径) |
| | 将文档中的API示例解析为安全草稿(适用于非精选供应商) |
| | 通过自定义参数注册模型(需在 |
| — | 展示所有已注册的自定义模型条目 |
| | 查看单个模型条目详情 |
| | 删除模型条目 |
After registration
注册完成后
- Model appears in the selector prefixed with .
custom/ - User switches via (e.g.
/model custom/<name>) or via the model picker UI./model custom/qwen-plus-e3f4 - Subsequent calls bypass the platform proxy — the vendor's pricing applies directly to the user's BYOK quota.
- 模型将以为前缀出现在选择器中。
custom/ - 用户可通过(例如
/model custom/<名称>)或模型选择器UI切换模型。/model custom/qwen-plus-e3f4 - 后续调用将绕过平台代理——供应商的定价将直接适用于用户的BYOK配额。
Critical rules
重要规则
- Never accept an API key pasted in chat. If the user pastes one, ignore it, refuse to register, and explain that the secure popup is the only way.
- Never re-issue the secure-input popup automatically if the user hasn't responded — wait.
- Don't manually edit or
workspace/config/custom_models.yaml. Always go through this tool.workspace/.env - The 9 curated vendors always use . Only use
add_template+parse_examplefor self-hosted or rare providers.add
- 绝不接受在聊天框中粘贴的API密钥。若用户粘贴密钥,需忽略并拒绝注册,同时说明安全弹窗是唯一合法的方式。
- 不要自动重复触发安全输入弹窗——需等待用户响应后再操作。
- 不要手动编辑或
workspace/config/custom_models.yaml。所有操作必须通过本工具完成。workspace/.env - 9个精选供应商必须使用。仅对自部署或罕见供应商使用
add_template+parse_example流程。add