I Built an OpenSource - Ultra fast AI CLI token tracker : toktrack

4 7
calendar_todayschedule1 min read

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.

Performance

  • 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).

2 Comments

1 vote
0
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

Your AI Doesn't Just Write Tests. It Runs Them Too.

Kevin Martinez - May 12

Everyone says DeepSeek is cheaper, but I got tired of guessing the exact math. So I built a calculat

abarth23 - Apr 27

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19
chevron_left
144 Points11 Badges
2Posts
2Comments
Junior Software Engineer In South Korea. Interested in OSS culture, Contribution.

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!