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

●4 ●7
calendar_today • schedule1 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).

Want more #ai & #rust deep dives?

Join 6,173+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

2 Comments

1 vote
0

More Posts

Your AI Agent Doesn't Need Your Token: Edera's Ariadne Conill on Object Capabilities

Tom Smithverified - Nov 5

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

Dharanidharan - Feb 9

Stop Turning Every REST Endpoint into an MCP Tool: A Better Approach to AI Tool Design

zeekwrites - Nov 30

Dozens of email accounts: learning AI coding tools as a student

rahuldk1105 - Oct 27

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

Ken W. Algerverified - Jun 4
chevron_left
144 Points • 11 Badges
2Posts
2Comments
Junior Software Engineer In South Korea. Interested in OSS culture, Contribution.

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!