Privacy-first analytics pixel
Headroom logo Headroom

How to reduce Claude Code costs

Most of the tokens in a Claude Code session are machine-generated context rather than your prompts: files it reads, terminal output, logs, and history sent again on every turn. On a Pro or Max plan those tokens drain your 5-hour and weekly windows; on the API they are the bill. Five levers cut them, roughly in order of effect.

1. Compress the context before the model sees it

The largest share of spend is bulky, repetitive context: build logs, test output, JSON fixtures, and file content carried from turn to turn. Headroom sits between Claude Code and the API and compresses that content locally before forwarding it: about 50% fewer tokens on the noisy items it compresses, typically 25-50% across a session. The compression is reversible, so the model can pull back the original whenever it needs the detail. It works alongside Anthropic's prompt cache rather than against it: a smaller conversation prefix is cheaper to carry whether or not it is cached.

2. Make terminal output quieter

Every command Claude Code runs sends its full output back to the model, and a failing build can add thousands of lines that every later turn carries. RTK rewrites common commands into token-lean equivalents, so Claude Code reads a summary of git status or a test run instead of the raw dump. Quieter test reporters and keeping generated files out of the working tree help the same way.

3. Stop re-reading the repository and documents

Exploring a codebase by grepping and opening files pulls in far more than the answer needs, and sub-agents each pay for their own copy. Graphify builds a queryable graph of the project so Claude Code can look things up instead of reading files whole, and Engram keeps useful context across sessions, including through compaction. For PDFs and Office files, MarkItDown converts them to plain Markdown before Claude Code reads them.

4. Make the agent write less

Output tokens count too, and on the API they are priced several times higher than input. Ponytail is a plugin that pushes Claude Code toward the smallest change that solves the problem, which means shorter diffs and less to review. Caveman shortens its prose replies. Both work on the response side, which the tools above leave alone.

5. Watch the windows instead of upgrading

Before moving up a plan, check where the tokens went. The Claude Code usage limits guide explains the 5-hour and weekly windows, and why Claude Code is so expensive covers the patterns that drain them. If you pay per token on the API, reducing Claude API costs adds caching, model choice, and batching.

What to expect

Short, focused prompts will not get much cheaper. Noisy work will: debugging from logs, shell-heavy tasks, and codebase exploration are where these tools remove the most. Headroom alone typically removes 25-50% of a session's tokens, so noise-heavy work can stretch the same plan up to twice as far; the other tools add to it on the sources they target. The benchmarks show savings by workload type. Judge them on a real task you already do rather than a toy prompt, and compare the token count before and after. Fewer tokens per task also means less electricity per task; see how Headroom makes AI coding more sustainable.

The Headroom app runs Headroom for you and turns on RTK, MarkItDown, Ponytail, and Caveman as one-click add-ons, so you do not have to install and update each tool yourself.

Try it on a real workflow

Download the app, run a Claude Code task you already do every day, and compare the token count before and after.

Download for free

7-day free trial · no credit card required

Not ready to install yet?

Leave your email and we'll send a one-page summary of the benchmarks, plus a note when big updates ship. No drip campaign.