Poly Model Bridge for Copilot将你的第三方模型中转站接入 GitHub Copilot Chat 的模型选择器。 Poly Model Bridge 是一个轻量的本地 VS Code 扩展,适用于 Anthropic、OpenAI 兼容网关、Sub2API、One-API、New-API、国产模型中转站以及本地模型服务。配置、密钥、模型和协议都可以在可视化界面中管理。
✨ 功能一览
🚀 快速开始1. 打开管理界面安装扩展后:
也可以使用命令面板运行 Poly Model Bridge: Open Manager,或点击底部状态栏的 PolyBridge 按钮。 2. 添加中转站填写:
3. 添加模型点击 向中转站查询可用模型,扩展会尝试从中转站读取模型列表。 如果中转站不提供模型列表接口,也可以点击 手动添加模型,填写中转站文档中的模型编号。 4. 在 Copilot 中启用模型打开 Copilot Chat 的模型选择器,进入 Manage Models,勾选 Poly Model Bridge 下的模型。 之后即可在 Chat、Edits 和 Agent 模式中使用。 🧠 推理强度和思考模式推理强度不同模型支持的档位并不相同,不要盲目全部勾选。常见档位包括:
中转站文档如果提供了其他名称,可以在“其他档位”中填写,例如 每个勾选的档位会在 Copilot 模型选择器中生成一个独立条目,例如 开启推理 / 思考模式是什么意思?这是一个请求开关,表示告诉上游模型“请启用推理能力”。它不是把模型的完整隐藏思维过程暴露出来:
如果你的模型或中转站不支持思考参数,请关闭此选项;遇到参数不支持的 400 错误时也应关闭。 🔌 三种接口格式
扩展会根据接口格式自动补上请求路径。通常只需要填写中转站的基础网址。 🗄️ Anthropic 缓存时长兼容如果中转站给系统提示词使用 此时可以将中转站或模型的缓存时长设置为 默认值是 🧭 Copilot 路由(避免误用订阅额度)在模型选择器里选中中转站模型,只决定主对话用什么模型。Copilot 还有几类请求走的是另一套解析逻辑,默认会落到 GitHub 订阅模型上:
打开管理界面的 Copilot 路由 面板即可统一设置,PolyBridge 会写入对应的 VS Code 设置。 关于子 Agent:VS Code 解析顺序是 调用时自带的 需要注意的是,模型在调用 由于 VS Code 按完整字符串精确匹配模型名,而「· 中转站名」后缀只在配置了多个中转站时出现,增删中转站之后请重新生成上述文件。命令 Copy Model Reference(复制模型引用名) 可以随时取到当前的正确写法。 ⚙️ 高级 JSON 配置普通用户无需编辑 JSON。熟悉配置文件的用户可以在
常用模型字段
❓ 常见问题模型没有出现在 Copilot 中确认已经点击“保存设置”,然后在 Copilot Chat 模型选择器中打开 Manage Models 并勾选模型。必要时执行 Developer: Reload Window。 返回 401 或 403检查 API Key 是否正确。Anthropic 通常使用 返回
|
| Option | Default | Notes |
|---|---|---|
id |
— | Model ID sent to the endpoint (required) |
name |
id |
Picker display name |
apiType |
provider's | Per-model protocol override |
efforts |
— | List of reasoning-effort variants → one picker entry each |
effort |
— | Single fixed effort (no suffix); ignored when efforts set |
thinking |
false |
Anthropic: adaptive thinking (summarized); Responses: reasoning summaries |
anthropicCacheTtl |
provider's / off |
Anthropic only: off, 5m, or 1h; per-model override for gateway cache-TTL compatibility |
maxInputTokens / maxOutputTokens |
200000 / 16000 | Context window / max_tokens |
toolCalling / vision |
true / true |
Capabilities advertised to Copilot |
maxTokensField |
max_completion_tokens |
Chat Completions only; set max_tokens for older gateways |
url |
— | Full endpoint override for this model |
Provider options: apiType, authHeader (x-api-key | authorization), requiresApiKey: false for local servers, extraHeaders.
Anthropic cache-TTL compatibility
Anthropic processes cache breakpoints in tools → system → messages order and requires longer TTLs before shorter TTLs. A gateway that writes system: 1h but injects its default tools: 5m produces an invalid 5m → 1h request. Set the provider's Anthropic cache TTL compatibility option to 1h (Manage Providers → provider → Anthropic cache TTL compatibility), or configure "anthropicCacheTtl": "1h". PolyBridge then explicitly marks only the last tool as 1h; gateways such as Sub2API that preserve client-provided tool TTLs no longer replace it with 5m.
This option only affects Anthropic requests that contain tools. off sends no cache controls and remains the recommended default for endpoints that do not rewrite caching. A 1-hour cache write can cost more than a 5-minute write; match this setting to the gateway's actual policy.
FAQ
Models don't show up? Check polyBridge.providers is set, run "Chat: Manage Language Models", reload the window if needed.
401/403? Try the other authHeader style — official Anthropic uses x-api-key, most OpenAI-style gateways use Authorization: Bearer.
protocol_mismatch / provider errors on one model? That model isn't served over the configured protocol by your gateway — set the correct per-model apiType.
Inline completions? VS Code limitation: BYOK models power Chat/Edits/Agent only; ghost-text completions keep using Copilot's built-in model.
中文说明
把任意第三方模型端点接入 GitHub Copilot 模型选择器,支持三种协议:Anthropic Messages、OpenAI Chat Completions、OpenAI Responses,可按模型混用;支持 Chat / Edits / Agent 模式。
亮点:像 Claude Code 一样按模型配置多档 reasoning effort("efforts": ["low","medium","high"]),每档在选择器里是独立条目(如 GPT-5.5 (high));"thinking": true 可把思考过程流式显示在聊天里;API Key 按 provider 存系统钥匙串。
Anthropic 缓存兼容:如果中转站给 system/messages 写入 1h 缓存、同时又默认给 tools 写入 5m,Anthropic 会因 5m → 1h 顺序非法而返回 400。可在 管理中转站 → Anthropic 缓存 TTL 兼容 中选择 1h,或配置 "anthropicCacheTtl": "1h";PolyBridge 会在最后一个工具上显式声明相同 TTL。默认 off,仅 Anthropic 且请求含工具时生效。
快速上手:命令面板运行 Poly Model Bridge: Open Manager,在统一 UI 中配置中转站、模型、协议、缓存 TTL、Headers 和 API Key → 模型选择器 Manage Models 勾选。
常见问题:401/403 换 authHeader 风格;某模型报 protocol_mismatch 说明网关没按该协议提供它,给这个模型单独设 apiType;行内补全不走 BYOK(VS Code 平台限制)。
License
MIT