Show HN: CodeBurn – Analyze Claude Code token usage by task
TL;DR Highlight
One npx command breaks down AI coding spend by project, model, and task type
Who Should Read
Developer who sees the monthly Claude Code, Cursor, or Codex bill but can't tell where the tokens are going
Core Mechanics
- It just reads session files to split costs
- Claude Code, Codex, Cursor and others write session files with every token and model call to disk.
- CodeBurn reads them and builds cost tables by tool, model, project, and task.
- No account, API key, or proxy; your prompts and code stay on your machine.
- You see which kind of work ate the money
- Tasks are categories like coding, debugging, and planning, worked out from the session itself.
- Sessions are summed per git branch, so you can see the cost of one feature.
- Click into a session to see which turns were expensive.
- codeburn optimize hunts for waste
- It flags files re-read every turn, MCP servers installed but never called, and a CLAUDE.md long enough to ride along in every request.
- Each finding comes with a grade, a fix, and expected savings.
- Apply with --apply and roll back with codeburn act undo --last.
- It also tracks plan limits and spending caps
- codeburn plan set shows how much of your subscription you've used this cycle.
- codeburn quota shows percent used and reset time for the 5-hour and weekly windows.
- codeburn guard install adds Claude Code hooks that warn at $5 and stop at $15 per session (both adjustable).
- Compare models on your own history
- codeburn compare puts two models side by side on one-shot rate, retry rate, cost per call, and cache hit rate.
- If a cheaper model's one-shot rate held up, optimize recommends it as the project's default.
- Ask your agent via an MCP server
- Register with claude mcp add codeburn -- npx -y codeburn mcp.
- You can ask "where did my tokens go this week" mid-conversation.
- It makes no network calls of its own, and project names are pseudonymized unless requested.
Community Reactions
- Half of one user's spend was chat
- One user installed it and saw "Conversation $225 / 496 turns", meaning half their monthly turns were chat rather than building.
- The same user said a 98.2% cache hit rate on Opus 4.6 seems to be the difference between a $2k month and something much worse.
- No-tool turns at 56% are exploration and planning, per commenters
- One comment says the 56% no-tool turns are Claude thinking out loud, managing context, and planning before editing.
- Another cites SWE-bench trajectory studies where about 38% of agent actions are exploration and suggests separating exploration turns from thinking turns.
- Activity classification may be inaccurate
- One user writes plans before every coding session yet saw only 1 planning turn in 30 days.
- Limits and requests
- One user wants per-session cost for 4 parallel running sessions.
- One user said it doesn't seem to work with Cursor Agent, and another asked about Windows support.
How to Apply
- Skim the last 30 days with npx codeburn
- Run npx codeburn in a terminal and check cost tables by tool, model, project, and task.
- Use arrow keys to change the period and p to switch tools, then find your five most expensive sessions.
- Audit waste with codeburn optimize
- Run codeburn optimize and read the Fix now items and the Potential savings line.
- Review the change, then run codeburn optimize --apply.
- A few days later run codeburn act report to check whether the savings were real.
- Set a session cost cap with codeburn guard install
- Run codeburn guard install in the environment where you run long Claude Code jobs.
- Change the $5 warn and $15 stop defaults to match your budget.
- Verify model changes with compare
- Note the date range before changing a model, prompt, or workflow.
- Afterwards use Compare periods or codeburn compare to confirm cost and one-shot rate improved.
Try It
# Paste into your terminal (requires Node.js 22.13+)
npx codeburn
# Waste audit
npx codeburn optimize
# Cost per session
npx codeburn sessions
# Compare models on your own history
npx codeburn compare
# Install spending-cap hooks for Claude Code (warn $5, stop $15)
npx codeburn guard install
# Register the MCP server so you can ask from inside Claude Code
claude mcp add codeburn -- npx -y codeburn mcpTerminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls