Skip to content

[Bug]: GitHub Copilot (ACP) cost and tokens never show: no context meter, missing from Usage → Cost/Tokens #47107

Not planned

Description

@nulam

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Related but separate: #22862 and #31627 are about Copilot plan quota (Usage → Limits). This issue is about Copilot cost and tokens (Usage → Cost/Tokens, and the thread context meter).

Area

apps/server

Steps to reproduce

  1. Enable GitHub Copilot under Settings → Providers (ACP Registry, agentId: github-copilot-cli).
  2. Run a few turns in a Copilot thread.
  3. Look at the thread's context meter, then open Usage → Cost and Usage → Tokens.

Expected behavior

Copilot threads show a context meter, and Copilot appears on the Usage page with its tokens and its billed cost. Copilot now bills in AI credits, so this is the only way to track Copilot spend in T3.

Actual behavior

  • No context meter on Copilot threads. Copilot CLI never sends ACP usage_update, so no Copilot provider turn gets tokenUsage. Locally, 0 of 73 Copilot turns have it, against 337 of 520 turns from other providers.
  • Copilot is missing from Usage → Cost/Tokens. BUILT_IN_USAGE_DRIVERS has no Copilot reader. It covers Claude, Codex, Grok, Pi, OpenCode, Muse, Antigravity and Cursor.
  • ACP cost is never shown. For any agent that does report cost through usage_update, the client maps it (cost: contextUsage.cost), but no component renders it.

Proposed fix

The data is already on disk. For every model call, Copilot CLI writes a session.usage_record to ~/.copilot/session-state/<sessionId>/events.jsonl. <sessionId> is the same ACP session ID that T3 keeps in nativeTurnRef.

{"type":"session.usage_record","timestamp":"…","data":{"usage":{
  "accounting":{"sourceSessionId":"<sessionId>","usageId":"msg_…"},
  "model":"claude-opus-5.5",
  "copilotUsage":{"totalNanoAiu":4110200000,"tokenDetails":[…]},
  "inputTokens":90652,"outputTokens":1027,"cacheReadTokens":90145,"cacheWriteTokens":505,
  "reasoningTokens":0,"maxPromptTokens":200000}}}

session.shutdown also carries a per-session accountingSnapshot (totalNanoAiu, per-model metrics).

totalNanoAiu / 1e9 is AI credits, and 1 credit is $0.01. Copilot's per-token rates match list prices exactly. For example, Opus 5.5 output is 2e12 nano-AIU per 1M tokens = $20/M, and input is 4e11 = $4/M.

  1. Usage page: add a Copilot transcript reader that scans ~/.copilot/session-state/*/events.jsonl for session.usage_record events. It should:

    • deduplicate by accounting.usageId;
    • map the token counts to totals;
    • set reportedCostUsd = totalNanoAiu / 1e11, so the Cost view shows what Copilot actually billed.

    Showing the AI-credit figure as well would help, because GitHub's own UI uses that unit.

  2. Thread meter: render contextUsage.cost when present. Any ACP agent that reports cost would benefit.

  3. Optional: while Copilot CLI doesn't send usage_update, fill the live meter from the same records (inputTokens / maxPromptTokens of the latest one).

Impact

Minor bug or occasional failure

Version or commit

T3 Code (Beta) 0.1.11, Copilot CLI 1.0.114

Environment

macOS (Darwin 25.5, Apple Silicon), desktop app

Activity

  1. juliusmarminge commented on Dec 1, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions