Counting tokens from coding agent transcripts is easy to get wrong
Nitjsefnie · reddit · 2026-11-07
A developer building claudit, a self-hosted MIT-licensed usage dashboard for Claude Code, Codex and Kimi CLI, catalogs the traps in token accounting:
- Claude Code logs one streamed reply multiple times (same requestId) — keep only the largest record per request.
- Subagent transcripts are separate files repeating parent records; dedupe by uuid across files.
- Codex rollouts carry cumulative counters — difference them, and dedupe resumed/forked rollouts.
- Cache write pricing: 5m writes cost 1.25x input, 1h writes 2x; 65% of the author's cache-write tokens (5,000 sessions) were 1h-tier, so pricing all at 1.25x undercounts by 37.5%.
- Pruned transcripts: Claude Code deletes old local logs — ingest from a bucket (R2 or a kept directory) so totals only grow.
Panels include cost by model, cache-tier token breakdown, latency, tool error rate, heatmap, and per-session context growth. Stack: FastAPI, Postgres, no-build React; boots via docker compose up.
More from coding & agent
- CodeRabbit podcast: ship less, not more, in the AI era — nutlope · 2026-11-07
- 16 MCP servers, 35 parallel agents — and it still ships slop — weswinder · 2026-11-07
- Creator apps like Instagram Edits and Roblox Studio are shipping with built-in MCPs for agents — trq212 · 2026-11-07
- Cartesian agent builds a 289-part Dymaxion car 3D model live, researching the design online — carlosbannon · 2026-11-07
- ArkenOS visualizes hundreds of autonomous agents collaborating as a 3D research swarm — _AustinCalvert_ · 2026-11-07
- AI agents blocked by Zillow, Indeed, Reddit — a scraping API got 3/3 through in testing — eyishazyer · 2026-11-07