← all repositories
yakuikai/tokentab

Your AI CLI habit, itemized like a phone bill

tokentab tallies token spend from Claude Code, Codex and Gemini CLI logs that are already sitting on your disk — no API key, no account, no data leaving your machine.

tokentab
Collecting fresh signals — velocity needs a few days of history.
collecting data…
star history

What it does

It parses the session logs that Claude Code, Codex and Gemini CLI write anyway (~/.claude/projects, ~/.codex/sessions, ~/.gemini/tmp) and turns them into token and cost breakdowns by model, project, day, and activity. Output comes as terminal tables, JSON, or a localhost web dashboard that reads like a monthly statement. If a tool isn’t installed, it’s simply skipped.

The interesting bit

The pricing is a hand-kept table in tokentab/pricing/prices.py rather than a network lookup — a slightly stale number beats a crash when a vendor renames a model overnight, and matching is fuzzy so dated model IDs still resolve. It also handles the cache-accounting wrinkle: Claude splits cache reads/writes separately while Gemini reports input including cached tokens, so tokentab pulls those back out before pricing to avoid double-charging you.

Key highlights

  • Runs fully offline — the dashboard doesn’t even fetch fonts from a CDN, and the web server is Python’s stdlib http.server, not Flask.
  • Token counts come straight from the logs, not estimated; unmatched models show $0.00 with a warning instead of being silently counted as free.
  • Activity classification (coding / debugging / refactor / testing) is deterministic keyword matching — fast, no model calls, and honest about being a hint.
  • Adding a new tool is one module with a collect() function returning UsageRecords; everything downstream just works.
  • The only third-party dependency is rich for terminal tables.

Caveats

  • Cursor support is a stub — wired into the provider list but not finished.
  • Prices are best-effort and manually maintained; stale entries are on you (or a one-line PR) to fix.
  • The README contains a typo’d command (cli.pyb) in the examples, which hints at the polish level.

Verdict

If you use one or more of these CLI agents and have ever wondered what they actually cost you per project or per day, this is a cheap, private way to find out. If you want live vendor pricing or Cursor stats, wait — or send a PR.

Frequently asked

What is yakuikai/tokentab?
tokentab tallies token spend from Claude Code, Codex and Gemini CLI logs that are already sitting on your disk — no API key, no account, no data leaving your machine.
Is tokentab open source?
Yes — yakuikai/tokentab is open source, released under the MIT license.
What language is tokentab written in?
yakuikai/tokentab is primarily written in Python.
How popular is tokentab?
yakuikai/tokentab has 601 stars on GitHub.
Where can I find tokentab?
yakuikai/tokentab is on GitHub at https://github.com/yakuikai/tokentab.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.