Cost optimizationGuide
How to make Claude Code cheaper: costs and cheaper models
What drives Claude Code spend, how Anthropic's per-token prices compare on one workload, and how to switch to an open-weight model.

On this page
To make Claude Code cheaper, do two things: send fewer tokens per task, and pay less per token. The first is a matter of habits (/clear, /compact, a smaller model for simple work). The second is a matter of the model behind the endpoint: Claude Code speaks the Anthropic Messages protocol, and the CheapTokens API accepts the same protocol at https:/ with open-weight models behind it.
What Claude Code spend is made of#
Claude Code bills by API token consumption. According to Anthropic's cost documentation (checked 22 October 2026), the average enterprise cost is about $13 per developer per active day and $150–250 per developer per month, and stays below $30 per active day for 90% of users. Source: code.claude.com/docs/en/costs.
Why the numbers add up quickly:
- Claude Code sends the full conversation with every request, and each tool use triggers another request.
- Prompt caching re-reads the history at the cached-token rate, but the first message after a break longer than the cache lifetime misses the cache.
- Thinking tokens are billed as output tokens, and output is the expensive side of the price list.
- Agent teams use about 7× more tokens than a standard session when teammates run in plan mode (Anthropic's figure).
If you are new to the input/output split, see input vs output tokens. For a method of estimating an agent's bill, see how to estimate the cost of an AI agent.
Cut the tokens you send#
Anthropic's own tips are worth doing before any provider change:
/clearbetween unrelated tasks, so old history is not resent./compactwith instructions about what to keep./modelto pick a cheaper model for simple tasks, and/effortto lower the effort.- Disable MCP servers you do not use.
- Delegate verbose work to subagents, write specific prompts, use plan mode.
- Watch
/usage: it shows an estimate at list price, not an invoice.
Anthropic list prices on one workload#
Prices per 1M tokens, from Anthropic's pricing page (platform.claude.com), checked 22 October 2026:
Scroll the table right →
| Model | Input | Output |
|---|---|---|
| Claude Opus 5.5 | $4 | $20 |
| Claude Sonnet 5.5 | $2 | $10 |
| Claude Haiku 5.5 (prompts up to 100K tokens) | $0.10 | $0.50 |
| Claude Haiku 5.5 (prompts over 100K tokens) | $0.50 | $2.50 |
Take a sample day of agent work: 5,000,000 input tokens and 500,000 output tokens, with no cache hits (a simplification; caching lowers the input side).
- Claude Opus 5.5: 5 × $4 + 0.5 × $20 = $30
- Claude Sonnet 5.5: 5 × $2 + 0.5 × $10 = $15
- Claude Haiku 5.5 (prompts up to 100K tokens): 5 × $0.10 + 0.5 × $0.50 = $0.75; at the over-100K rate the same workload is 5 × $0.50 + 0.5 × $2.50 = $3.75
The same workload on the models available in CheapTokens, at the current prices:
| Model | Input $/1M | Output $/1M | Cost | OpenRouter |
|---|---|---|---|---|
| GLM-5.3-Flash | $0.02 | $0.04 | $0.12 | $0.244 |
| DeepSeek-V4-Flash | $0.015 | $0.10 | $0.125 | $0.316 |
| MiniMax-M2.7 | $0.05 | $0.15 | $0.325 | $2.10 |
5,000,000 input and 500,000 output tokens in total. Prices per 1M tokens are current and change together with our tariffs; the OpenRouter column shows reference prices for the same workload.
Switch Claude Code to an open-weight model#
Claude Code reads its endpoint and key from environment variables, so no patching is needed. The exact variables and the model id are in How to connect Claude Code to CheapTokens; take the model id from the CheapTokens documentation, because names differ between providers. The key stays in an environment variable or a secret store, never in a repository.
Which model for which job:
- MiniMax-M2.7 for coding and agent tasks: $0.05 input and $0.15 output per 1M tokens, cheaper than OpenRouter's reference price on both sides, 180K context.
One balance covers all models, and there are no peak hours. Current prices are always on the pricing page.
Check that it works#
- Start Claude Code with the variables set and ask it a small question about your repository.
- If Claude Code answers, the requests go through CheapTokens. If an error appears, see the common connection errors below.
- Run one real task and look at the token counts in
/usage.
If it does not work#
- 401 / authentication error: the key is missing or mistyped in the environment of the shell that started Claude Code.
- Model not found: the model id does not match the one in the CheapTokens documentation.
- Answer cut off: check the model's output limit (see why an AI answer stops mid-sentence).
- Connection errors: see common connection errors.
Takeaway#
Keep the habits that shrink the context, and put the work that burns the most tokens (long agent loops, repeated edits) on a model priced for it. The comparison above uses one workload, so you can repeat it with your own numbers from /usage.



