Skip to content
, ,

How to Reduce Claude Code Token Usage and Cost (2026): /usage, /compact, CLAUDE.md, Models and MCP

10–15 minutes
Worried woman in a rust turtleneck in a bright studio, Claude logo card, hook $13/day cut claude costs

Claude Code sends your whole conversation with every request. That is why a long session can eat your plan limits or API budget much faster than you expect.

Anthropic’s own data puts the average enterprise cost at about $13 per developer per active day. This guide shows the settings and habits that keep you well below that.

TLDR

  • Measure first: run /usage (alias /cost) and /context to see where tokens go.
  • Clear often: /clear between unrelated tasks costs nothing. /compact is itself a large request.
  • Trim CLAUDE.md: Anthropic suggests under 200 lines. Move workflow detail into skills.
  • Right-size the model: Sonnet 5.5 is half the price of Opus 5.5. Use Haiku for simple subagents.
  • Cut noise: disable unused MCP servers, prefer CLI tools, and filter test output with a hook.

Why Claude Code Uses So Many Tokens

Every request carries the full conversation: your prompts, Claude’s replies, file contents and tool results. Each tool call sends another request with that history attached.

Prompt caching softens this. Repeated history is re-read at the cheap cached rate, but it is still counted. A one-line question in a session open all day draws usage for the whole conversation.

Quick answer: Context size drives cost. Smaller context per request means fewer tokens, lower bills and slower progress toward your plan limits.

The main reasons usage climbs in a long session, according to Anthropic’s cost docs:

  • Long context: the whole history goes out with every message and every tool call.
  • Cache misses: your first message after a long break misses the cache and reprocesses everything.
  • Scheduled tasks and loops: a /loop task fires on its interval even while you are away.
  • Subagents and agent teams: each one sends its own requests on top of yours.
  • Compaction: /compact has to read the conversation it summarises, so it is a big request.
  • Thinking: thinking tokens are billed as output, and newer models always think.

Measure Your Usage: /usage, /context and /insights

You cannot cut what you cannot see. Claude Code has three built-in tools for this.

Command What it shows Best for
/usage (aliases /cost, /stats) Session cost estimate, tokens by model, prompt cache stats, plan usage bars and a breakdown with recommendations Seeing what eats your limits
/context A coloured grid of what fills the context window, with suggestions Finding bloated memory files and heavy tools
/insights An HTML report on how you work across up to 200 recent sessions Spotting wasteful habits
Status line Context usage and cost, always visible Catching growth before it hurts

On Pro, Max, Team and Enterprise plans, /usage also attributes recent usage to skills, subagents, plugins and individual MCP servers. It lists recommendations for anything behind 10% or more of your usage, such as Trim ~/code/api/CLAUDE.md · 49k tokens per request.

Tip: On Claude Code v2.1.305 or later, press f inside /usage when the footer shows “f to fix”. Claude Code applies the recommendations it can, such as lowering effort, and shows you each change first.

Remember that the dollar figure in /usage is a local estimate at list price. For real API billing, check the Usage page in the Claude Console. A custom status line can show these numbers all the time.

A 10-Minute Plan to Cut Token Usage

If you only do one thing from this guide, work through these steps once per project.

  1. Check your baseline. Run /usage and note the session cost, cache hit share and any recommendations.
  2. Inspect the context. Run /context and look for large memory files, MCP tools or old tool results.
  3. Trim CLAUDE.md. Cut it to essentials, under about 200 lines, and move workflow detail into skills.
  4. Disable unused MCP servers. Run /mcp and turn off servers you are not using in this project.
  5. Set a sensible default model. Use /model to pick Sonnet 5.5 for daily coding, and keep Opus or Fable for hard problems.
  6. Lower effort for routine work. Run /effort medium or /effort low for simple edits.
  7. Route noisy work to subagents. Send test runs, log digging and doc fetching to a subagent on Haiku.
  8. Build the clear habit. Use /clear whenever you switch to an unrelated task.

Keep Context Small: /clear, /compact and Auto-Compact

Use /clear between unrelated tasks

Stale context wastes tokens on every message that follows. /clear starts a new conversation with empty context and costs nothing. Its aliases are /reset and /new.

Name the old session first with /rename, or pass a name to /clear, so you can find it later with /resume.

Use /compact when you need continuity

/compact summarises the conversation so far to free space. You can tell it what to keep:

/compact Focus on code samples and API usage

You can also add standing instructions to CLAUDE.md:

# Compact instructions

When you are using compact, please focus on test output and code changes

Warning: Compaction is not free. It reads the whole conversation it summarises. If you do not need continuity, /clear is cheaper than /compact.

Tune the auto-compact window

Claude Code compacts automatically as context fills. On v2.1.221 or later, /autocompact sets how full the window gets first. Pass a size such as 500k, or auto to return to the default for your model.

A smaller window keeps every request lighter but compacts more often. Try it on long-running sessions where you notice usage climbing.

Other context habits that save tokens

  • Write specific prompts: “add input validation to the login function in auth.ts” beats “improve this codebase”.
  • Use plan mode first: press Shift+Tab to plan before editing, which avoids costly rework. See our plan mode guide.
  • Stop early: press Escape when Claude heads the wrong way, and use /rewind to go back.
  • Use /btw for side questions: it answers without adding to the conversation history.

Shrink CLAUDE.md and Move Detail to Skills

CLAUDE.md is loaded into context at the start of every session. Everything in it is sent with every request, whether or not it is relevant to the current task.

Anthropic’s guidance is to keep CLAUDE.md under 200 lines with only the essentials. Workflow-specific instructions, such as PR reviews or database migrations, belong in skills.

  • Keep in CLAUDE.md: build and test commands, code style rules, key folders, and things Claude gets wrong often.
  • Move to skills: long checklists, release steps, migration guides and review rubrics.
  • Delete: anything Claude can learn by reading the code, plus outdated rules.

Skills load on demand, only when invoked. A “codebase overview” skill can also save tokens by giving Claude the project map, instead of letting it read dozens of files to work it out. Our Claude skills guide shows how to write one.

Pick the Right Model and Effort

Model choice is the biggest single price lever. Here are current API prices per million tokens, which also shape how fast plan limits drain.

Model Input / output per MTok Good for in Claude Code
Claude Fable 5.2 $8 / $40 The hardest, longest agentic tasks
Claude Opus 5.5 $4 / $20 Complex architecture and multi-step reasoning
Claude Sonnet 5.5 $2 / $10 Most day-to-day coding
Claude Haiku 5.5 $0.10 / $0.50 (prompts up to 100K) Simple subagent tasks, search and summaries

Anthropic’s docs say Sonnet handles most coding tasks well and costs less than Opus. Switch with /model, or press s in the picker to switch for the current session only.

Lower effort for routine tasks

Thinking tokens are billed as output tokens. You cannot turn thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, so effort is your control.

  • /effort low: quick edits, renames, small fixes.
  • /effort medium: normal feature work.
  • /effort high or xhigh: tricky bugs and design work.
  • /effort max: session-only, for when correctness matters more than cost.

Note: Fast mode does the opposite of saving money. It doubles the per-token price for faster output and bills Pro and Max plans from usage credits. Read our fast mode guide before turning on /fast.

Use Subagents for Noisy Work

Running tests, reading logs and fetching docs can flood your main context. A subagent does that work in its own context window and returns only a summary.

The subagent’s requests still count toward your usage. To keep them cheap, set a smaller model in the subagent’s file:

---
name: test-runner
description: Runs the test suite and reports only failures
model: haiku
tools: Bash, Read
---
Run the project's tests. Report each failing test name and the first
error line. Do not paste full logs.

Watch out for agent teams. Anthropic says teams use about 7x more tokens than standard sessions when teammates run in plan mode. Keep teams small, use Sonnet for teammates, and shut them down when done.

Trim MCP Servers and Tool Output

MCP tool definitions are deferred by default, so only tool names and server instructions enter context until a tool is used. Even so, every server adds some overhead, and tool results can be huge.

  • Disable unused servers: run /mcp and switch off anything idle in this project.
  • Prefer CLI tools: gh, aws, gcloud and sentry-cli add no per-tool listing at all.
  • Scope servers per project: keep project-only servers in the project’s .mcp.json, not your user config. Our MCP setup guide explains scopes.
  • Add code intelligence plugins: for typed languages, “go to definition” replaces a grep plus several file reads.

Filter test output with a hook

A PreToolUse hook can rewrite a test command so Claude only sees failures. Add this to settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          { "type": "command", "command": "~/.claude/hooks/filter-test-output.sh" }
        ]
      }
    ]
  }
}

Then save this script as ~/.claude/hooks/filter-test-output.sh and make it executable with chmod +x. It needs jq installed.

#!/bin/bash
input=$(cat)
cmd=$(echo "$input" | jq -r '.tool_input.command')

if [[ "$cmd" == "npm test" || "$cmd" == "pytest" || "$cmd" == "go test ./..." ]]; then
  filtered="$cmd 2>&1 | grep -A 5 -E '(FAIL|ERROR|error:)' | head -100"
  echo "$input" | jq --arg f "$filtered" '{hookSpecificOutput: {hookEventName: "PreToolUse", updatedInput: (.tool_input + {command: $f})}}'
else
  echo "{}"
fi

Run /hooks to confirm it appears under PreToolUse. The same idea works for logs: grep for ERROR and return hundreds of tokens instead of tens of thousands.

Usage Limits, Spend Caps and Hidden Background Usage

Plan limits

On Team and Enterprise, each seat’s Claude Code usage draws from an allowance that resets on a rolling five-hour window and a weekly window, shared with Claude chat. Pro and Max plans also show session and weekly limits in /usage.

  • “You’ve hit your session limit” or “weekly limit”: shared across all models, so /model will not help. Wait for the reset or use usage credits.
  • “You’ve hit your Opus limit”: model-specific, so switching to Sonnet keeps you working.
  • Auto-continue: on v2.1.234 or later, Claude Code can wait and continue the task after the reset. See /rate-limit-options.

API and team spend caps

  • Claude Console: set workspace spend limits on the automatic “Claude Code” workspace.
  • Team and Enterprise: set usage-credit spend limits per organization, group or member.
  • Scripts and CI: cap a headless run with --max-budget-usd.

Background usage you might not notice

  • Session summaries: background jobs for claude --resume, typically under $0.04 per session.
  • Prompt suggestions: a short request after each reply, mostly cache reads. You can turn suggestions off.
  • Goal check-ins: set CLAUDE_CODE_GOAL_CHECKIN_MINUTES to 0 to stop idle check-ins.

For plan prices and what each tier includes, see our Claude Code pricing guide.

Troubleshooting: Common Problems and Fixes

My limit drains even when I am idle

Check for /loop tasks, goal check-ins and cross-session messages. The Loops rows in /usage list the heaviest scheduled tasks. Stop the ones you do not need.

The first message after lunch is expensive

The cache expired, so the full context was reprocessed. Clear or compact before a long break, which is exactly what the “Compact before you step away” recommendation means.

/usage shows a big cost but I am on Max

The Session block shows API-equivalent cost at list price. On a subscription it is not your bill. Read the plan usage bars on the same screen instead.

Switching to Sonnet did not help with my limit

Session and weekly limits are shared across models. Only a model-specific message, such as the Opus limit, is fixed by switching models.

Subagents are using more than the main chat

Subagents may inherit your Opus or Fable model. Add model: haiku or model: sonnet to their files, and keep their prompts short.

Thinking cannot be disabled

On Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable, thinking is always on. Use /effort low. MAX_THINKING_TOKENS only affects models with a fixed thinking budget.

Frequently Asked Questions

How much does Claude Code cost per day?

Anthropic reports an enterprise average of about $13 per developer per active day, or $150 to $250 per month. Costs stay below $30 per active day for 90% of users.

Is /cost still a command?

Yes. /cost is now an alias for /usage, which shows session cost, cache stats and plan usage in one screen.

Is /clear or /compact cheaper?

/clear costs nothing because it starts fresh. /compact reads the whole conversation to summarise it, so use it only when you need to keep the thread.

How long should CLAUDE.md be?

Anthropic suggests keeping it under 200 lines. Put workflow-specific detail in skills, which load only when needed.

Do MCP servers use tokens when idle?

Tool definitions are deferred by default, so idle servers add only tool names and instructions. Disable unused servers and prefer CLI tools where you can.

Which model is cheapest for Claude Code?

Haiku 5.5 is the cheapest at $0.10 / $0.50 per million tokens for shorter prompts. Sonnet 5.5 is the best value for most coding work.

Do subagents save tokens?

They keep noisy output out of your main context, which saves tokens on later messages. Their own requests still count, so give them a smaller model.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Worried woman in a rust turtleneck in a bright studio, Claude logo card, hook $13/day cut claude costs