你的 Copilot 套餐,多一个上游
GitHub Copilot 现在已成为 AnyRouter 上的 BYOK 供应商。走 Copilot 路由的请求使用你自己的订阅,不消耗 AnyRouter 额度。密钥静态加密存储,且永不回显。
这是 Copilot 推理 API。GitHub Models 是较早的免费 PAT 服务,已于 2026 年 7 月 30 日停止,其在 AnyRouter 上的路由保持关闭。如果你保存过 Models 密钥,它在这里无法使用。
使用 GitHub 登录
打开 Dashboard → BYOK,添加 GitHub Copilot key,然后选择使用 GitHub 登录。AnyRouter 会显示一个验证码和一个链接。在 github.com/login/device 输入验证码,并用持有 Copilot 套餐的账号批准。token 会自动填入表单。
device code 保留在服务端。浏览器只看到短的用户码,所以没有任何敏感信息会被从标签页或截图中复制出去。
或使用 fine-grained token
前往 github.com/settings/personal-access-tokens。在 GitHub 的菜单中依次是 Settings、Developer settings、Fine-grained personal access tokens。
为持有 Copilot 套餐的资源所有者生成 token。在 Permissions 下,把 Copilot Requests 设为 read-only。复制 token 并粘贴到 GitHub Copilot key 表单。
Settings > Developer settings > Fine-grained personal access tokens
Permissions > Copilot Requests: Read-only以 ghp_ 开头的 classic token 会被 GitHub 拒绝。请改用 fine-grained token 或登录流程。
AnyRouter 如何处理 token
Copilot 不接受把 GitHub token 当作推理密钥。它需要大约三十分钟有效的会话 token。AnyRouter 在请求时用你保存的 token 换取一个,缓存它,并在过期前续期。
你的 GitHub token 永远不会到达推理上游。交换步骤只发送 API 要求的 Copilot integration 头。如果账号没有 Copilot 套餐,或 token 缺少权限,请求会以可操作的错误失败。
像其他模型一样使用
没有新的 header,也没有新的端点。用 AnyRouter key 发送普通的 Chat Completions 请求,并指定一个带 Copilot 路由的模型,例如 openai/gpt-4o-mini。
curl https://anyrouter.dev/v1/chat/completions \
-H "Authorization: Bearer sk-ar-v1-..." \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'你的套餐决定 Copilot 接受哪些模型 id。套餐外的模型会返回来自 GitHub 的错误。尚不支持 Enterprise proxy 端点,个人套餐今天可用。Copilot key 永不进入共享池,所以只有你自己的请求使用你的订阅。