Skip to content

How to save tokens in Claude Code

· Pedro Villaca

Claude Code sends more than the words in your latest prompt. Conversation history, files, instructions, tool results, and thinking can all add tokens.

Reducing avoidable context can help. It does not guarantee a fixed percentage or an identical result.

Separate the four measures

Measure What it means
Tokens Units of model input and output
Cost A token-based charge or estimate
Usage limit Included activity available during a time window
Subscription The recurring price of the selected plan

For Pro and Max subscribers, /usage can show a local cost estimate. Anthropic says that estimate is not the subscription bill.

Lower token use can preserve included usage. It does not lower a fixed monthly subscription price.

Fourteen ways to reduce avoidable usage

1. Use /clear when the task changes

Stale context adds tokens to later requests. Use /clear when the next task does not need the current conversation.

Rename the session first if you might resume it later.

2. Use /compact for continuity

Compaction summarizes earlier history. It is useful when the same task must continue with less context.

Compaction must process the conversation it summarizes. It is not a free token reduction.

3. Keep CLAUDE.md focused

Claude Code loads CLAUDE.md into context. Anthropic recommends keeping the file under 200 lines and moving specialized instructions into skills.

Remove duplicate guidance. Keep rules that affect safety, quality, or repository behavior.

4. Match the model to the task

Anthropic says Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for work that needs complex planning or architecture judgment.

A lower rate can reduce cost without changing the transcript’s raw token count.

5. Lower effort for routine work

Extended thinking uses output tokens. Lower the effort level when a task has a clear target and simple verification.

Increase effort when the lower setting fails your checks. Some models always use extended thinking.

6. Audit context and MCP servers

Run /context to inspect what occupies the current window. Run /mcp and disable servers that the task does not need.

Claude Code defers MCP tool definitions by default. Server instructions and used tool results can still add context.

7. Filter large command output

Large test logs can remain in the conversation. Filter them to failures, relevant stack traces, and the final summary.

Keep the full log in a file. This preserves evidence when the short extract does not explain the failure.

Precise symbol navigation can replace several searches and file reads. Anthropic recommends code intelligence plugins for typed languages.

Use text search when it is sufficient. The goal is fewer unnecessary reads, not a mandatory tool for every query.

9. Delegate verbose work with a total-usage check

A subagent can keep test logs or documentation output outside the main context. Only its summary returns to the parent conversation.

The subagent still sends model requests. Measure all sessions before you claim a total reduction.

10. Keep agent teams small

Each teammate has a separate context window. Token use grows with the number of active teammates and their running time.

Use focused tasks and stop teammates when their work ends.

11. Write specific prompts

Name the file, function, expected result, constraints, and verification step. Specific prompts reduce broad exploration and correction turns.

12. Protect useful cache reuse

Prompt caching reduces repeated processing costs. A long break or changed prefix can cause more content to be processed again.

Use /usage to inspect current cache information when your Claude Code version supports it.

13. Review background activity

Scheduled tasks, cross-session messages, goal checks, and active teammates can start requests without a new prompt from you.

Review this activity when usage rises unexpectedly. Turn off work that no longer supports the current task.

14. Use Projects and concise chats

Anthropic says Project content can use caching and retrieval. Put reusable source material in a Project instead of pasting it into every chat.

Batch related questions when they need the same context. Start a new conversation when the subject changes.

Read the meters correctly

Use /usage for current session tokens and available plan attribution. On supported plans, it can show shares for skills, subagents, plugins, and MCP servers.

Use Settings > Usage for five-hour and weekly plan meters. Anthropic says Claude, Claude Desktop, and Claude Code share these usage limits.

Do not treat the /usage cost estimate as a subscription invoice. API billing, usage credits, limits, and subscription prices follow different rules.

What our benchmark found

Our Codex SWE-rebench checkpoint covered 14 tasks with three repetitions each.

Both arms passed 25 of 42 runs. Halv recorded $144.67 in selected model cost, compared with $337.50 for vanilla Codex.

The Halv workflow used 3.49 times as many tokens. This supports a limited Codex workflow cost claim, not a Claude token claim.

It also does not establish identical results on every task or universal savings.

Where Halv fits

Halv processes context on your device before supported coding agent requests leave the machine. It reports the token changes it measures.

Some sessions contain repeated or stale context. Others contain little removable material. Compare representative tasks and their verifier results.

Start a 7-day free trial. Halv Unlimited costs US$10 per month after the trial. A credit card is required. Cancel during the trial to pay nothing.

Sources

For a plan-focused workflow, read how to reduce Claude usage. It separates account consumption from token volume and explains where JEV routing fits.

Official Anthropic documentation checked on October 14, 2026:

Related reading: Claude usage limits, how to save tokens in ChatGPT, and Claude Code vs Codex.

How to Reduce ChatGPT Usage

Reduce avoidable ChatGPT usage with focused chats, relevant files, controlled tools, shorter outputs, and the right workspace for coding.

How to Reduce Claude Usage

Reduce Claude and Claude Code usage with smaller context, focused Projects, clear model choices, controlled tools, and complete measurement.

Frequently asked questions

How do I reduce token usage in Claude Code?

Clear context between unrelated tasks. Keep CLAUDE.md focused, disable unused tools, choose a suitable model and effort level, and limit large command output.

Does /clear or /compact save more tokens?

/clear starts a fresh session and costs nothing. /compact processes the history it summarizes, so use it when the same task needs continuity.

Do subagents save tokens?

They can keep verbose output outside the main context, but their requests still consume tokens. Measure the total workflow.

Does switching from Opus to Sonnet reduce tokens?

It can reduce cost or allowance consumption. The same transcript can still contain the same token count, so distinguish tokens from their rate.

Does lower token use reduce my Claude subscription price?

No. A fixed subscription price stays the same. Lower usage can preserve an allowance or reduce usage-credit and API spend.

How do I inspect Claude Code usage?

Use /usage for session tokens, plan bars, and available attribution. Use /context to inspect what occupies the current context window.

Does Halv guarantee a fixed token reduction?

No. Results depend on the task, model, context, and tools. Halv reports measured changes, and users should compare complete task outcomes.