I've been using Claude Code heavily and kept wondering how much I'm actually spending. There's no built-in way to see total token usage or cost history.
So I built OSS toktrack.

It scans your Claude Code session files and shows you a TUI dashboard with cost breakdowns.
What it shows
- Total tokens and estimated cost
- Per-model breakdown (Opus, Sonnet, Haiku)
- Daily / weekly / monthly trends
- 52-week cost heatmap
Install
npx toktrack
Also supports Codex CLI and Gemini CLI.
- Cold start (3.4GB): ~1s
- Warm start (cached): ~0.04s
Built with Rust + simd-json + rayon.
Tip
Claude Code deletes session files after 30 days by default. toktrack caches your cost data independently, so history is preserved.
If you want to keep the raw session files too
// ~/.claude/settings.json
{ "cleanupPeriodDays": 9999999999 }
Free and open source (MIT).