Claude Code is brilliant and, on Anthropic’s native rates, it can get expensive — not because the tool costs much, but because agent workflows burn tokens. It resends context, reads files, and works through multi-step tasks, and tokens are what you pay for. The good news: every part of that cost is reducible, and the biggest lever is a one-line change.
This explains where the cost comes from and the practical ways to cut it, in order of impact.
Where the cost actually goes
Claude Code’s bill is token consumption: input tokens (your prompts plus the context and files it loads) and output tokens (what the model writes). Agent loops multiply both — each step resends context and reads results. A busy session can run to hundreds of thousands of tokens, which is why the bill climbs.
Lever 1 (biggest): switch the backend model
The single largest saving is pointing Claude Code at a cheaper model. Because the agent workflow comes from Claude Code, swapping the backend keeps everything the same while slashing the per-token rate. DeepSeek, GLM, Kimi, and others cost a fraction of Anthropic’s native rate.
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export ANTHROPIC_MODEL="deepseek-chat"
claude
See use cheap AI models with Claude Code and run DeepSeek with Claude Code. This alone typically saves the most.
Lever 2: route by task
Not every task needs your best model. With Claude Code Router, send background and routine work to a cheap or local model and reserve a stronger one for hard reasoning:
{
"Router": {
"default": "deepseek,deepseek-chat",
"background": "ollama,qwen2.5-coder:latest",
"think": "deepseek,deepseek-reasoner"
}
}
You only pay premium rates where they actually help.
Lever 3: cache and off-peak discounts
Cheap providers reward two behaviors:
- Cache hits — agent sessions resend the same context; providers like DeepSeek discount those repeated tokens automatically.
- Off-peak windows — DeepSeek and others cut rates during set hours. Run big, non-urgent jobs then.
These require no code change beyond choosing a provider that offers them — see DeepSeek V4 pricing explained.
Lever 4: tighter prompting habits
Your habits move the bill too:
- Keep prompts focused. Output tokens usually cost more than input; rambling requests cost more.
- Trim the context. Remove files from the session once you’re done with them; stale context inflates every call.
- Avoid redoing work. Plan-then-act (and reviewing diffs) stops a model running off in the wrong direction and burning tokens.
Cost levers by impact
| Switch backend model | Biggest — fraction of native rate |
|---|---|
| Route by task | Large — cheap model for routine work |
| Cache + off-peak | Moderate — automatic with the right provider |
| Prompting habits | Steady — fewer/cheaper tokens per task |
Lever 5: pick the right billing model
Finally, match billing to usage. Heavy daily coders save with a flat coding plan (GLM from $18/month); light or bursty users save with pay-per-token. Paying the wrong way can cost several times more — see coding plans vs pay-per-token.
Cutting your Claude Code bill
- Switch to a cheap backend (biggest saving)
- Route background/routine work to a cheaper model
- Pick a provider with cache + off-peak discounts
- Keep prompts focused and context trimmed
- Match plan vs pay-per-token to your volume
Wrapping up
Claude Code’s cost is token usage, and all of it is reducible. The biggest lever by far is switching to a cheap backend model — same workflow, fraction of the rate. After that, route by task, exploit cache and off-peak discounts, tighten your prompting, and pick the billing model that fits your volume. Stack those and a once-expensive habit becomes cents a day.
Start with use cheap AI models with Claude Code and cheapest AI coding API in 2026.