Token CoachA VS Code extension that reads GitHub Copilot's local debug logs, analyzes token usage and cost, and coaches you toward cheaper usage patterns. It is strictly read-only — it never modifies Copilot or sends anything over the network. It only reads the JSONL debug logs Copilot already writes to disk.
Why cost, not tokens?The real cost metric is So this tool surfaces:
Features
1. Enable Copilot debug loggingThe extension can only show data if Copilot is writing logs. In VS Code settings
(
Copilot then writes logs to:
Works on any computer — no path configuration needed. The extension finds
this folder automatically: it derives it from VS Code's own storage location
(
2. Build
Use 3. Run in the Extension Development Host
4. Package to a
|
| Setting | Default | Meaning |
|---|---|---|
tokenCoach.costWarnThreshold |
3000000000 |
Flag cost (NanoAiu) above this (= 3 AIU). |
tokenCoach.inputWarnThreshold |
50000 |
Flag inputTokens above this. |
tokenCoach.lowCacheRateThreshold |
0.5 |
Cache hit rate below this is "low". |
tokenCoach.lowCacheMinInputTokens |
20000 |
Minimum input before the low-cache rule fires. |
tokenCoach.ioRatioThreshold |
1000 |
Flag inputTokens/outputTokens above this. |
tokenCoach.ioMinInputTokens |
10000 |
Minimum input before the tiny-output rule fires, so small side-calls aren't mislabelled "huge input". |
tokenCoach.attachmentShareWarn |
0.4 |
Flag a message when open/attached files exceed this share of its logged context. |
tokenCoach.slowToolWarnMs |
10000 |
Flag a message when one tool consumes more than this many ms (summed across calls). |
tokenCoach.usdPerAiu |
0.01 |
US dollars per 1 AIU (1 AI credit = $0.01, 1 AIU ≈ 1 credit). Set 0 to hide dollar figures. |
tokenCoach.planMonthlyUsd |
19 |
Your monthly plan price (Business = $19, Enterprise/Pro+ = $39) for the budget gauge. |
tokenCoach.notifyOnExpensiveRequest |
true |
Notify when a new request exceeds the cost threshold. |
tokenCoach.pollIntervalSeconds |
20 |
Backup poll interval; 0 disables polling. |
tokenCoach.workspaceStoragePathOverride |
"" |
Optional explicit workspaceStorage path (testing / non-standard installs). |
Cost in dollars (credits)
As of June 1, 2026, GitHub Copilot moved to usage-based billing: 1 GitHub AI
credit = $0.01, and each plan includes a monthly dollar allowance of credits
(Business = $19, Enterprise / Pro+ = $39). Empirically, 1 AIU ≈ 1 AI
credit ≈ $0.01 — e.g. a 0.66 AIU Haiku request (mostly cached input) works out
to ≈ $0.0065 at real model rates, matching 0.66 × $0.01.
So the dashboard shows:
- Dollar figures next to AIU on each message and in the summary cards.
- A "Plan budget · this month" gauge: this calendar month's estimated spend vs your plan's allowance (the status bar tooltip shows the same).
Both the rate (usdPerAiu) and plan price (planMonthlyUsd) are settings, so you
can recalibrate. These are estimates for coaching, not a billing statement —
your GitHub billing page is the source of truth. The estimate can differ from
GitHub's % because (a) the real monthly allowance may include a flex amount on
top of the plan price, and (b) some base-model usage isn't charged against
credits. To match GitHub exactly: set planMonthlyUsd to your real monthly
allowance, or scale usdPerAiu by (GitHub's % ÷ the % shown here) — e.g. if
GitHub says 82% and the card shows 91%, set usdPerAiu to 0.01 × 82/91 ≈ 0.009
(or planMonthlyUsd to 19 × 91/82 ≈ 21).
Sources: GitHub Copilot is moving to usage-based billing · Models and pricing for GitHub Copilot · Plans for GitHub Copilot
Coaching rules
| Rule | Condition | Advice |
|---|---|---|
| Expensive request | cost > costWarnThreshold |
Split the task into smaller, focused steps. |
| Cold start (info) | first message of a chat with low aggregate cache | None needed — the cache is cold on the first message; staying in the chat reuses it next turn. |
| Low cache hit | a later message (not the first) with large input and cacheHitRate < lowCacheRateThreshold |
The chat likely outgrew the cache window or its context changed; for a new task, a fresh focused chat can be cheaper. |
| Large input | inputTokens > inputWarnThreshold |
Close irrelevant files/tabs to shrink context. |
| Tiny output | inputTokens > ioMinInputTokens and inputTokens / outputTokens > ioRatioThreshold |
Reconsider whether agent mode / full context was needed. |
| Heavy attachments | attachments > attachmentShareWarn of logged context |
Close unused editors/tabs — open files are bloating context. |
| Slow tool | one tool's total time > slowToolWarnMs |
Heavy tool use lengthens turns and grows context. |
Project structure
token-coach/
├── package.json # manifest: commands, settings, activation
├── tsconfig.json
├── src/
│ ├── extension.ts # activate/deactivate, status bar, watcher, commands
│ ├── logParser.ts # find + parse jsonl
│ ├── coach.ts # rules engine
│ └── dashboard.ts # webview HTML + update logic
└── README.md
Acceptance test
With Copilot debug logging enabled, use Copilot Chat a few times, then open the dashboard. It should list real requests with cost and cache hit rate, and highlight any expensive ones.
License
MIT — see LICENSE.