If you've spent a week with Claude Code, you've noticed the bills. A single refactor session can burn $1–2 without feeling like much work at all. This guide explains why it happens and what you can do about it.
Why Claude API costs compound
Claude's API is stateless. Every tool call — reading a file, editing a line, running a grep — fires a separate HTTP request. And every request includes your entire conversation history to give Claude context.
Here's the problem: that history grows with every call. By the time you're on call #8, you're re-sending the same context eight times, each copy slightly larger than the last.
On a typical 3-file refactor, Claude issues roughly 12 tool calls:
Read("auth.ts")Read("types.ts")Read("routes.ts")Edit("auth.ts")Edit("types.ts")Edit("routes.ts")Read("auth.ts")— verify the editRead("types.ts")— verifyRead("routes.ts")— verifyGrep("loginFn")— check referencesRead("auth.ts")— fix somethingEdit("auth.ts")— final fix
Each of those 12 calls re-sends your growing context window. Token costs don't add — they multiply.
What doesn't fix it
Context filtering (tools like context-mode) helps Claude skip irrelevant files, but each file access still fires its own API call. You reduce context size, not call count.
Smarter prompts help on individual calls but can't collapse multiple tool invocations into one.
Longer context windows make things worse — a larger context means each extra call costs more.
The real fix: batch operations
The structural solution is to batch multiple tool operations into a single MCP call. Instead of Read() → Edit() → Read() (verify), you issue one call that does all three server-side.
brozi_smart_search reads multiple files in one call. Pass an array of glob patterns — ["src/**/*.ts", "lib/utils.ts#10-60"] — and get back file contents, AST summaries, or grep matches. One round-trip instead of ten.
brozi_batch_edit applies multiple file edits in a single call. Describe all your changes in JSON, the tool applies them with fuzzy matching, runs optional TypeScript validation, and returns the result. One call instead of six.
Real numbers
| | Without BroziCode | With BroziCode | |---|---|---| | API round-trips | 12 | 2 | | Tokens sent | ~85k | ~12k | | Estimated cost | $0.47 | $0.07 |
The savings scale with session length. The longer your session, the heavier the history, and the more each extra call costs.
Installation
BroziCode is a free, open-source Claude Code plugin. Install it inside a Claude Code session:
/plugin marketplace add broziden/brozicodes-claude
/plugin install brozicode@brozicode-marketplace
Then add to your CLAUDE.md:
## File operations
- ALWAYS use `brozi_smart_search` to find / read files
- ALWAYS use `brozi_batch_edit` for all file writes and edits
Ready to cut your Claude bill?
Install BroziCode in 2 minutes — free, open source, MIT licensed.