CoreCodeDocs

Get the most from CoreCode

Spending less on Claude Code

Last updated: October 30, 2026

Spending tens of dollars a day on Claude Code is common. Most of it does not go on writing code but on the context resent every turn. This page shows where the money goes, then ways to spend less without losing quality. Caching in detail is in Caching and billing.

Key points
  • Most of the bill is the context resent every turn, the input side, not the output.
  • At Anthropic's prices, a cache read on Opus 5.5 and Sonnet 5.5 is 0.05 times the input price (0.1 on Haiku 5.5), a 5-minute cache write 1.25 times and a 1-hour cache write 2 times.
  • Use Sonnet for everyday work and Opus for hard problems, and pick the model at the start of a task.
  • /clear when you change tasks, /compact long sessions in time, and keep CLAUDE.md and MCP lean.
  • Auto mode's classifier request before each tool call barely hits the cache and can take a large share of the spend.

Where the money goes

Every turn, Claude Code resends the system prompt, tool definitions, the files it has read and the whole conversation. A session that has been going a while sends tens of thousands to hundreds of thousands of tokens per turn and gets back a few hundred to a few thousand. So:

Spending less comes down to three things: the right model, a cache that keeps hitting, and a context that does not grow for nothing.

1. Pick the right model

  1. Use Sonnet for everyday work. Fixing bugs, writing tests and docs, building a clearly specified feature: Sonnet is enough, at far less than Opus. Switch with /model, or start with claude --model claude-sonnet-5-5.
  2. Save Opus for hard problems. Architecture, refactors across many files, and problems Sonnet keeps getting wrong are worth Opus.
  3. Choose the model when a session starts. The cache is per model, so switching mid-session rewrites the whole context at the write price on the next turn. Switch at the start of a task, or /compact right after switching.

Unit prices are in the pricing table, and what each model suits is in Choosing a model.

2. Keep the cache hitting

  1. Finish a task in one session. Do not switch models or thinking effort, or connect and disconnect MCP servers, midway; each of these invalidates the cache.
  2. Turn on the 1-hour cache if you pause often. The default cache lasts five minutes, so the first turn after a meeting rewrites everything. Add "CLAUDE_CODE_PROMPT_CACHE_TTL": "1h" to env in settings.json; see the 1-hour cache.
  3. Pick a relay with session stickiness. If one session's requests hop between upstream accounts, the cache misses nearly every turn and the bill can multiply. CoreCode pins each session ID to one account; for other relays, the cache check in the checking script shows it.

3. Keep the context lean

  1. /clear when you change tasks. The last task's files and conversation are no use to the next one, yet they are sent every turn.
  2. /compact long sessions in time. The first turn after compacting rewrites the cache; every turn after it is cheaper. Do not start a new session and lay out the context again to feel fresh; that costs more than compacting.
  3. Consider turning off the 1M context. Add "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" to env. The limit becomes 200K, auto-compaction starts sooner, and each turn sends less.
  4. Trim CLAUDE.md and MCP. CLAUDE.md is sent every turn; state the rules, do not paste whole documents. Disconnect MCP servers you do not use, and keep the default MCP tool search on (do not set ENABLE_TOOL_SEARCH=false).

Do the sums on auto mode

Auto permission mode has to judge whether each action may run. CoreCode passes Claude Code's server-side review through, so normally there are no extra requests. If you set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS, though, Claude Code sends a separate classifier request before every tool call instead: these barely hit the cache, in a real case they were a third of the requests and 60% of the spend, and on CoreCode they run on your session's model. CoreCode does not need that variable; remove it. From Claude Code v2.1.283 new sessions start in auto; when you do not need it to run unattended, press Shift+Tab to switch to Manual or "accept edits" mode. The full analysis is in The cost of auto mode.

Check where the money went

Anthropic's own Claude Code costs guide lists more ways to manage spend. If the logs still do not explain it, send us the times of those requests and we can look up the upstream account and routing.

FAQ

Why does Claude Code use so many tokens?

Every turn it resends the system prompt, tool definitions, the files it has read and the whole conversation. The longer the session, the more each turn sends; on a cache hit that part costs 5% of the input price on Opus 5.5 and Sonnet 5.5.

How do I see what a session cost?

Type /usage (or /cost) in Claude Code, and /context for what fills the context; the console's usage logs list the usage and cost of every request.

Is the 1-hour cache always cheaper?

No. A 1-hour cache write costs 1.6 times a 5-minute one (2 against 1.25). It pays off only if you often pause for more than five minutes; with few pauses it costs more.

I only use Opus, so why is there Haiku or Sonnet on my bill?

Background summaries, subagents and auto mode's classifier use other models; see other models on the bill.