Settings

Theme

Show HN: Toktrack – Track your Claude Code token spending in under a second

github.com

2 points by mag123c 2 months ago · 3 comments

Reader

mag123cOP 2 months ago

Hi HN, I built toktrack because I was spending a lot on Claude Code and had no easy way to track it.

My session files were ~3GB (2,000+ files). I first tried a Node.js approach but it took 40+ seconds – sequential JSON.parse, GC overhead, and libuv thread pool limits made it hard to optimize further.

Rewrote it in Rust with simd-json (SIMD-accelerated parsing) + rayon (parallel file processing). Cold start: ~1s, warm: ~0.04s.

Also supports Codex CLI and Gemini CLI.

Install: npx toktrack

  • mag123cOP 2 months ago

    Tip: Claude Code deletes session files after 30 days by default. To keep your data with ~/.claude/settings.json { "cleanupPeriodDays": 9999999999 }

    toktrack caches cost data independently either way, so past history is preserved regardless.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection