文档 · 供应商

GitHub Copilot 接入 Claude Code、Codex、Gemini CLI 和 OpenCode

Copilot 的席位里有 Claude、GPT、Gemini 等模型。在 magpie 里登录一次 Copilot,Claude Code、Codex、Gemini CLI、OpenCode 以及你接入的其他工具,都能通过 magpie 的本地网关 127.0.0.1:3425 用上你套餐里的模型,不需要 API Key。

登录 Copilot

  1. 打开添加供应商在 magpie 的 供应商 页点 + 添加供应商,再点 Copilot 卡片。
  2. 在 GitHub 上输入验证码magpie 会显示一个验证码,并打开 GitHub 的设备登录页 github.com/login/device。输入验证码并授权后,magpie 会向 GitHub 确认这是谁的账号、是什么套餐,账号随即出现在 Copilot 下面。
  3. 给工具选上在 Agent 页点工具那一行的模型,选一个 copilot/… 模型。
终端
magpie accounts add copilot                        # github.com
magpie accounts add copilot --host acme.ghe.com    # GHE.com 上的 GitHub Enterprise
magpie accounts copilot                            # 每个账号及其用量

magpie 会从三个地方拿到 Copilot 登录:

编辑器和 CLI 的登录 magpie 只读不写。两者都有时,先用编辑器的 github.com 登录,再用 CLI 的,最后是编辑器的 GHE.com 登录。如果 GitHub 拒绝了编辑器的令牌,magpie 会改用 CLI 里同一个账号的登录,绝不会换成别人的账号。

GHE.com 上的 GitHub Enterprise。使用数据驻留的企业要在自己的 <name>.ghe.com 登录,所以添加账号时加上 --host(或者在登录面板里回答“账号在 GHE.com 上?”)。magpie 只接受 github.com 或 <name>.ghe.com 地址,GitHub 令牌不会被发到你随手填的其他主机。这类账号走企业自己的 copilot-api.<name>.ghe.com。同一个用户名在 github.com 和 GHE.com 上算两个账号:you 和 you@acme.ghe.com。

你的席位能用哪些模型

magpie 会为每个账号请求 Copilot 的 /models,列出返回的模型,所以列表跟着你的套餐走,而不是一张写死的表。模型名是 copilot/ 加上 Copilot 自己的 ID,比如 copilot/claude-opus-5.5、copilot/gpt-5.4、copilot/gpt-5.3-codex。magpie models 会全部列出来。

Claude Code 会把带小数点的 Claude 版本号当成更老的模型,所以 magpie 给它的 Copilot Claude 模型用短横线写法(claude-opus-5-5),请求到 Copilot 之前再换回原名。其他工具看到的是 Copilot 原本的写法。

在各个工具里用

在 Agent 页里点某个工具那一行的模型来选,或者在终端里选。每篇指南都写了 magpie 在那个工具的配置里改了什么、怎么换回去。

终端
magpie claude copilot/claude-opus-5.5
magpie codex copilot/gpt-5.4
magpie gemini model copilot/gpt-5.4-mini
magpie opencode copilot/claude-opus-5.5

Copilot CLI 本身也是 magpie 支持的工具。它那一行可以选 auto(让 Copilot 挑)和 Copilot 自己的模型,也可以选你在 magpie 里添加的任何其他模型,这些模型通过 Copilot CLI 的 providers.json 接进去。

请求怎么到 Copilot

Copilot 并不是每个模型都开放所有接口:最新的 OpenAI 模型只走 Responses,Claude 模型走 Chat Completions 和 Anthropic Messages,Gemini 模型和较老的模型只走 Chat Completions。magpie 会把每个请求发到这个模型可用的接口上,和工具的接口不一致时做转换,流式输出和工具调用都保留。

Copilot Auto

copilot/auto 是 Copilot 替你的账号挑的模型。它不在 Copilot 的 /models 里,所以 magpie 总会补上。学生套餐只能选它。

高级请求、用量与费用

每个 Copilot 账号都有一张卡片,按 GitHub 给出的数据显示三项额度:高级请求、聊天请求 和 代码补全,格式是“已用 / 额度”。magpie accounts copilot 输出的也是这些。

用量 页会统计经过 magpie 的每个工具和模型的 token、缓存命中和费用。订阅的费用是按模型厂商的公开价估算的,你给模型设了价格就按你的价格算。和 Anthropic 官方计价有一处不同:Copilot 的缓存写入不论保留多久都是同一个价,所以 magpie 把 1 小时缓存写入按 5 分钟的价格算。以 claude-opus-5.5 为例,是每百万 token 5 美元,而按 Anthropic 的 2 倍输入价是 8 美元。

多账号与自动切换

常见报错

看到的提示意思
GitHub 拒绝了这个 Copilot 登录,请重新登录GitHub 不再接受这个账号的令牌。在它那一行重新登录即可,账号原地更新,设置都保留。网络错误或 GitHub 的 5xx 不会让账号被标记,请求成功一次标记就会消失。
the GitHub token Copilot’s editors keep in … was refused编辑器里的登录失效了。在编辑器或 magpie 里重新登录 Copilot,或者把那个文件挪走。
<login> has no Copilot subscription你授权的 GitHub 账号没有 Copilot 套餐。换有席位的账号登录。
Copilot doesn’t serve this model on Anthropic’s Messages API; it isn’t about your planCopilot 只在其他接口上提供这个模型,和套餐无关。magpie model api copilot/<model> chat 让它走 Chat Completions。
The requested model is not supported.Copilot 目前不给这个账号用这个模型。magpie 会在账号的模型列表和各工具的选择里把它隐藏 6 小时,然后再试。用 Auto 时会另挑一个模型重发。
Copilot doesn’t offer Auto to this account …Copilot 没有给出选择,账号也没有可以手动选的模型。到 github.com/settings/copilot 看看套餐。
the code expired; start again · the sign-in was declined on GitHub验证码在输入前过期了,或者在 GitHub 页面上点了拒绝。重新登录一次。
Copilot signs in on github.com or an enterprise’s <name>.ghe.com, not …--host 填的既不是 github.com 也不是 GHE.com 地址。
subscription accounts are off in magpie设置 → 隐私 → 订阅账号 是关着的(或运行过 magpie accounts discovery off),magpie 不读取任何登录,也不提供任何订阅,Copilot 也一样。打开它,或运行 magpie accounts discovery on。

常见问题

Claude Code 怎么用 Copilot 订阅?

先在 magpie 里登录 Copilot(供应商 → 添加供应商 → Copilot,GitHub 会给你一个验证码去输入),然后在 Claude Code 那一行选一个 copilot/… 模型,比如 copilot/claude-opus-5.5,或者运行 magpie claude copilot/claude-opus-5.5。magpie 会写好 Claude Code 的 settings.json。Copilot 的 Claude 模型直接接收 Claude Code 的 Anthropic 请求,GPT 和 Gemini 模型则由 magpie 转换协议。

Codex 能用 Copilot 的模型吗?

能。Codex 说的是 OpenAI Responses,magpie 也用 Responses 去问 Copilot 的 OpenAI 模型,所以请求直接转过去,联网搜索也能用。Copilot 的 Claude 和 Gemini 模型由 magpie 转换。在 Codex 那一行选模型,或运行 magpie codex copilot/gpt-5.4,模型会出现在 Codex 的 /model 里。

Gemini CLI 和 OpenCode 能用 Copilot 吗?

能。运行 magpie gemini model copilot/gpt-5.4-mini 或 magpie opencode copilot/claude-opus-5.5,或者在对应那一行选模型。magpie 会转换 Gemini CLI 的请求,并把模型写进 OpenCode 的 opencode.json。

一定要在 VS Code 之类的编辑器里登录 Copilot 吗?

不用。magpie 自己用设备验证码登录 GitHub。如果这台电脑上 Copilot 的编辑器插件或 Copilot CLI 已经登录,magpie 也会读取那个登录,但从不改动它。

会消耗我的高级请求吗?

请求是用你的账号发给 Copilot 的,所以按 Copilot 的方式计入你的套餐。你输入的一轮按一次请求计费,接着这一轮的工具结果不另算。magpie 会显示每个账号的高级请求、聊天请求和代码补全用了多少。

Copilot Business、Enterprise 和 GHE.com 能用吗?

能。magpie 从 GitHub 读出套餐:Free、Pro、Pro+、Max、Education、Business 或 Enterprise。GHE.com 上的企业用 magpie accounts add copilot --host <name>.ghe.com 登录。Business 或 Enterprise 席位的额度用完后会被暂停,magpie 会把这个账号当作已用完,直到额度重置。

为什么我的列表里少了某个 Copilot 模型?

magpie 列出的是 Copilot 的 /models 给这个账号的模型:只有对话模型,不含任何模型选择器都不提供的,也不含这个账号无法开启的。被 Copilot 用“The requested model is not supported.”拒绝的模型会被隐藏 6 小时,之后再试,以防你的套餐已经变了。

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · Gemini · Grok · Mistral · OpenRouter · Ollama

各个工具的指南:Claude Code 接入其他模型、Codex 接入其他模型、Gemini CLI 接入其他模型、OpenCode 接入其他模型。遇到问题可以在 Discord 提问。