TokenMetre
A VS Code extension that turns raw Claude Code session logs into a rich, interactive token usage dashboard — live in your status bar, per question, per model, per hour, per day, and across your entire history.
Why This Exists
Claude Code stores every session as a JSONL file in ~/.claude/projects/. Those files contain precise token counts, model names, cache TTLs, and timestamps for every API call — but there's no built-in way to actually read them.
This extension parses those files and gives you:
- A live meter in the status bar for the session running in this window
- Exactly how many tokens each question cost you — and what Claude said back
- Which model answered it, at what speed and service tier, and how many times
- An estimated dollar cost using date-ranged Anthropic list pricing
- Aggregates rolled up by hour, day, month, and year across all your projects
Features
Live Status Bar Meter
The session running in the current window, updated as it happens:
⏻ $9.13 · 9.67M
Hover for turns, API calls, output and thinking tokens, and the models in play. Click to open the full report.
The meter tails the active log — each update reads only the bytes appended since the last one, so it stays responsive on multi-megabyte sessions. It appears whenever the open folder maps to a Claude Code project directory.
A tree view of every Claude Code session, organised by project, with each session's estimated cost inline.
SESSIONS
├── my-api-service
│ ├── 2026-05-29 e3f1a2b4 · $18.40
│ └── 2026-05-28 9c82d051 · $9.20
└── frontend-app
└── 2026-05-27 4b71e390 · $2.90
Click any session to open its full token report in a webview panel.
Per-Turn Session Report
Every question you asked in a session gets its own row, showing exactly what it cost — and what Claude replied.
| # |
Question |
Calls |
Input |
Cache+ |
Cache~ |
Output |
% Eff |
Cost |
| 1 |
refactor the auth middleware |
8 |
42.1K |
18.3K |
120.4K |
6.2K |
14.2% |
$0.052 |
| 2 |
add unit tests for the parser |
5 |
38.7K |
0 |
98.1K |
4.9K |
11.8% |
$0.038 |
Each row includes:
- Claude's reply, collapsed behind a
▸ Reply toggle with a one-line preview — expand to read the full answer
- A progress bar showing that turn's share of total effective input
- Model chips showing which models answered and how many times (
opus-5 ×8)
- Thinking tokens broken out under the output count
- Timestamp of when you asked the question
Token columns explained:
Input — fresh, uncached tokens sent to the model
Cache+ — tokens written to the prompt cache
Cache~ — tokens read from the prompt cache
Output — tokens generated by the model, including thinking
% Eff — this turn's share of total effective (billable) input
Usage that can't be traced back to a question — a broken parent chain, a truncated log — is shown as a separate [unattributed] row rather than silently dropped from the totals.
Hourly Breakdown
Within each session report, turns are grouped by the hour they occurred — useful for understanding how your work was spread across a long session.
| Hour |
Turns |
API Calls |
Eff. Input |
Output |
Cost |
| 2026-05-29 09:00 |
4 |
18 |
280K |
32K |
$0.18 |
| 2026-05-29 11:00 |
7 |
31 |
510K |
58K |
$0.34 |
| 2026-05-29 14:00 |
3 |
12 |
190K |
21K |
$0.12 |
Model Breakdown (Per Session)
See which models were used in a session and exactly what each cost you. Non-standard billing modes are flagged inline, since they change the rate.
| Model |
Calls |
Input |
Cache+ |
Cache~ |
Output |
Thinking |
Cost |
| claude-opus-5 |
42 |
580K |
210K |
1.4M |
98K |
38K |
$3.18 |
claude-opus-5 fast |
8 |
42K |
0 |
88K |
12K |
4K |
$0.19 |
A second panel aggregates token usage across all sessions, all projects and groups it by time period.
TOKEN USAGE
├── Daily (31)
│ ├── 2026-05-29 4 sess · 6.2M tok · $18.40 ▶
│ │ ├── opus-5 ×180 · 5.8M tok · $17.20
│ │ └── haiku-4-5 ×22 · 400K tok · $1.20
│ ├── 2026-05-28 2 sess · 3.1M tok · $9.20 ▶
│ └── ...
├── Monthly (3)
│ ├── 2026-05 18 sess · 42M tok · $124.80 ▶
│ └── ...
└── Yearly (1)
└── 2026 18 sess · 42M tok · $124.80 ▶
Each period row shows: session count · total tokens · estimated cost.
Expand any period to see the per-model breakdown directly in the tree.
Periods are bucketed by your local calendar day, and a session that runs past midnight contributes to each day it actually spans.
Period Report Webview
Click any date (daily, monthly, or yearly row) to open a dedicated report for that period — a full table of every session that falls within it.
| # |
Date |
Project / Session |
Turns |
Calls |
Tokens |
Output |
Cost |
| 1 |
2026-05-29 |
my-api-service · e3f1a2b4 |
12 |
48 |
6.2M |
520K |
$18.40 |
| 2 |
2026-05-29 |
frontend-app · 4b71e390 |
5 |
19 |
980K |
88K |
$2.90 |
Includes a model breakdown aggregated across all sessions in the period, and an Export CSV button.
Cost Estimation
Rates live in a versioned data file with effective-date ranges, so historical sessions are priced at the rates that applied when they ran. Current list prices ($ per million tokens):
| Model |
Input |
Output |
| Claude Fable 5 / Mythos 5 |
$10 |
$50 |
| Claude Opus 5 / 4.8 / 4.7 / 4.6 / 4.5 |
$5 |
$25 |
| Claude Sonnet 5 / 4.6 / 4.5 |
$3 |
$15 |
| Claude Haiku 4.5 |
$1 |
$5 |
Cache and billing-mode rates are derived from the model's input rate:
| Component |
Rate |
| Cache read |
0.1× input |
| Cache write, 5-minute TTL |
1.25× input |
| Cache write, 1-hour TTL |
2× input |
| Fast mode (Opus 5 / 4.8) |
$10 / $50 |
| Batch service tier |
0.5× |
The two cache TTLs are billed differently and are read from usage.cache_creation, not collapsed together. Unrecognised model IDs fall back to family matching and are flagged as estimated rather than presented as exact.
Costs are estimates from published API list prices. If you're on a Pro or Max subscription, your usage isn't billed this way — read the figure as "what this would have cost on the API".
CSV Export
Every report — session, period — has an Export CSV button. The exported file includes:
- Per-turn rows with timestamp, question text, Claude's reply, all token columns, thinking tokens, and cost
- An hourly breakdown section (session reports)
- A model breakdown section with per-model costs
Installation
Install TokenMetre from the VS Code Marketplace, or:
code --install-extension vidyudanulaboratories.token-metre
Settings
| Setting |
Default |
Description |
tokenMetre.statusBar.enabled |
true |
Show the live meter in the status bar |
tokenMetre.statusBar.format |
both |
What the meter displays: cost, tokens, or both |
Commands
| Command |
Description |
TokenMetre: Open Active Session Report |
Full report for this window's session |
TokenMetre: Rebuild Session Index |
Discard and rebuild the index from scratch |
Refresh Sessions |
Re-scan for new sessions and usage |
Requirements
- VS Code 1.85+
- Claude Code installed and used at least once (so
~/.claude/projects/ exists)
How It Works
Claude Code writes every session event — user messages, assistant responses, tool calls, permission prompts — as a newline-delimited JSON record to ~/.claude/projects/<encoded-path>/<session-id>.jsonl.
Each assistant record carries a usage object with token counts, cache TTL splits, thinking tokens, service tier, and speed. The extension:
- Maintains an incremental index over
~/.claude/projects/, keyed by file mtime and byte offset
- Re-reads only what has been appended since the last scan — unchanged files are skipped entirely
- Identifies real human turns (filtering out tool results and meta expansions)
- Walks each assistant entry's
parentUuid chain to find its originating human turn
- Deduplicates usage by
message.id, since one response is written across several lines that repeat identical usage
- Collects reply text from every one of those lines, so answers survive the deduplication
- Buckets usage by local day and by (model, speed, service tier) — the three things that change the rate
Because the index stores tokens and applies cost at read time, updating the rate data never requires reindexing. Session logs only grow, so after the first build a rescan typically reads zero bytes.
Development
npm install
npm run compile # or: npm run watch
npm test # node:test suite over the parser, index, and pricing engine
Press F5 in VS Code to launch an Extension Development Host with the extension active.
To build a .vsix:
npx @vscode/vsce package
License
MIT — see LICENSE.