Why Claude Code Sessions Get Expensive (And How to Find the Leaks)
I spent $14,502 on Claude Code in a single month before I finally sat down and figured out where it was all going. I'm 16. That's real money. And the worst part? Most of it was avoidable.
After parsing thousands of my own session JSONL files, I found 8 recurring patterns that explain almost all runaway Claude Code bills. None of them are obvious. None of them show up in the Anthropic dashboard. And most of them can be fixed in under 15 minutes once you know they exist.
This is what I found.
TL;DR: Run npx getburnd to scan your own sessions. It's free, open-source, reads local files only, and shows you exactly which of these 8 patterns are costing you money — with dollar values.
How Claude Code billing actually works
Claude Code bills per token — input tokens and output tokens — using the pricing of whatever model you're running (Sonnet, Opus, Haiku). Every message you send, every file Claude reads, every tool result that comes back, every line of code in the response: all tokens.
The key thing most people miss: context is re-sent on every turn. If you have a 50,000-token conversation context and ask one follow-up question, that's 50,000 input tokens just to give Claude the context for a 20-word answer.
This is why long sessions get expensive fast. And it's why anything that inflates the context window — bash output, repeated file reads, error storms — has a compounding effect on your bill.
Claude does have a prompt cache that can dramatically reduce input costs when the same prefix is reused. But the cache only persists for a few minutes, and several common patterns bust it entirely — including one that surprises almost everyone.
The 8 patterns that drain your budget
-
1
Long bash output flooding the context
Running
npm test,cargo build, or any command that dumps thousands of lines into the terminal. Claude reads all of it. A test suite with 200 failed tests can dump 50,000+ tokens in one shot. The fix is simple: pipe totail -50orgrep -E "error|fail".Typical cost: $3–15 per affected session -
2
Reading the same file 3+ times in one session
Claude forgets. It reads a file, gets distracted by a tool call chain, then reads the same file again 10 turns later. If that file is 500 lines, you're paying for it multiple times. Add
Do not re-read files you've already read in this sessionto your CLAUDE.md.Typical cost: $2–8 per affected session -
3
Tool error storms — retrying failed commands
When a bash command fails, Claude sometimes retries it 5–10 times with slight variations. Each retry is a full round-trip: the previous output stays in context, the new attempt goes in, the error comes back. You're paying for every single failed attempt.
Typical cost: $2–10 per affected session -
4
Tool overuse — Bash doing 80%+ of all tool calls
Claude Code has dedicated tools for reading files, searching code, listing directories. When everything goes through Bash (
cat file.ts,ls -la,grep -r), you get worse results AND more tokens. The dedicated tools are more efficient and give structured output.Typical cost: $5–15/month in accumulated waste -
5
Late-night sessions costing 2.5x more
This one surprised me. Sessions started between midnight and 5am consistently run more expensive — not because of rate differences, but because tired prompting leads to vague tasks, more back-and-forth, more thrashing. The same feature takes 2–3x more turns at 2am than it does the next morning.
Typical cost: 2–3x multiplier on session cost -
6
Switching models mid-session kills the cache
This is the one that surprises everyone. Claude Code has a prompt cache that stores your context prefix to avoid re-billing input tokens. When you switch from Opus to Sonnet (or vice versa) mid-session, the cache is invalidated. Claude has to re-read your entire context from scratch. Sometimes switching to a "cheaper" model makes the session cost more overall.
Typical cost: $5–30 in a single switch event -
7
Skills / agents firing on everything
If you have a skill or sub-agent with a broad trigger condition, it can activate on nearly every message and add significant overhead. One skill consuming 40%+ of all tool calls is a clear signal it's over-triggering. Tighten the trigger conditions in the skill's SKILL.md.
Typical cost: 20–40% of total session cost -
8
One project costing 3x more per session than everything else
Most developers have one project that runs disproportionately expensive. Usually it's a project with a large codebase, a noisy test suite, or a pattern of long exploratory sessions. If you can identify it, you can fix it specifically rather than optimizing everything blindly.
Typical cost: $20–50/month concentrated in one project
How to find which ones are affecting you
Claude Code stores every session as a JSONL file at ~/.claude/projects/*/. Each file is a complete record of every message, every tool call, every input and output token count. The data is all there — it's just not surfaced anywhere.
I built Burnd to parse these files and run all 8 detectors automatically. It takes about 30 seconds, runs entirely on your machine, and produces a ranked list of which leaks are costing you money with exact dollar estimates.
$ npx getburnd
burnd — find what's burning a hole in your AI coding budget
─────────────────────────────────────────────────────────────
Scanned: 227 session files across 227 sessions
30-day spend: $14,502.00
Last 7 days: $843.27
Potential savings: $75.92 ← plug these leaks
Top leaks (sorted by estimated savings):
1. Project "ChangeLife" costs 3.2x more per session
$30.48 (~15 min to fix)
2. Bash accounts for 80% of tool calls
$7.76 (~8 min to fix)
3. Tool error storm — 30% of calls failed
$3.95 (~10 min to fix)
Every leak comes with a dollar estimate and a concrete fix step. The CLAUDE.md patches can be applied in one click if you run npx getburnd serve and use the local dashboard.
The quick wins (fix these first)
If you want to reduce your Claude Code bill this week without installing anything, start with these:
Add this to your CLAUDE.md:
# Cost control - Pipe noisy commands: use `npm test 2>&1 | tail -50` not bare `npm test` - Never re-read a file you've already read in this session - Use Read tool for files, Grep for search — not `cat` and `grep` via Bash - If a command fails twice, stop and tell me — don't retry indefinitely - Keep model consistent for the whole session (don't switch mid-task)
These five rules, added to your CLAUDE.md right now, will likely reduce your per-session cost by 20–40% on the next session.
Free · open source · reads local files only · no signup · no cloud
Why I built this
I'm Garvit Surana. I'm 16, in Class 12 in Guwahati, India. I've been using Claude Code since it launched and I spent $14,502 on it before I had any real visibility into what was happening. The cost showed up in my billing dashboard as a big number with no breakdown.
None of these 8 patterns are documented anywhere. I found them by parsing thousands of JSONL files, looking for correlations between session structure and cost. The model-switching cache invalidation in particular took me a while to confirm — it's not mentioned in Anthropic's documentation but it's real and expensive.
Burnd is the tool I wish had existed when I started. It's free, it runs locally, and it shows you your actual numbers not estimates.