TokenLens Live CoachTokenLens Live Coach shows a live estimated dollar cost, token usage, and real model for GitHub Copilot Chat directly inside VS Code — always visible in the status bar and broken down per session — automatically, with no SDK, no code changes, no account/API setup, and no configuration needed. It also surfaces evidence-based token-optimization suggestions, a reactive budget alert, and static diagnostics on your source files to flag token-wasteful AI request patterns as you type. How it works — and an important trade-off to know aboutVS Code extensions can't observe another extension's (e.g. Copilot Chat's) network requests directly — that's blocked by design for security. We first tried Copilot Chat's official OpenTelemetry export mechanism, but as of Copilot Chat 0.67.0 it only reports a small internal "utility" call (used for things like chat-title generation) — never your real per-message model, tokens, or cost. That made it useless for this extension's purpose. Instead, this extension reads VS Code's own local Copilot Chat session transcripts — the same files that power the Chat panel's history — stored per-workspace at:
These files contain the real model used per turn (e.g. Trade-off to be upfront about: this file format is an undocumented internal VS Code implementation detail, not a public API. It has already changed between versions we observed (field names/shape) and could change again in a future VS Code release without notice, which could break this extension until it's updated. This is a deliberate trade-off in exchange for real data, made after confirming Copilot Chat's officially documented telemetry mechanism doesn't currently expose what we need. A second, newer data source: agent-mode sessionsSome Copilot Chat conversations — particularly "Agent mode" turns — are instead handled by a newer agent-host engine that persists its own session logs at:
alongside a small This is an even less documented, still-evolving mechanism than the Chat panel's own storage above — treat it as at least as likely to change. Because it's a general-purpose local agent engine (not exclusive to VS Code's Chat panel), any tool built on it — including this very AI assistant, if you're using one right now — will show up as a session here too. That's intentional: it represents real usage against your account either way, not a bug. Estimated costThe status bar (always visible at the bottom while a workspace is open) and every session in the Recent sessions sidebar list show an estimated USD cost — not a guess from a hardcoded pricing table, but computed from real local numbers using GitHub's own officially documented conversion:
So both data sources share one conversion, applied in No setup requiredUnlike the OpenTelemetry approach, there is no setting to enable, no prompt to accept, and no integrated-terminal environment variable to inject — both mechanisms above are already written by default. Install the extension, use Copilot Chat (in any mode), and data appears. Multiple windows and workspacesBoth data sources are inherently scoped per-workspace — the Chat panel's Copilot CLIWe investigated whether a similar local file exists for the standalone GitHub Copilot CLI tool (run outside VS Code, as its own terminal application) and did not find one accessible in the same way; that specific standalone-CLI usage is not currently tracked by this extension. (Note this is distinct from the "agent-host" mechanism above, which does track certain in-VS-Code agent-mode conversations.) Privacy
Token-optimization suggestionsThe Suggestions group in the TokenLens sidebar surfaces up to a handful of deterministic, evidence-based recommendations computed directly from your own real local usage data — no guessed pricing, no external catalog, no reading of prompt/response content. Each one cites the exact numbers that triggered it. Current rules:
These recompute on every poll, so they reflect your current session history as it grows. For a
plain-language walkthrough of exactly how each rule works and why (no LLM involved — it's a small,
deterministic, local rule engine), see Each suggestion's full evidence and suggested action can be hard to read from a hover tooltip alone (tooltips disappear if your mouse moves off the small tree row). To make sure the full text is always reachable: click a suggestion to open it in a modal dialog that stays open until you dismiss it (with a "Copy to clipboard" option), or click the expand arrow next to it to reveal the evidence and suggested action as their own rows directly in the tree. Budget alert (not a circuit breaker)We originally set out to build a circuit breaker — something that could stop an over-budget Copilot request before it goes out. After investigating, that isn't possible: VS Code extensions have no API to intercept or block another extension's (Copilot Chat's) outgoing network requests. What this extension does instead is a reactive budget alert: once today's usage in this workspace crosses a threshold you configure, it shows a one-time-per-day warning notification (and the status bar turns amber) — after the fact, not before. It's a genuinely useful early-warning signal, just not a hard stop, and we'd rather be precise about that than overclaim. Configure thresholds with TokenLens: Configure Budget Threshold, or directly via settings — see
Getting started
Commands
Advanced configuration
|