Tokey
See what each Claude Code prompt costs while it runs
A terminal panel that shows the tokens and cost of each Claude Code prompt while the work is still running.
How I built it
Tokey is written in Python. It finds the active Claude Code session from its newest transcript file and re-reads that file on every refresh. It parses each turn's token counts and prices them per model, so the cost of a prompt climbs while the response streams. Older transcripts fill in the history on a background thread, so the panel never waits on them. I wrote it test-first, specifying each parser state and pricing rule before the code.
Outcome
You can stop a runaway agent loop mid-flight, before it reaches your invoice. Tokey is open source, with 350+ tests covering the parsing and pricing logic.
Built with
Python, Rich, pytest