Claude Code · Facts verified 2026-10-13

How do I reduce Claude Code token usage?

Keep each request small and cached: /clear between tasks, noisy work in subagents on a smaller model, and the same model for the whole task. /context shows what fills the window; /usage shows tokens, cost and cache hits.

terminallocal only
# In Claude Code: /context and /usage

# What every request carries
npx github:henrikdukefoss/contexttax --probe-mcp

# Last 7 days at API list prices
npx github:henrikdukefoss/tokenreceipt --since 7d

In the settings tabs, merge the keys into your existing files and adjust the deny paths to your repo.

What every request carries

Claude Code sends the whole session with every request, including each batch of tool results. The fixed parts load once per session; the conversation grows with every turn.

PartWhen it loadsExample size
System prompt and toolsEvery request4,200 tokens
CLAUDE.md, rules, @importsEvery request, read at session start2,100 tokens
Auto memory (MEMORY.md)First 200 lines or 25KB, every request680 tokens
Skill descriptionsEvery request; a full skill only when used450 tokens
MCP toolsNames only with tool search, full schemas without it120 tokens, names only
ConversationGrows every turn: prompts, replies, file reads, command output2,400 tokens for one file read
Output and thinkingBilled at the output rate, 5x input on Sonnet 5.5Depends on effort level

Example sizes from Anthropic's context-window walkthrough (code.claude.com/docs/en/context-window). Run /context for your own.

How context grows in a session

On our gateway, the 100th request of a session carried 5.4 times the input of the first. A one-line question late in a long session pays for everything before it.

Median input tokens, by request number in a session
1st request14.5K
5th19.5K
10th32.4K
20th53.8K
50th69.6K
100th78.2K
All Standard Compute gateway traffic, September 13 to October 12, 2026. A session is one key's requests with no gap longer than 10 minutes.

Method and full dataset: the Agent Burn Index

Where the tokens go, and where the money goes

Cache reads are most of the tokens and a fifth of the bill. Uncached input costs the most, so a cache miss on a long session outweighs any single file in CLAUDE.md.

Token typeShare of tokensShare of cost
Cache reads86.7%22%
Uncached input11.9%60%
Output0.5%13%
Cache writes0.8%5%

79,276 coding-agent requests on our gateway (OpenCode, Kilo, Roo, Cline and others), September 13 to October 12, 2026, priced at Claude Sonnet 5.5 list prices. Claude Code was not in the sample. With no cache hits, the same requests would have cost 5.1 times as much.

Ten levers, biggest first

Ranked by what they save a developer paying per token. Savings are our estimates from the data above and Anthropic's list prices unless marked measured.

LeverDo thisWhat it saves
1. /clear per task/clear when you switch to unrelated work. At a natural break, /compact with a focus, such as /compact Focus on code samples and API usageMeasured: the next task starts back at the first-request size in the chart above. /clear is free; /compact is one large request
2. A warm cacheChoose the model before you start, and don't connect or remove MCP servers mid-task. On an API key the cache lasts 5 minutes; set promptCacheTtl to "1h" if you take longer breaksA miss on 100K tokens costs $0.25 on Sonnet 5.5, a hit $0.01. One-hour cache writes cost $4 per million instead of $2.50
3. SubagentsAsk for test runs, log digging and wide searches in a subagent; Claude also hands searches to its built-in Explore subagentOnly a summary returns to the main conversation, so later requests don't re-send the output. The subagent's own requests still count
4. Smaller modelsSonnet for most work, Opus for the hard steps. CLAUDE_CODE_SUBAGENT_MODEL=haiku plus CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 covers every subagent, Explore included (v2.1.257+). ANTHROPIC_DEFAULT_HAIKU_MODEL sets the background modelOpus 5.5 costs twice Sonnet 5.5. On our token mix, Haiku 5.5 costs about 6% of Sonnet 5.5, or 30% once a request passes 100K tokens and Haiku's higher rates apply
5. Lower effortThe 5.5 models start at medium. Use /effort low for routine edits, xhigh and max only for hard problems. MAX_THINKING_TOKENS applies only to fixed-budget modelsThinking bills as output: $10 per million on Sonnet 5.5, 100 times the cache-read price
6. Read deny rulesRead deny rules under permissions.deny for lockfiles, build output and logs, such as Read(./dist/**). Claude Code ignores .claudeignore filesOne Read returns up to 25,000 tokens, re-sent with every later request until /clear or /compact
7. Short CLAUDE.mdUnder 200 lines. Workflows go into skills, area rules into .claude/rules files with paths: frontmatter. Mention long docs by path in backticks; @imports load at launchCutting 1,000 tokens saves 1M per 1,000 requests: $0.10 cached on Sonnet 5.5, $2 uncached. Small in dollars, real for the context window
8. Fewer MCP serversDisable the rest in /mcp, and use a CLI such as gh where one existsWithout tool search, one 18-tool server in contexttax's sample adds 2,867 tokens to every request
9. Tool searchOn by default with Anthropic's API, off when ANTHROPIC_BASE_URL points at a gateway. ENABLE_TOOL_SEARCH=true works there only if the gateway forwards tool_reference blocksThe same server drops to 181 tokens: names up front, a schema only when needed
10. Concise replies/output-style concise, or outputStyle "Concise" in settings (v2.1.237+). Replies lead with the result, without narration or recapsOur estimate: a few percent of cost in chatty sessions

Settings go in the env block of ~/.claude/settings.json or .claude/settings.json. On the 5.5 models with an API key or a Claude subscription, changing effort keeps the cache; switching models never does. Settings, commands and version numbers from Anthropic's Claude Code docs.

Already at the limit? What to do when Claude Code stops

How to check each lever worked

CheckWhat it showsLevers
/contextWhat fills the context window now, with suggestions for heavy tools and memory files1, 3, 6, 7, 8, 9
/usage, alias /costSession tokens and cost by model, plus a Prompt cache line with the share served from cache, misses and the likely cause. On Pro and Max, usage by skill, subagent and MCP server2, 3, 4, 5, 10
/tasksThe model each running subagent uses4
contexttaxTokens that CLAUDE.md, rules, skills and MCP schemas add to every request, per file, largest first7, 8, 9
tokenreceiptA week of your local Claude Code, Codex and OpenCode usage at API list prices. Run it before and afterAll

The Prompt cache line needs Claude Code v2.1.251 or later, its likely-cause text v2.1.260 (code.claude.com/docs/en/costs).

The same levers in Codex and OpenCode

Both send every enabled MCP server's full schemas with every request, so turning off unused servers saves more there than in Claude Code.

LeverCodex CLIOpenCode
Start fresh/new, or /clear to reset the screen too/new, alias /clear
Compact/compact; model_auto_compact_token_limit sets when it runs on its own/compact, alias /summarize; compaction.prune removes old tool output
Instruction filesAGENTS.md on every request; project_doc_max_bytes caps how much is readAGENTS.md, or CLAUDE.md when there is none, on every request
MCP serversenabled = false under the server's [mcp_servers] entry"enabled": false on the server
Lighter thinking or modelsmodel_reasoning_effort in config.tomlsmall_model handles light tasks such as session titles
Check/status shows the context leftcontexttax and tokenreceipt

Sources: developers.openai.com/codex (slash commands, configuration reference) and opencode.ai/docs (TUI, config, MCP servers).

The catch

On Claude Pro and Max you hit 5-hour and weekly windows instead of a bigger bill, so none of this lowers your price; it stretches the windows, which fill with the same tokens. Some levers trade quality for tokens: a smaller model or lower effort can cost a retry, and a compaction summary can drop a detail you needed. Our shares come from OpenCode, Kilo, Roo and Cline traffic, so check your own sessions with /usage.

Where Standard Compute fits

Claude Code runs on a Standard Compute key with ANTHROPIC_BASE_URL set to https://api.stdcmpt.com. Plans start at $19/month with a fixed monthly budget and no overage charges, and every lever here makes it last longer. Tool search is off through a gateway, so trim MCP servers first.

FAQ

Why is Claude Code using so many tokens?

Every request re-sends the whole session: system prompt, CLAUDE.md, tool definitions, every earlier message and every file Claude read. Across all traffic on our gateway, the 100th request of a session carried 5.4 times the input of the first.

Does /compact save tokens?

Yes, on every request after it, because the history shrinks to a summary. The compaction itself is a request that reads the whole conversation: cheap while the cache is warm, expensive after a break. If you don't need the earlier context, /clear costs nothing.

Does .claudeignore work in Claude Code?

No. Anthropic's permissions docs say a .claudeignore file has no effect. Add Read deny rules such as Read(./dist/**) under permissions.deny in .claude/settings.json. Grep already skips gitignored files; Glob does not unless you set CLAUDE_CODE_GLOB_NO_IGNORE=false.

Do @imports in CLAUDE.md reduce tokens?

No. Imported files load at launch with the CLAUDE.md that imports them, so they organize the file without making it cheaper. To keep a document out until it's needed, mention its path in backticks, move the instructions into a skill, or use a .claude/rules file with paths: frontmatter.

How do I see what is using my context?

Run /context for a breakdown of the current window and /usage, also available as /cost, for session tokens, cost and cache hits. Outside Claude Code, npx github:henrikdukefoss/contexttax measures the part every request carries: instruction files, skill descriptions and MCP schemas.

Do these tips help on Claude Pro or Max?

Yes. Subscribers hit 5-hour and weekly windows instead of a bill, and the same tokens fill them. On a subscription the main conversation's cache lasts an hour, so short breaks don't force a full re-read, but a long session still re-sends its whole history with every message.

Related money questions