In this article
- Figure 1: Four levers that work together to lower cost per successful result: focused context, prompt caching, right-sized models, and usage monitoring.
- 1. Choose the right model and reasoning effort for each task
- 2. Use prompt caching for stable, repeated context
- 3. Manage context proactively with /context and /compact
- 4. Start a fresh session for unrelated work
- 5. Keep CLAUDE.md lean and move specialist instructions into skills or rules
- 6. Stop irrelevant file reads; and do not rely on an assumed .claudeignore
- 7. Reduce unnecessary tool and MCP overhead
- 8. Use the Message Batches API for work that does not need an immediate answer
- 9. Set output limits and effort based on the job
- 10. Measure usage and set a real budget guardrail
- 2026 token optimization checklist
- Official references
Claude has changed considerably since the Claude 3.5 and 3.7 era. The current Claude 5.5 lineup includes Haiku 5.5 for high-volume, cost-sensitive work, Sonnet 5.5 for fast everyday coding and knowledge work, and Opus 5.5 for harder, long-running tasks. Newer models also use adaptive thinking and effort settings, while Claude Code has improved context management and usage diagnostics.
Those changes matter because token usage is not determined by the model name alone. It depends on the amount of context sent, whether that context is cached, how much the model reasons, how long its answer is, which tools it calls, and whether it delegates work to other agents.
One distinction before we begin: Claude Code subscription usage and Anthropic API billing are not the same thing. Subscribers generally consume their plan allowance; API users are billed for token usage. Some Claude Code screens display an estimated dollar value even for subscription use. Check the billing surface that matches your account before treating that number as an invoice.
Here are 10 practical ways to reduce waste without blindly sacrificing output quality.
Figure 1: Four levers that work together to lower cost per successful result: focused context, prompt caching, right-sized models, and usage monitoring.
1. Choose the right model and reasoning effort for each task
Using the strongest model and highest effort for every request is rarely the most cost-effective strategy. In 2026, choose both a model and an effort level based on the task.
Current API list prices
The following are Anthropic's published first-party API prices in USD per million tokens, checked on October 13, 2026. Haiku 5.5 has different rates for prompts above 100,000 tokens. Cached reads have their own pricing, and cache-write costs are additional.
| Model | Input price | Output price | Cached input reads | Good starting point |
|---|---|---|---|---|
| Claude Haiku 5.5 | $0.10 up to 100K prompt tokens; $0.50 above 100K | $0.50 up to 100K; $2.50 above 100K | $0.01 up to 100K; $0.05 above 100K | Classification, extraction, short summaries, routing, and small repetitive subtasks |
| Claude Sonnet 5.5 | $2.00 | $10.00 | $0.10 | Everyday coding, bug fixes, reviews, and most scoped engineering tasks |
| Claude Opus 5.5 | $4.00 | $20.00 | $0.20 | Difficult debugging, architecture, and complex multi-step work |
| Claude Fable 5.1 | $10.00 | $50.00 | $0.25 | Demanding reasoning or long-horizon work, where available to your account |
Source: Anthropic's model pricing. Rates and availability can change.
Figure 2: Model tiers and API list prices (USD per 1M tokens, October 2026), with effort as a second dial. Rates can change.
A sensible workflow is to use Haiku for low-risk, repeatable tasks; Sonnet as the default for well-scoped work; and Opus or a higher-end model only when task difficulty justifies it. Test on representative tasks rather than assuming a more expensive model will always produce a better result per dollar.
Reasoning effort is another control. In Claude Code, use /model to choose a model and /effort to adjust its effort when supported. Lower effort can help for mechanical edits and straightforward questions; higher effort can be worthwhile for subtle bugs, architectural trade-offs, or changes that need extensive verification. Current models differ in which effort settings they support, so check the picker instead of assuming every level is available.
/model
/effort medium
Important: reasoning tokens count as output usage on the API. Newer models use adaptive thinking, so reducing effort is generally a better first step than trying to eliminate thinking with prompt wording. Evaluate quality alongside cost, latency, and tool calls.
2. Use prompt caching for stable, repeated context
Prompt caching is one of the most effective API-level optimizations when many requests reuse the same system instructions, tool definitions, examples, or reference material. Cache reads are much cheaper than processing the same input from scratch, though writing a cache has its own price.
The default cache lifetime is five minutes and refreshes when reused. A one-hour time-to-live (TTL) is also available at a higher cache-write price. The correct choice depends on how often requests recur, how long an agent works between calls, and the model's current rates.
Put stable content before changing content
A useful order is:
- Stable system instructions and coding standards.
- Stable tool definitions and reference material.
- Conversation history or other reusable context.
- The newest request and other content that changes frequently.
A cache is prefix-based: the content and ordering up to a cache breakpoint must match for that prefix to be reused. Changing a block before the breakpoint can cause a miss from that point onward; changing a later block does not automatically mean every earlier cached token is lost.
Figure 3: Prompt-cache order. Keep stable content first and changing content last, so the cached prefix stays reusable.
For example, the current Messages API supports explicit cache breakpoints on content blocks:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=2048,
system=[
{
"type": "text",
"text": "Stable coding standards and project instructions go here.",
"cache_control": {"type": "ephemeral"},
}
],
messages=[
{
"role": "user",
"content": "Review this function for a performance issue: ...",
}
],
)
For a one-hour cache, use "ttl": "1h" in the cache_control object where supported. Cache minimum sizes vary by model and platform; for example, Anthropic's current prompt-caching documentation lists a 512-token minimum for Sonnet 5.5. Do not reuse the old draft's universal 1,024-token threshold without checking the model you are using.
Check cache_read_input_tokens and cache_creation_input_tokens in API usage data to confirm caching is actually helping. In Claude Code, /usage can show prompt-cache statistics on supported versions. See the prompt caching guide.
3. Manage context proactively with /context and /compact
Long coding sessions accumulate conversation history, file contents, tool results, test logs, and prior decisions. A large context can increase per-request processing and make it harder to keep the current task focused.
Claude Code can automatically compact the conversation as it approaches context limits. You can also inspect context usage with /context and compact earlier with a targeted instruction:
/context
/compact Preserve the current architecture decisions, files changed, test results, unresolved failures, and next steps. Remove repeated discussion and raw terminal output.
A good compaction instruction says what must survive; active requirements, key decisions, relevant file paths, commands already tried, and known failures. Ask it to discard redundant logs, repeated explanations, and outputs that can easily be regenerated.
Avoid promising a fixed reduction such as “50,000 tokens becomes 3,000 tokens.” The result depends on the session. Review the summary after compacting if a subtle decision or exact detail matters.
4. Start a fresh session for unrelated work
A session used for database migration debugging is not automatically helpful when the next task is a CSS tweak. Keeping unrelated work in one conversation carries irrelevant context forward and can mislead the model about the task's current scope.
Figure 4: Same task? Use /context, then /compact. Unrelated task? Use /rename, then /clear, and /resume to return.
Use /clear when switching to an unrelated task. Rename the old session first if you may need to return to it:
/rename database-migration-debug
/clear
You can resume a previous session later with /resume. A fresh session starts with a new conversation context, while your project's CLAUDE.md instructions and configured memory can still be loaded. Do not clear a session merely because it has reached an arbitrary number of turns; clear it when the task or context has genuinely changed.
5. Keep CLAUDE.md lean and move specialist instructions into skills or rules
Claude Code loads project instructions at the start of a session. A large CLAUDE.md that includes every database rule, deployment guide, API manual, and review checklist consumes context even when a task does not need that information.
Aim for a short, useful CLAUDE.md; under 200 lines is a practical recommendation, not a hard product limit. Keep the always-needed material there:
- Essential commands for building, testing, and running the project.
- A compact directory overview and important architectural constraints.
- Non-negotiable code conventions and testing expectations.
- Links or paths to deeper documentation.
Move specialist guidance into on-demand skills and use path-specific rules under .claude/rules/ where appropriate. For example, detailed migration instructions should be needed when working on schema changes, not on every frontend edit.
# Project instructions
- Run `npm test` before completing code changes.
- Follow the existing TypeScript and formatting conventions.
- For database migrations, read `docs/database-guidelines.md`.
- For releases, follow `docs/deploy.md`.
Keep the linked documents accurate and focused too. A short index that sends Claude to a 10,000-line document for every task does not solve the problem.
6. Stop irrelevant file reads; and do not rely on an assumed .claudeignore
Large generated files, build output, coverage reports, minified bundles, and dependency directories can waste context when Claude reads them unnecessarily. However, do not assume that a .claudeignore file works as a universal exclusion mechanism. Use supported Claude Code settings, project scope, and normal repository hygiene instead.
For paths Claude should not read through its Read tool, configure permissions.deny in .claude/settings.json. For example, adapt this list to your project:
{
"permissions": {
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Read(./dist/**)",
"Read(./coverage/**)"
]
}
}
Be careful with broad rules: generated files can occasionally be relevant, and some dependencies contain type definitions or source that the agent may need. Keep node_modules/, vendor directories, and lockfiles out of exploratory prompts unless they are useful, rather than blocking useful files indiscriminately.
Permission rules are not a complete security boundary for every possible shell or tool action. Keep real secrets out of the repository and use an isolated environment and appropriate operating-system permissions for stronger protection. See the Claude Code permissions guide.
7. Reduce unnecessary tool and MCP overhead
Tools and Model Context Protocol (MCP) servers extend Claude Code, but a tool call can add input, output, and follow-up reasoning. The current Claude Code documentation says MCP tool definitions are deferred by default in supported versions, so the old claim that every connected tool schema always adds thousands of tokens to every request is not a reliable general rule.
Still, trim tool use where it makes sense:
- Run
/contextto see what is taking up room. - Run
/mcpto inspect configured MCP servers and disable ones you are not using for the current task. - Prefer concise CLI workflows such as
gh,aws, orgcloudwhen they can accomplish the same job with less tool-description overhead. - Use hooks to filter huge logs before Claude reads them. For instance, return only relevant
ERRORorFAILlines instead of the whole log file. - Use subagents for verbose, separable work such as reading documentation or analyzing test logs, but remember subagents consume their own usage too. Delegate only when the reduced main-context burden is worth the extra work.
The goal is not to eliminate useful tools. It is to avoid paying for irrelevant tool output or unnecessary agent coordination. See Manage costs effectively.
8. Use the Message Batches API for work that does not need an immediate answer
If a job can run asynchronously, the Anthropic Message Batches API offers a 50% discount on input and output tokens. It is suitable for tasks such as bulk classification, document extraction, offline evaluations, and large collections of independent summaries.
It is not designed for interactive requests that need an immediate response. Batch requests can be processed concurrently and in any order, so cache hits are best-effort; do not assume every request in a batch will reuse the same prompt cache automatically.
You can combine batching with prompt caching, but plan the cache lifecycle deliberately. For example, for requests that share a large prefix and may take longer than five minutes to process, a one-hour cache may be more appropriate. Measure the real job cost rather than multiplying discounts by hand without checking the current model-specific pricing rules.
Read the Batch processing documentation before building a production pipeline.
9. Set output limits and effort based on the job
Output tokens usually cost more than input tokens, and reasoning tokens count toward output usage on the API. A request that produces a long explanation, repeats the prompt, or prints an entire file when only a diff is needed can increase cost with little benefit.
Ask for the format you actually need:
Return only:
1. The root cause in one sentence.
2. The minimal code diff.
3. The test command and result.
Do not repeat the task description or print unchanged files.
For API calls, set a realistic max_tokens value and use the output_config.effort setting on models that support it. max_tokens is a hard cap for the request's combined thinking and response output; effort is a softer control over how much work the model does. Setting the cap too low can truncate the answer before the useful response is complete, especially on tasks requiring deeper reasoning.
For agentic coding, also state the scope: which files may change, what must not change, what tests should run, and what result counts as done. A clear task often saves more than adding a long list of generic “be concise” rules.
10. Measure usage and set a real budget guardrail
Use the tools available for the account type and version you have:
| Tool | What it helps you check |
|---|---|
/usage |
Session token usage; plan usage for subscribers; prompt-cache statistics on supported versions |
/context |
Context-window usage and areas consuming space |
/cost and /stats |
Aliases for /usage in current Claude Code documentation |
/insights |
A report on recent local Claude Code sessions, patterns, and friction points |
| Claude Console usage page | Authoritative API usage and billing information |
| Console workspace spend limits | Guardrails for API spend where available |
For API applications, inspect the response's usage fields, including input tokens, output tokens, cache reads, and cache writes. On models that expose a thinking-token breakdown, use it to understand how much output usage is reasoning versus visible text. Track cost per completed task and task success rate; not just raw tokens; because a slightly more expensive answer can be cheaper overall if it avoids several retries.
For Claude Code subscribers, the dollar estimate in /usage is computed from token counts and list prices; it is not necessarily what your subscription will be billed. For API users, confirm spend in the Claude Console rather than relying on a local session estimate alone. Set workspace spend limits where available, and use --max-budget-usd for supported bounded, non-interactive Claude Code runs.
2026 token optimization checklist
| Strategy | Best place to apply it | What to verify |
|---|---|---|
| Choose model and effort deliberately | Claude Code and API | Quality, latency, tool calls, and cost per completed task |
| Cache stable prompt prefixes | API and agent architecture | Cache-read and cache-write token counts; cache TTL |
| Compact only when useful | Long Claude Code sessions | Summary preserves decisions, files, tests, and next steps |
| Clear unrelated context | Day-to-day coding | New task starts without irrelevant conversation history |
Keep CLAUDE.md lean |
Project configuration | Specialist instructions load only when relevant |
| Limit unnecessary file reads | Claude Code repository work | Generated files and secrets are not read accidentally |
| Audit tools and MCP | Agent workflow | Tool output adds value; idle servers are disabled |
| Batch offline workloads | API pipelines | 50% batch discount outweighs latency and orchestration costs |
| Bound outputs intelligently | API prompts and Claude Code | No repeated content, oversized logs, or truncated answers |
| Monitor and cap spend | All workflows | Usage is checked at the correct billing surface |
There is no universal percentage of savings: results depend on the workload, model, caching hit rate, effort level, and how much tool work is required. Start by measuring a representative set of tasks, change one or two variables at a time, and keep the optimizations that reduce cost per successful result without lowering quality.


