See how much your Claude Code or Codex CLI sessions are actually costing you.
Find sessions where the cache expired and got expensively re-written from scratch.
Spot oversized contexts and retry loops that are wasting tokens.
Get a recommendation on when to use a cheaper model instead of a premium one.
| d-date/retok | adityasharmadotai-hash/docs-reader-rag-agent | alekseiul/hermes-researcher-agent | |
|---|---|---|---|
| Stars | 29 | 29 | 29 |
| Language | Python | Python | Python |
| Setup difficulty | easy | easy | moderate |
| Complexity | 1/5 | 2/5 | 2/5 |
| Audience | developer | vibe coder | researcher |
Figures from each repo's GitHub metadata at analysis time.
Zero dependencies, just Python 3.7+ and a clone or a single downloaded script.
retok is a command line tool that reads the local log files created by AI coding agents, specifically Claude Code and OpenAI Codex CLI, and turns them into a report on how efficiently tokens are being spent. It scans the transcript files these agents already save on your machine, so it works entirely offline against data you already have rather than calling any external service. The report it prints covers estimated dollar cost, a breakdown between the two agents, the cache hit rate, cost per prompt, and the peak context size reached in a session. Beyond the raw numbers, it prints specific recommendations tied to patterns it detects, such as a large cache write happening right after a session sat idle past its cache expiry window, sessions that grew past 120,000 tokens without ever being cleared, heavy use of file reading tools on the main thread instead of delegating to subagents, the same command being retried five or more times, a high rate of interrupted prompts, and small one off questions being sent to expensive top tier models when a cheaper model would do. Cost estimates are built from a table of published per model pricing for both Claude and OpenAI Codex models, with separate multipliers for cached reads and for cache writes under the five minute and one hour cache windows. The tool notes that these numbers are estimates based on API list pricing, so if someone is on a flat rate subscription plan the numbers should be read as how much compute was used rather than money actually spent. retok runs on Python 3.7 or newer with no external dependencies, and it supports report output in several languages beyond English. It is aimed at developers who use Claude Code or Codex CLI regularly and want a clear, local view of where their token budget is going.
A local command line report card for your Claude Code and Codex CLI usage, showing token cost and where you are wasting tokens.
Mainly Python. The stack also includes Python.
MIT license: free to use, modify, and distribute for any purpose, including commercial use, as long as the copyright notice is kept.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.