1. Clear and compact the context between tasks
Claude Code sends the whole conversation again on every turn. The prompt cache makes the repeat cheaper, not free, so a session that drifts across three tasks pays for all three on every prompt. Run /clear when you switch tasks, and /compact to summarize a long session you want to continue; you can tell it what to keep, as in /compact keep the failing test and the plan. CLAUDE.md is sent with every request too, so keep it to the rules Claude Code cannot work out from the code. /context shows what fills the window, including the tools of connected MCP servers; turn off the ones you do not use with /mcp.
2. Match the model to the task
Opus costs more per token than Sonnet, and Sonnet more than Haiku. Switch with /model: Opus for planning and hard bugs, Sonnet for routine edits. Sub-agents that only search, read, or summarize rarely need more than Haiku; set model: haiku in the agent's file under .claude/agents/. Model price and token count multiply, so this stacks with every other lever here.
3. 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. The Extra Headroom app runs it on macOS, Windows, and Linux with no Python or pip.
4. 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. Quiet flags such as pytest -q and cargo test -q, summary-only test reporters, and keeping generated files out of the working tree all shrink it. A line in CLAUDE.md asking Claude Code to pipe long output through tail or grep works too. Headroom compresses what still gets through.
5. 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. Serena gives Claude Code symbol lookups and targeted reads instead of whole files. Graphify builds a queryable graph of the project, 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.
6. 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.
7. 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 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 Extra Headroom app also turns on Serena, MarkItDown, Ponytail, and Caveman as one-click add-ons, so you do not have to install and update each tool yourself. The best Claude Code token-saving tools list compares each tool's price, license and what it cuts.