DEV Community

Zayd Mulani
Zayd Mulani

Posted on

I built a local token cost tracker for Claude Code in Rust

After one too many surprise Claude Code bills, I built agentwatch.
It's a local HTTP proxy written in Rust. Point your agent at localhost:7878, and it intercepts every request, parses the token usage, and shows a live Ratatui TUI dashboard of what you're spending — in real time.
Everything stays local. SQLite database, zero signup, single binary via cargo install agentwatch.
Supports Claude Code, Codex, and Gemini CLI.
github.com/zaydmulani09/agentwatch

Top comments (1)

Collapse
 
alexshev profile image
Alex Shev

Local cost visibility is one of those tools that feels small until you lose it.

Model spend is easy to ignore when it is hidden behind sessions, retries, and long context rebuilds. A local tracker gives developers a feedback loop while the behavior is still fresh: which tasks were expensive, which loops got stuck, and which habits quietly burn tokens.

That is more useful than only seeing the bill later.