官方更新 GitHub Blog AI/ML Wed, 22 Jul 2026 正文 ok 978 words

Copilot 与原始 API 访问:你究竟在为什么付费?

英文标题:Copilot vs. raw API access: What are you actually paying for?

GitHub 表示,Copilot 的计量使用会按照所选模型公布的 API 费率,基于输入、输出和缓存 Token 计算;付费套餐仍包含代码补全和 Next Edit Suggestions。文章认为,直接调用 API 与使用 Copilot 覆盖的是不同层级:前者适用于需要自行构建提示词、检索、路由、安全与计费体系的产品或平台,后者则提供已连接编辑器、仓库、终端、Issue、Pull Request 和组织策略的开发工作流。GitHub 的评估显示,在保持模型、任务、上下文窗口、推理强度、工具选择和 MCP 服务器一致的条件下,Copilot CLI 在多数配置中以更少 Token 达到与模型供应商 harness 相当的任务解决效果。BYOK 允许开发者在 Copilot 工作流中使用自有供应商密钥,但仍处于公开预览阶段,企业应在采购或架构决策前查阅最新文档。
打开原文相关 4 · 机会 6
media75.6 KB media33.6 KB media84.8 KB media40.0 KB media58.0 KB media27.6 KB media124.7 KB media50.1 KB media75.4 KB media34.5 KB media67.7 KB media32.0 KB media84.0 KB media40.3 KB media263.1 KB media35.6 KB media6.9 KB media24.1 KB media139.8 KB media21.4 KB

中文

我一直看到这样一个问题:“既然我可以通过 API 调用相同的模型,为什么还要为 GitHub Copilot 付费?”

这是一个合理的问题。答案取决于你需要自行承担哪些工作。

你是在构建一项产品功能,并自行负责提示词、检索、路由、日志、安全模型和计费控制吗?还是希望从一个 GitHub Issue 出发,在编辑器、仓库、终端和组织策略均已连接的环境中,最终得到一个经过审查的 Pull Request?

成本是这个方程的一部分。Copilot 套餐包含每月分配的 GitHub AI Credits。计量使用量按照所选模型公布的费率,根据输入、输出和缓存 Token 计算。

原始 API 访问与 Copilot 面向该系统的不同层级。正确的选择取决于你需要自行承担的工作。

现在来看一个常见的维护任务:开发者从一个 GitHub Issue 开始,检查仓库,修改受影响的文件,在终端中运行测试套件,并创建 Pull Request 供审查。模型调用只是该工作流中的一个步骤。其周边系统还需要处理 Issue、差异(diff)、仓库指令、允许执行的命令以及组织策略。

GitHub Copilot 可跨编辑器、仓库、Pull Request、Issue、终端和组织控制连接这些工作界面。除了模型访问外,这正是套餐所覆盖的内容。此次计费变更让这种划分更加清晰:代码补全和 Next Edit Suggestions 仍包含在付费套餐中,而 AI Credits 则适用于资源消耗更高的聊天和智能体工作。

因此,单项任务的成本并不只取决于公布的 Token 费率。上下文选择、工具使用、重试,以及从 Issue 到经审查 Pull Request 的整个路径,都会影响 Token 消耗量和工作能否完成。

相同的计费模型也让购买方获得可见性。组织套餐会在整个组织范围内“汇集”AI Credits,管理员可设置预算,并在计费仪表板中跟踪使用情况。采用情况因此可以被衡量,而不会分散在个人 API 密钥和未跟踪的脚本之中。

智能体框架具有可衡量的影响

GitHub 的评估在比较 Copilot CLI 与模型供应商 harness 时,保持模型、基准任务、上下文窗口、推理强度、工具选择和 MCP 服务器不变。在 SWE-bench Verified、SWE-bench Pro、SkillsBench、TerminalBench 和 Win-Hill 测试中,Copilot 在大多数配置下以更少的 Token 达到了任务解决效果对等。对于 TerminalBench 2.0,每种智能体—模型配置均至少运行五次,以衡量成本和完成情况的方差。

阅读跨模型和任务的完整智能体 harness 评估。

原始 API 访问适用于由你拥有的系统

当你正在构建产品功能、内部智能体平台、评估 harness 或自动化流水线时,直接 API 访问是正确的基础。你可以控制提示词、检索、路由、重试、日志、安全模型和计费。

例如,考虑一个内部智能体:它读取带有标签的 Issue,检索公司文档,在另一个系统中创建变更请求,并写入完整的审计记录。该工作流需要其自身的数据边界、事件触发器和审批节点。API 为团队提供了将这些要求构建进产品的基础能力。

工程工作是真实存在的。一个生产系统需要决定检索哪些仓库文件、如何保留指令、何时重试失败的工具调用、将追踪记录存储在哪里,以及智能体可以使用哪些凭据。这些都是由开发者作出的系统设计决策,模型端点不会替你作出这些决定。

Agent SDK 位于这些层级之间,负责处理编排、工具使用、会话和流式传输,但也存在一些权衡:有些 SDK 绑定于单一供应商的 API,另一些则可跨供应商使用。GitHub 提供了这一层。Copilot SDK 暴露了驱动 Copilot CLI 的同一智能体运行时,因此你可以嵌入一个经过基准验证和生产测试的 harness,而不必自行构建。你可以通过 Copilot 订阅或自己的供应商密钥运行它。

BYOK 保留工作流,改变账单归属

Copilot 的自带密钥(Bring Your Own Key,BYOK)目前处于公开预览阶段,它允许开发者在 Copilot Chat、Copilot CLI 和 VS Code 中使用受支持供应商的模型。受支持的供应商包括 Anthropic、AWS Bedrock、Google AI Studio、Microsoft Foundry、OpenAI、兼容 OpenAI 的供应商以及 xAI。

BYOK 模型通过 GitHub 构建和维护的同一套 harness 与集成运行。你的供应商将负责 Token 账单,而 GitHub 仍继续开发工具。

无论采用哪种方式,模型访问都是一项策略决策。Copilot 支持超过 20 种模型,企业和组织管理员可为团队选择启用哪些模型,无论它们是由 GitHub 托管,还是通过 BYOK 连接。

已经拥有供应商合同或承诺云支出的团队,可以保持现有商业关系,同时让开发者在其日常工作流中使用 Copilot。Copilot CLI 还支持本地和外部 BYOK 模型,包括兼容 OpenAI 的端点、Azure OpenAI、Anthropic 以及本地 Ollama 模型。

在作出采购或架构决策前,请查阅关于在 GitHub Copilot 中使用自己的 API 密钥(企业版)以及在 Copilot CLI 中使用自己的 LLM 模型的最新文档,因为 BYOK 仍处于公开预览阶段。

选择你需要的层级

当你要构建一个需要自定义行为、集成和控制能力的系统时,应选择原始 API 访问。当工作是在团队已经编写、审查、保护和交付代码的工具与仓库中进行软件开发时,应选择 GitHub Copilot。

交付软件的工作不止是编写代码,还包括 Issue、Pull Request、审查、检查、Actions 和安全。GitHub 是团队完成这些工作的地方,Copilot 帮助他们更快地推进这些工作。

作者

Andrea 是 GitHub 的高级开发者倡导者,在开发者工具领域拥有十余年经验。她将深厚的技术能力与让先进技术更易获得的使命相结合。在从军旅和建筑管理转入软件开发后,她以独特视角连接复杂的工程概念与实际落地。她与来自威尔士的伴侣、两个儿子和两只狗居住在佛罗里达州,并持续通过 GitHub 的全球计划推动创新、支持开源。你可以通过 @acolombiadev 在线找到她。

English / 原文

I keep seeing this question: “Why would I pay for GitHub Copilot when I can call the same models through an API?”

It’s a fair question. The answer depends on what work you need to own.

Are you building a product feature with your own prompts, retrieval, routing, logs, security model, and billing controls? Or are you trying to get from a GitHub Issue to a reviewed pull request with the editor, repository, terminal, and organization policies already connected?

Cost is part of that equation. Copilot plans include a monthly allocation of GitHub AI Credits. Metered usage is calculated from input, output, and cached tokens at the listed rate for the selected model.

Raw API access and Copilot address different layers of that system. The right choice follows the work you need to own.

Now take a common maintenance task: a developer starts from a GitHub Issue, inspects the repository, changes the affected files, runs the test suite in the terminal, and opens a pull request for review. The model call is one step in that workflow. The surrounding system needs the issue, the diff, repository instructions, permitted commands, and the organization’s policies.

GitHub Copilot connects those surfaces across the editor, repository, pull request, issue, terminal, and organization controls. That is what the plan covers alongside model access. The billing change makes the split easier to see: code completions and Next Edit Suggestions remain included in paid plans, while AI Credits apply to more resource-intensive chat and agentic work.

Cost per task therefore depends on more than the listed token rate. Context selection, tool use, retries, and the path from an issue to a reviewed pull request all affect the number of tokens spent and whether the work finishes.

The same billing model gives buyers visibility. Organization plans “pool” AI Credits across the organization, and admins can set budgets and track usage in the billing dashboard. Adoption stays measurable instead of scattering across individual API keys and untracked scripts.

The harness has measurable impact

GitHub’s evaluation held the model, benchmark task, context window, reasoning effort, tool selection, and MCP servers constant while comparing Copilot CLI with model-vendor harnesses. Across SWE-bench Verified, SWE-bench Pro, SkillsBench, TerminalBench, and Win-Hill, Copilot reached task-resolution parity while using fewer tokens in most configurations. For TerminalBench 2.0, each agent-model configuration ran at least five times to measure cost and completion variance.

Read the full agentic-harness evaluation across models and tasks.

Raw API access is for systems you own

Direct API access is the right foundation when you are building a product feature, an internal agent platform, an evaluation harness, or an automation pipeline. You control the prompts, retrieval, routing, retries, logs, security model, and billing.

Consider an internal agent that reads a tagged issue, retrieves company documentation, creates a change request in a separate system, and writes a complete audit record. That workflow needs its own data boundaries, event triggers, and approval points. An API gives the team the primitives to build those requirements into the product.

The engineering work is real. A production system needs to decide which repository files to retrieve, how to preserve instructions, when to retry a failed tool call, where to store traces, and which credentials an agent can use. Those are system design decisions made by developers. A model endpoint does not make them for you.

Agent SDKs sit between these layers. Handling orchestration, tool use, sessions and streaming, with some tradeoffs: some are tied to a single provider’s API while others work across providers. GitHub ships this layer. The Copilot SDK exposes the same agent’s runtime that powers the Copilot CLI, so you can embed a benchmarked, production tested harness instead of building one. Run it with your Copilot subscription or your own provider key.

BYOK keeps the workflow and changes the bill

Bring Your Own Key for Copilot, currently in public preview, lets developers make supported provider models available in Copilot Chat, Copilot CLI, and VS Code. Supported providers include Anthropic, AWS Bedrock, Google AI Studio, Microsoft Foundry, OpenAI, OpenAI-compatible providers, and xAI.

BYOK models run through the same harness and the same integrations GitHub builds and maintains. Your provider takes over the token bill. GitHub still develops the tooling.

Model access is a policy decision either way. Copilot supports more than 20 models, and enterprise and organization admins choose which ones are enabled for their teams, whether GitHub-hosted or connected through BYOK.

A team with an existing provider contract or committed cloud spend can keep that commercial relationship while developers use Copilot in their normal workflow. Copilot CLI also supports local and external BYOK models, including OpenAI-compatible endpoints, Azure OpenAI, Anthropic, and local Ollama models.

Check the current documentation on using your own API keys with GitHub Copilot (enterprise) and using your own LLM models in Copilot CLI before making purchasing or architecture decisions because BYOK is still in public preview.

Choose the layer you need

Choose raw API access when you are building a system that requires custom behavior, integrations, and controls. Choose GitHub Copilot when the work is software development inside the tools and repositories where a team already writes, reviews, secures, and ships code.

Shipping software is the work around the code: issues, pull requests, reviews, checks, actions, and security. GitHub is where teams do that work. Copilot helps them move through it faster.

Written by

Andrea is a Senior Developer Advocate at GitHub with over a decade of experience in developer tools. She combines technical depth with a mission to make advanced technologies more accessible. After transitioning from Army service and construction management to software development, she brings a unique perspective to bridging complex engineering concepts with practical implementation. She lives in Florida with her Welsh partner, two sons, and two dogs, where she continues to drive innovation and support open source through GitHub's global initiatives. Find her online @acolombiadev.