Tokenmeter

Know what every prompt costs you in Claude Code, Codex and Copilot.

A free dashboard on localhost, built from the logs your coding agents already keep. Nothing leaves your machine.

$ brew install serkankorkut/tap/tokenmeter && tokenmeter --open

Paste that in a terminal. Your dashboard opens at http://127.0.0.1:7788. Other ways to install

The Tokenmeter dashboard: subscription spend, token totals, cache hit rate, and a sortable table of prompts with cached, fresh and output token columns and cost
Updates a few seconds after every prompt finishes.

What does Tokenmeter do?

It reads the logs your agents already keep.

Claude Code, Codex and Copilot CLI save every reply to disk with its token counts. Tokenmeter indexes them in about a second and follows along live.

No hooks, no proxy, no wrapper around your agent. Uninstall it and nothing about your setup changes.

$ tokenmeter --open
indexed 6,152 turns from 132 logs in 1.5s
serving http://127.0.0.1:7788

claude code  ~/.claude/projects
codex        ~/.codex/sessions
copilot cli  ~/.copilot/session-store.db

It prices every prompt, and shows its work.

Tokens are priced up to 200 times apart. A cached read is almost free; re-writing the cache is not. So a plain token count says little about what you paid.

Tokenmeter splits every number into cached, fresh and output, and prints the arithmetic under each prompt.

fix the flaky auth test        7 turns · 42s

  cached  3.88M × $0.25 /M  =  $0.97
  fresh   0.61M × $20   /M  = $12.28
  output  12.7K × $50   /M  =  $0.63
  ──────────────────────────────────
  total                   $13.88
  on claude-fable-5-1

It finds the cache misses that quietly cost the most.

When a long conversation loses its cache, the whole context is sent again at full price. One miss can cost more than an hour of normal work.

Tokenmeter flags every miss, the prompt that was running, and what it cost, so you can see the pattern and avoid it.

Cache misses  last 30 days

Sep 18 16:52  lost 3.2M  rewrote 614K  $12.28
Sep 18 11:04  lost 2.9M  rewrote 587K  $11.73
Sep 21 16:28  lost 3.0M  rewrote 600K  $12.00

62 misses · $329 spent re-writing cache

It watches your limits and your plan.

Codex 5-hour and weekly windows, rolling usage for every tool, and a context gauge for each live session so you see compaction coming.

On a subscription you see what you actually pay first, and the API-equivalent value below it. Set a budget and get a desktop alert when you cross it.

Codex 5-hour  █████████████░░░  81%
             resets in 1.4h
Codex weekly  ████░░░░░░░░░░░░  24%
Context       ██████░░░░░░░░░░  35%
             351K of 1M tokens

Spend  plan $120  API-equivalent $819

It never phones home.

The server listens on your machine only. No telemetry, no account, no update check. Your prompts stay where your agents wrote them.

Teams can opt in to share totals with one shared dashboard. Prompt text is stripped before anything leaves a laptop.

$ lsof -iTCP -sTCP:LISTEN | grep 7788
Python  76453  you  TCP 127.0.0.1:7788 (LISTEN)

$ tokenmeter --version
tokenmeter 0.2.2

Every prompt, sortable

Text, turns, tokens by type, cost, duration, and a command to resume the session.

Cost per commit

Turns matched to the next git commit in each repo. What did that change cost to build?

By model and project

See which model, repo and session your budget goes to.

Team mode

Aggregates from every laptop in one dashboard, filtered by person.

CSV and JSON

Export any range, or read the local API from your own scripts.

Zero dependencies

Python standard library and one HTML file. Light and dark, phone to desktop.

Works where you work.

macOS with Homebrew, Windows and Linux with pipx or uv. Python 3.9 or newer.