Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Copilot Cost ExplorerNew to Visual Studio Code? Get it now.
Copilot Cost Explorer

Copilot Cost Explorer

Fran Martínez

|
1 install
| (1) | Free
Track, visualize and centralize your GitHub Copilot usage costs.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copilot Cost Explorer

Version License VS Code

🔎 Know what every Copilot turn costs — the moment it happens, right inside your editor.

Copilot Cost Explorer turns the usage data VS Code already keeps into a live view of your AI spend: a status-bar meter, budget guardrails, and a multi-tab analytics dashboard. There is nothing to sign into and no API key to paste.

⚠️ One VS Code setting is required. It takes under 30 seconds — see Before you start.


Contents

  • Why use it
  • What you get
  • In pictures
  • Before you start
  • What's reported, and how to turn it off
  • Getting it installed
  • First run
  • The settings you'll actually touch
  • Command palette
  • The interface, piece by piece
  • When something looks off
  • Deeper: pricing and every setting
  • Under the hood
  • Hacking on it
  • Contributing
  • License

Why use it

Copilot bills in credits, but the meter is easy to lose track of while you code. This extension keeps that number in front of you — per session, per billing period, per model, and per project — so a surprising invoice never happens. Everything is computed locally from telemetry Copilot Chat writes to disk; the extension simply reads, prices, and visualizes it.


What you get

Always-on cost signal

  • A status-bar meter showing this session's delta (+2.3 cr) and your running period total (42.5 cr), refreshed as you work.
  • Colour shifts and one-time notifications as you approach and cross budget thresholds (75% / 90% / 100% by default).
  • Live context-weight readout, with escalating warnings at 20K, 40K, and 80K tokens.

A sidebar you can glance at

  • Budget bar with percentage used and the next reset date.
  • A 14-day credit sparkline plus today / this-week totals and a projected pace.
  • Breakdowns by model and by workspace, and a list of your most recent sessions.

A full analytics dashboard (5 tabs)

  • Overview — hero cards for today and the period, an A–F Efficiency Grade with gauge, the signature Context Tax view, a plain-English Cost Story, and productivity figures (cost per turn, cost per active hour).
  • Activity — a heatmap, workspace filter, recent-session table, and a Turn Explorer that drills into per-turn LLM calls, tool calls, and cache hit rates.
  • Models — accurate per-model splits across multi-model sessions, with credits/turn, token mix, cache %, and average / P90 latency.
  • Efficiency — an optimization score, cache and context metrics, scatter and growth charts, and a savings playbook.
  • Budget — a gauge, pacing status, and a forecast timeline.

Every tab reacts instantly to a shared date filter (Today, 7d, 30d, this period, or a custom range) — no reloads.

Accuracy and resilience

  • Built-in rates for the June 2026 GA line-up from OpenAI, Anthropic, Google, and GitHub, plus your own custom rates for anything unlisted.
  • Reads agent-traces.db directly and falls back to JSONL debug logs automatically.
  • Correct billing-period math for any cycle start day, including short months.
  • A persisted watermark means restarts resume cleanly with no double-counting; the in-memory database is flushed to disk every 60 seconds.
  • Theme-aware charts that follow your light/dark VS Code theme.

Smart nudges

  • Pattern detection for micro-turn bloat, raw-paste turns, premium-model misallocation, and runaway agent context.

In pictures

Live meter in the status bar — session delta and period total, updated as you type.

Live cost indicator in status bar

The overview sidebar — budget bar, sparkline, today/week, pace, and model/workspace splits.

Cost overview sidebar

The dashboard — Efficiency Grade and Context Tax up front, with Activity, Models, Efficiency, and Budget alongside.

Analytics dashboard


Before you start

Copilot Chat needs to be told to write its usage telemetry to disk, which is what this extension reads. The extension tries to flip this switch for you on activation; if your settings policy blocks that, add it yourself:

"github.copilot.chat.otel.dbSpanExporter.enabled": true

That is the only prerequisite — no external services, accounts, or tokens. (Optionally, JSONL fallback logs can be enabled if the database is ever unavailable.)


What's reported, and how to turn it off

This build is packaged for organization distribution: it ships plug-and-play, with central cost reporting enabled by default and pre-pointed at your organization's backend (see server/) so admins can view spend per user and per project with zero setup from end users. No key, account, or sign-in is required.

Everything is still computed locally first — Copilot Chat's on-disk telemetry is read, priced, and stored in a local SQLite file — and only aggregated metrics are ever sent onward.

The knobs (all under copilotCostExplorer.telemetry.*)

Setting Role
enabled Master on/off (default true). Set to false to stop all reporting.
backendUrl Endpoint that receives batches. Pre-filled with the org default; change it to retarget. HTTP is accepted for LAN backends.
licenseKey Optional. When set, sent as a Bearer token for per-user attribution; when empty, reporting is anonymous.
userLabel Optional display label (e.g. work email).

When active, each reported turn carries only: a timestamp, the model name, the surface (e.g. panel), the project label (Org/Repo), token counts, cost/credits, and an anonymous machine id. Never the prompt, completion, code, file paths, or chat titles. Transport is over HTTPS or HTTP (HTTP is allowed for internal/corporate-LAN backends). A one-time transparency notice appears the first time it activates, and setting telemetry.enabled to false stops it immediately. Local pricing can still make one optional outbound call — downloading a remote pricing table — but only if you set copilotCostExplorer.pricingUrl.


Getting it installed

From the Marketplace

  1. Open Extensions (Ctrl+Shift+X).
  2. Search for Copilot Cost Explorer.
  3. Hit Install.

From a .vsix

code --install-extension copilot-cost-explorer-1.0.0.vsix

From source

git clone https://github.com/fran-martinez/copilot-cost-explorer.git
cd copilot-cost-explorer
npm install
npm run package
code --install-extension copilot-cost-explorer-1.0.0.vsix

First run

  1. Confirm the telemetry switch. The extension usually sets it for you; if data never shows up, add "github.copilot.chat.otel.dbSpanExporter.enabled": true to your settings.json and restart VS Code.
  2. Open the panel. Click the Copilot Cost Explorer icon in the Activity Bar.
  3. Just use Copilot. Credits start appearing live in the status bar at the bottom.

The settings you'll actually touch

Defaults are sensible; most people change nothing. The common knobs:

Setting Type Default Effect
budgetCredits number 180 Monthly credit budget behind the alerts and progress bar. 0 disables budget tracking.
billingCycleStartDay number 1 Day of the month your billing resets (1–31).
budgetWarningThresholds array [75, 90, 100] Percentages that trigger notifications.
currency string "USD" Currency code shown in the UI.
showStatusBar boolean true Whether the status-bar meter appears.
contextWeightNotifications boolean true Heavy-context warnings at 20K/40K/80K tokens.
microTurnGapSeconds number 120 Max gap between turns for micro-turn detection.
microTurnMinCount number 5 Rapid consecutive turns needed to flag Micro-Turn Bloat.
rawPasteMinInputTokens number 15000 Uncached tokens in one turn that flag a Raw Paste.
premiumMisallocationMinCredits number 2 Credit floor for the Premium Model Misallocation flag.
agentSprawlMinInputTokens number 80000 Input tokens that flag a Massive Context Turn.

The full list lives in Deeper: pricing and every setting.


Command palette

Under the Copilot Cost Explorer category (Ctrl+Shift+P):

Command What it does
Copilot Cost Explorer: Refresh Cost Data Runs a full ingest, refreshes pricing, and repaints the UI.
Copilot Cost Explorer: Open Dashboard Opens the dashboard webview in a side panel.
Copilot Cost Explorer: Scan All Workspaces Ingests everything available, ignoring the watermark.
Copilot Cost Explorer: Scan Full History Backfills from timestamp 0 — your entire available history.

The interface, piece by piece

Status bar

$(credit-card) +$0.42 | $4.25 | $(brain) 35K
  • +$0.42 — spent this session (since activation).
  • $4.25 — total for the current billing period.
  • $(brain) 35K — the active chat's context weight in tokens.
  • The colour tracks budget and pace (amber as you near it, red once over). Click it for a quick menu: period summary, context, top models, dashboard, refresh, and settings.

Sidebar

  • Budget bar with percent used and reset date.
  • 14-day credit sparkline.
  • Today / this-week totals and projected pace.
  • Model and workspace breakdowns.
  • Recent sessions with cost, model, and turn counts.

Dashboard — the five tabs described in What you get, all bound to the shared date filter. The Turn Explorer on the Activity tab adds Expand all / Collapse all, an only rows with tools filter, an only anomalies filter (cache hit < 40% or tool use), and a last-active timestamp per turn. Open it with Copilot Cost Explorer: Open Dashboard or the graph icon in the sidebar.


When something looks off

Nothing shows up / the sidebar is blank

  1. Make sure the required setting from Before you start is on.
  2. Restart VS Code.
  3. Set logLevel to "info" and read the Copilot Cost Explorer output channel.
  4. Run Copilot Cost Explorer: Scan Full History to force a backfill.

A model's cost seems wrong

  • Supply rates via copilotCostExplorer.customModelRates.
  • Unknown models fall back to GPT-5.4-tier pricing; the logs note when this happens.

The billing period starts on the wrong day

  • Match billingCycleStartDay to your GitHub cycle (GitHub → Settings → Billing and plans).
  • With startDay=31 in a shorter month, it correctly clamps to that month's last day.

The extension won't activate

  • It needs VS Code ^1.85.0.
  • It loads a few seconds after startup, not instantly.
  • Check the Developer Console (Help → Toggle Developer Tools) for errors.

Deeper: pricing and every setting

All copilotCostExplorer.* options, grouped

  • Billing — billingCycleStartDay, budgetCredits, budgetWarningThresholds
  • Pricing — customModelRates, excludedModels, pricingUrl
  • Data — telemetrySource, pollIntervalMin, pollIntervalMax, initialScanDays
  • Display — currency, exchangeRate, showStatusBar
  • Diagnostics — logLevel

Open VS Code Settings and type copilotCostExplorer. to browse them all.

Built-in rates (June 2026) Shipped for OpenAI, Anthropic, Google, and GitHub:

  • OpenAI — GPT-5.5, GPT-5.4, GPT-5-mini, and more
  • Anthropic — Claude Opus / Sonnet / Haiku, with cache support
  • Google — Gemini models
  • GitHub — Copilot fine-tuned models

Add your own for anything not listed:

"copilotCostExplorer.customModelRates": {
  "my-model": { "input": 150, "output": 600 }
}

Under the hood

Key building blocks:

  • sql.js — an in-memory SQLite database, so there's no external runtime dependency.
  • VS Code API — settings, status bar, webview, and output channel.
  • Svelte — the reactive, component-based dashboard webview.
  • Chart.js — the dashboard's visualizations.
  • Event-driven file watching — debounced monitoring for a responsive UI.
  • Context tracking — live per-session context-weight monitoring with tiered alerts.

The pipeline runs: VS Code's internal telemetry → traces database → cost calculation → in-memory DB → UI. For specifics, read the sources in src/ and the tests in test/.


Hacking on it

Set up

git clone https://github.com/fran-martinez/copilot-cost-explorer.git
cd copilot-cost-explorer
npm install
npm run watch          # rebuild on change
code .

Press F5 to open an Extension Development Host.

Build, package, test

npm run build          # dev build with source maps
npm run package        # produce the .vsix
npm test               # unit tests (vitest)
npm run test:watch     # watch mode
npm run deploy:local   # build and install into your local VS Code

Layout

src/
  extension.ts         # entry point; wires the modules together
  config.ts            # settings
  billing.ts           # billing-period math
  database/            # in-memory SQL store
  parser/              # trace parsing
  pricing/             # cost engine
  watcher/             # polling & ingestion
  views/               # status bar, sidebar, dashboard host
    helpers/
  webview/             # Svelte dashboard
    components/
      charts/          # Chart.js wrappers
      shared/          # reusable UI (StatCard, BudgetBar, DataTable, …)
      tabs/            # Overview, Activity, Models, Efficiency, Budget
    stores/            # Svelte stores
    utils/             # formatting, palette, aggregation
    types.ts
test/                  # vitest suites

Contributing

PRs are welcome. Before you open one:

  1. Match the existing style and run npm run lint.
  2. Cover new behavior with tests.
  3. Update the docs when behavior changes.
  4. Reference the relevant issue in your commits.

License

Released under the MIT License — see LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft