Black Friday sale: 85 Claude Code agents for $29 one-time · lifetime updatesGet access →
Models

How to save tokens and cost in Claude Code: 12 habits that work

Updated · 9 min read

By Shubhranshu, creator of claudeagents · Last reviewed

Every message you send to Claude Code includes the whole conversation so far, your CLAUDE.md, and descriptions of your tools and skills. That's why a session that has been open all day uses far more of your limits than a fresh one, even for a one-line question.

These 12 habits cut that waste. They work whether you pay per token through the API or have a Pro, Max or Ultra plan with usage limits. They come from Anthropic's cost guide, checked on 16 November 2026, and from daily use.

First, see where your tokens go#

  • /usage shows the current session's tokens and estimated cost. On Pro, Max, Ultra, Team and Enterprise plans it also shows your plan limits and a breakdown of what's using them (skills, subagents, plugins, MCP servers) with recommendations. Press f there to apply the ones Claude Code can fix for you.
  • /context draws a grid of what fills the context window right now: conversation, CLAUDE.md, tools and so on.
  • /insights writes a report on how you use Claude Code across recent sessions, including where things go wrong.

For reference, Anthropic says enterprise developers average about $13 per active day and $150 to $250 a month through the API, with 90% of users under $30 a day. Your own numbers depend on your model, codebase and habits.

1. Clear between tasks#

Run /clear whenever you switch to unrelated work. Old conversation is sent again with every request, so a stale session wastes tokens on every message. Name the session with /rename first if you might come back to it with /resume.

2. Compact long tasks with a hint#

When one task runs long, /compact summarizes the conversation so far. Tell it what to keep: /compact focus on the API changes and failing tests. Compacting a huge conversation is itself a big request, so if you don't need the history, /clear is cheaper.

3. Match the model to the job#

Sonnet handles most coding work well and costs less than Opus. Save Opus for architecture decisions and hard, multi-step problems. Switch any time with /model, or Option+P (Mac) / Alt+P (Windows and Linux). For simple subagent jobs, set model: haiku in the subagent's file. Our model guide compares them.

4. Lower the effort for simple work#

Claude thinks before it answers, and thinking is billed as output. For quick edits, lower it with /effort low or /effort medium; raise it again for hard problems. Some newer models always think, so effort is the setting to use there.

5. Keep CLAUDE.md lean#

CLAUDE.md loads into every session, so every line costs tokens on every message. Anthropic suggests keeping it under about 200 lines. Keep facts Claude needs every time (commands, layout, key rules) and move long procedures, such as how to do a release, into skills.

6. Use skills for procedures#

A skill only loads its full instructions when it's used. Moving a 300-line checklist from CLAUDE.md into a skill means you only pay for it when you run it. A "codebase overview" skill can also save Claude from reading dozens of files to understand your project.

7. Trim MCP servers and plugins#

Each enabled MCP server and plugin adds a little to every message. Run /mcp and disable servers you aren't using, and check /plugin for plugins under "Not used recently". Where a command-line tool exists, such as gh for GitHub, it's often cheaper than an MCP server because it adds nothing to the context until Claude runs it.

8. Write specific prompts#

"Improve this codebase" makes Claude read everything. "Add input validation to the login function in src/auth.ts" lets it go straight to the right file. Use @ to point at files you already know are relevant.

9. Plan first, stop early#

Use Plan mode (Shift+Tab) for anything non-trivial, so you agree on the approach before Claude writes code. If it heads the wrong way, press Esc immediately and correct it rather than letting it finish; /rewind undoes what it changed.

10. Give Claude a way to check its work#

Tests, a type checker or the expected output let Claude catch its own mistakes in one pass, instead of you spotting them and asking for several rounds of fixes.

11. Send noisy work to subagents#

Running a big test suite, reading long logs or researching docs fills the context with output you don't need to keep. A subagent does that work in its own context and returns only a summary. It still uses tokens, but your main conversation stays small; give simple subagents a cheaper model.

12. Filter output with hooks#

A hook can shrink output before Claude reads it, for example keeping only the last 100 lines of test output or only the lines with ERROR in a log file. That can turn tens of thousands of tokens into hundreds.

Why a long session uses so much#

  • Every request resends the full conversation, so a question late in a long session costs more than the same question early on.
  • After a long break, the first message misses the prompt cache and reprocesses everything.
  • Scheduled tasks (/loop), background subagents and agent teams all send their own requests.
  • Each agent team member has its own context; Anthropic estimates agent teams use about 7 times more tokens than a normal session when teammates plan.

Frequently asked questions

How do I check how many tokens I'm using in Claude Code?

Run /usage. It shows the current session's tokens and estimated cost, and on subscription plans your plan limits plus a breakdown of what's using them. /context shows what fills the context window right now.

Does /clear save tokens?

Yes. /clear starts a new conversation, so the old history stops being resent with every message. It's the biggest single saving when you switch tasks.

Is /compact or /clear better?

Use /compact when you're in the middle of one task and need to keep its context. Use /clear when you switch to something unrelated: it's free, while compacting a long conversation is itself a large request.

Which Claude model is cheapest for Claude Code?

Haiku costs the least and suits simple jobs and subagents. Sonnet is the best balance for most coding. Opus costs the most and is worth it for hard architecture or reasoning problems.

Why do I hit my Claude Code limit so fast?

Usually long sessions that are never cleared, Opus as the default model, a large CLAUDE.md, or many MCP servers and plugins. Run /usage to see which applies to you and follow its recommendations.

Sources

Keep reading