GitHub Copilot 用量指标 API 新增 totals_by_client:统计 OpenCode 等外部工具
Copilot 用量指标 API 增加 totals_by_client,按客户端汇总请求、会话与 Token,补上 IDE 外工具(如 OpenCode、Claude Code、Codex)此前缺失的模型流量;变更加性兼容,面向企业/组织报表。
GitHub 为 Copilot 用量指标 API 增加 totals_by_client 数组,企业、组织及其用户维度的 1 日与 28 日报表均可使用。每个条目对应一个客户端,包含 client(如 opencode、claude_code、codex、zed、copilot_cli 等,无法识别则归 other)、request_count、session_count、token_usage,以及按模型拆分的 totals_by_model(并带 model_selection_mode:user_selected / auto / product_selected)。
动机很直接:越来越多开发者把 Copilot 当作 IDE 之外工具的模型后端,这些工具往往不发编辑器遥测,旧的 totals_by_ide 会漏计。改为在服务端按模型请求计数后,治理与采购可以比较各工具的请求量与 Token。官方同时提醒:它统计的是模型流量,不同于统计「智能体应用启动任务数」的 agent app 活动;request_count 计的是成功模型调用而非提示词次数;客户端标识基于集成 ID,只宜作尽力分组。
权限上面向企业所有者、账单管理员、组织所有者,以及具备 View Copilot Metrics 的自定义角色,且需启用用量指标策略。字段为加性变更,旧字段不变。若你负责 Copilot 账单或合规,值得重新核对「请求究竟来自哪些客户端」的假设,尤其是 OpenCode 一类外部工具已经进入报表之后;据此调整许可证座位、允许清单与成本分摊会更贴近真实用法。
Copilot usage metrics API totals_by_client
GitHub shipped a change to the Copilot usage metrics API on 23 October 2026 that closes a reporting gap worth knowing about if you run Copilot across a team.
The API now reports model usage from tools like OpenCode that weren't previously captured in your reports.
The mechanism is a new totals_by_client array, available in enterprise, organization, enterprise-user, and organization-user reports, in both 1-day and 28-day versions. Each entry covers one client: the tool that sent the requests (opencode, claude_code, codex, zed, copilot_cli and others; unrecognized clients group under other), plus request_count, session_count, token_usage, and a totals_by_model breakdown. That model breakdown includes a model_selection_mode showing whether the model was user_selected, auto, or product_selected.
Why the gap existed: per GitHub, more developers now use Copilot as the model provider behind tools outside the IDE, and those tools often don't send editor telemetry, so their usage was missing from totals_by_client's predecessor totals_by_ide and hard to account for. Counting requests on the server is their fix, so you can compare request and token volume across tools. Per the changelog, totals_by_client measures model traffic (requests and tokens), which is different from agent app activity that counts jobs started by agent apps.
Three caveats from the changelog. One: request_count counts successful model calls, not prompts, and one prompt can trigger several model calls, so don't compare it with prompt counts. Two: client is a best-effort grouping based on integration IDs, not a verified identity. Three: Copilot code review models report as unknown.
Access goes to enterprise owners and billing managers, org owners, and custom roles with the View Copilot Metrics permission, with the usage metrics policy enabled. The change is additive; existing fields are unchanged.
If you own Copilot billing or governance, does your current tooling assumption about where model requests come from still hold once OpenCode-style clients show up in your totals?