Every dollar traced to whatever put the tokens in context — per tool, per shell command, per subcommand.
- Open token-billing.vercel.app.
- Drop one supported transcript folder on the page:
- Claude Code:
~/.claude/projects - CodeBuddy:
~/.codebuddy/projects - Codex:
~/.codex/sessions
- Claude Code:
- Read the bill.
No account, no upload, no install. In a hurry? Press Try an example to see a full report built from invented sessions.
The folder is hidden, so pickers won't show it until you name it:
| macOS | In the dialog press ⇧⌘G, then paste a store path |
| Windows | Type a store path into the Folder box |
| Linux | Press Ctrl+L, then type a store path |
Or open any store in your file manager and drag the folder onto the page.
Two views of the same tree. The mosaic compares amounts — column width is share of the bill. The sunburst shows how deep the money goes — one ring per drill level. Click anything to drill in; Back comes out.
The toolbar covers amounts (for screenshots), switches cache TTL, copies the chart, and changes language — English, 简体中文, 日本語, Español, Français, Deutsch.
Same engine, no browser needed to do the work. Needs Node 22.18+.
npx token-billing # all three stores found on this machine
npx token-billing ~/.codex/sessions # one store only
npx token-billing ~/.claude/projects/some-project # one project only
npx token-billing --print # print the URL instead of opening itNothing to install and no dependencies — it is one bundled file that imports only Node builtins.
It prices everything on your machine and puts the answer — not your transcripts — in the
URL's fragment, which browsers never send to a server. --print is for a machine reached over
SSH: the URL goes to stdout and the totals to stderr, so it pipes.
Your transcripts are read and priced inside the page. There is no server to send them to, and the build fails if the document references anything it does not carry inline. The hosted copy uses Vercel Analytics to track pageviews.
Want it fully offline? pnpm build writes cost-report.html — one double-clickable file that
works from disk and counts nothing.
Billing is per request, and every request bills the entire input prefix again. So a piece of content doesn't cost its face value — it costs its share of every later request it survives in. That's carry cost, and it's why a cheap-looking command that sits in context all session can outspend an expensive one that gets compacted away.
Exact billed cost comes from each request's usage field, then gets split across what was in
context by token share. Totals are exact; the per-row split is estimated.
- CodeBuddy and Codex dollar totals are public API list-price equivalents. Subscription plans, CodeBuddy credits, regional processing, and negotiated rates may differ.
- Transcripts are live files that coding agents update as sessions run or compact, so the same folder can give different totals days apart.
- Thinking is a residual —
output_tokensincludes it even when no thinking block is saved. - Unknown models are reported as unpriced, never dropped.
git clone https://github.com/HerringtonDarkholme/token-cost && cd token-cost
pnpm install
pnpm dev # the page, on http://127.0.0.1:8000
pnpm cli # the command, straight from source
pnpm check # format, lint, typecheck, both builds, all five test suitesSee CLAUDE.md for repo conventions and DESIGN_BRIEF.md for the UI constraints.
MIT