Tokenmetry · Opinionated Usage Stats

Open it and know
what your AI coding costs

Reads the local logs of Claude Code, Codex, ZCode and 19 agents total — read-only, incrementally indexed into SQLite, rolled up into a fixed set of views chosen for you. Local-first, reconcilable.

19agent sources, read-only 9fixed views ±0.00cost reconciliation drift

Windows · macOS · Linux · AGPL-3.0

Tokenmetry overview: KPI cards for total tokens, estimated cost, sessions and cache-read share; a daily token trend; agent and token-type donuts
§01 · Why

Your numbers are scattered — until they land in one table

01

Every agent keeps its own log

JSONL here, session snapshots there, SQLite elsewhere. Mixed together, you honestly cannot say what today cost.

Read-only access to 19 sources, auto-detected with zero config. No external processes spawned.

19 formats → 1 ledger
02

Existing CLIs rescan everything

ccusage cold-starts take tens of seconds — a coffee-break to check today’s spend.

Files are tracked by mtime/size; only changes get re-scanned, landing incrementally in local SQLite. Opens with numbers ready.

full rescan → incremental
03

Black-box costs you can’t trust

An estimate is an estimate — folding unpriced models into totals as zero is the real problem.

Missing prices show “unknown” — never zeroed into totals. costUSD from logs is used as-is.

unknown ≠ 0
§02 · Trust anchor

Every cost number survives an audit

$101.3856438

Measured on real data (local Codex: 19 files / 2,931 records) — cent-exact against ccusage over the full period.

vs npx ccusage@20.0.29 · day × model reconciliation

All five token components match exactly

  • input Input
  • output Output
  • cache_creation Cache write
  • cache_read Cache read
  • total Total

Reconciliation tests parse only the golden JSON committed to the repo — repeatable offline.

The pipeline JSONL / SQLite read → unified usage records → own pricing engine → UTC day buckets
§03 · View tour

The views are chosen for you

A fixed information architecture — no plugins, no layout customization. Overview, sessions, agents, models, projects, time, cost, data & pricing, settings, with time-range and four-dimension filters running through every view.

02/09
Sessions

Every session, by name

Tokenmetry sessions view: a table of agent, model, project, tokens and cost per session, with search and filters

Sessions: agent, dominant model, project, start/end, tokens and cost — row by row, with search, filters, sorting and paging. Unpriced sessions show “unknown”, honestly.

07/09
Cost analysis

The math is on the record

Tokenmetry cost analysis: cost KPIs, daily trend and composition

Cost analysis: daily cost trend, model composition and period-over-period deltas, plus the three-line methodology — costUSD as-is, unknown never zeroed, reconcilable.

04/09 Models

Which model eats the budget

Models: provider, associated agents, token and cost shares in one table. Unpriced models carry an “unknown” mark — honesty over cosmetics.

Tokenmetry models view: models, providers, associated agents and cost shares
06/09 Time analysis

Your peak hours

Time analysis: hourly distribution (sources without minute-level precision count as unknown — no fabricated shape), weekday spread, activity calendar and time KPIs.

Tokenmetry time analysis: time KPIs, hourly distribution, weekday spread and activity calendar
05/09 Projects

Which project burns cash

Projects: share, sessions, averages — click through to that project’s sessions.

Tokenmetry projects view: shares and session rankings
03/09 Agents

Every agent, one leaderboard

Agents: top KPIs and a ranked table — click through to that agent’s sessions.

Tokenmetry agents view: top KPIs and agent rankings
08/09
Data & pricing

Data & pricing: three-tier fallback

Tokenmetry data & pricing view: source status table (ok/partial/no data/not scanned) and the model price catalog

Your overrides → models.dev refresh (background, never blocks the UI) → bundled price snapshot. Source status, record counts and the model catalog on one page.

Plus 09 Settings — theme, language, sources and price overrides all in plain sight.

§04 · Always on

Lives in your tray, flags anomalies first

No need to open the main window: today’s tokens, estimated cost, cache-hit rate and live rate at a glance; abnormal spend gets a badge.

  • Today tokens, estimated cost, cache-hit rate
  • Live rate tracking and an anomaly badge
  • One click jump to overview; update check in the tray menu
Tokenmetry tray popover: today’s tokens, estimated cost and cache-hit KPIs, input/output/cache mix and top agents
§05 · Coverage

19 agent sources, read-only

All read-only access (streamed JSONL/JSON parsing or SQLite read-only connections), auto-detected with zero config, overridable via environment variables.

  • streamed parsing
  • SQLite read-only
  • proprietary formats
  • Claude Code JSONL
  • Codex CLI JSONL
  • ZCode SQLite
  • DSH zstd session logs
  • GitHub Copilot CLI events.jsonl + otel
  • OpenCode SQLite
  • Gemini CLI JSON / JSONL
  • Qwen Code JSONL
  • Goose SQLite
  • Grok updates.jsonl
  • Kimi Code JSONL
  • Amp thread JSON
  • Droid (Factory) snapshot JSON
  • Hermes SQLite
  • Kilo SQLite
  • Codebuff chat-messages JSON
  • pi-agent session dirs
  • OpenClaw SQLite + dual format
  • Antigravity SQLite multi-root
  • 19 sources · read-only
§06 · Stance

Data stays on your machine — complete offline

  • Local-first No upload, no login, no cloud sync.
  • Offline-first pricing Network refresh is a background enhancement; it never blocks the UI.
  • Fixed information architecture Views chosen for you — no plugins, no layout customization.
  • Restrained data expression Trends, composition, anomalies — three expressions are enough.

Where data lands

Windows %LOCALAPPDATA%\Tokenmetry\
macOS / Linux user data directory

SQLite stores only aggregated facts and settings — never prompts, code or conversation content.

To be honest: the only two network touchpoints are the models.dev background refresh and the in-app update check.

§07 · Get it

Open source, auditable, runs now

AGPL-3.0-or-later (brand name and logo not covered). The source is the product — clone and run.

Platform packages are built by tag-triggered CI; before the first public release, please run from source. Prerequisites: .NET 10 SDK and local logs from any supported agent.

Run from source (primary today)

  git clone https://github.com/cholf5/tokenmetry.git
  cd tokenmetry
  dotnet run --project src/Tokenmetry.App