cd /news/ai-tools/my-10-ways-to-save-tokens-in-claude-… · home › topics › ai-tools › article
[ARTICLE · art-171682] src=hjerpbakk.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

My 10 ways to save tokens in Claude Code

A developer's analysis of two months of Claude Code logs found that 97.4% of 14.9 billion tokens were prompt-cache reads, each initially sent token being reread 44 times on average, and that running subagents on Sonnet instead of Opus would have cut costs by about $1,600 at Opus 5.5 API rates. Rebuilding the cache after long pauses cost about $270, a single 55-hour session reached 844,000 tokens of context and about $93, and the RTK shell-output trimmer saved about $122 while context-mode saved about $36. The author's top recommendation is to run `/clear` between tasks and set `model: sonnet` or `model: haiku` on subagents, which used 55% of all tokens with 89% of that on Opus.

recommendation

Set model: sonnet or model: haiku on subagent definitions and run /clear between tasks; the author's logs show subagents used 55% of tokens and a Sonnet switch would have saved about $1,600.

more in playbook: Controlling LLM cost
by read7 min views2 publishedNov 17, 2026
My 10 ways to save tokens in Claude Code
Image: Hjerpbakk (auto-discovered)

Tokens are expensive, and after repeatedly hitting my limits, I figured it was time to see where my tokens were going. Now I have, and these are my tips for saving tokens in November 2026.

I went through two months of my Claude Code logs. I was on a Team plan, so I used Opus 5.5 API rates to put a dollar figure on the tokens and compare what each part cost.

RTK trims shell output and saved me about $122 at API rates. context-mode lets the agent search large tool results without them in full. That saved about $36. Cache misses after breaks came to about $270, and one 55-hour session came to $93. And I could have saved about $1,600 just by running my subagents on Sonnet.

How a coding agent spends tokens #

Claude Code sends the whole conversation with every request, and every tool call is another request. A session that has read ten files and run the tests carries all of it into every message that follows. Most of that history comes from the prompt cache. On Opus 5.5 a cache read costs $0.20 per million tokens against $4 for fresh input, twenty times cheaper, but the rereads add up.

For me in October and November, 97.4 % of 14.9 billion tokens were cache reads. Every token that was initially sent a conversation was read 44 more times on average before the session ended. Subagents get a conversation of their own, and they can run on a cheaper model. Mine used 55 % of all my tokens, and 89 % of that ran on Opus.

So the bill grows with the length of the conversation and the price of the model reading it. The tips are written for Claude Code, but most of them work the same way in Codex and other coding agents.

The top 10 #

1. Clear between tasks

/clear costs nothing and empties the conversation, so the next task starts without the history of the last one. Use /rename before you clear if you want to come back with /resume. I typed /clear 56 times in 560 sessions. My most expensive session stayed open for 55 hours on my marble maze game, grew to 844 000 tokens of context and cost about $93 by itself.

2. Mind the breaks

The cache only lives for a while, an hour for the main conversation according to the prompt caching docs. After a longer , the next message pays to write the whole context again, $8 per million tokens for a one-hour cache write. Finish the task, or clear before you leave. Scheduled tasks and loops send the full context too, even while the session is idle. Rebuilding the cache after long s came to about $270 at API rates over those two months.

3. Put a cheaper model on the subagents

Subagents are good for noisy work, since test output and logs stay in their context and only a summary comes back. Set model: sonnet or model: haiku in the subagent definition, and keep Opus for the steps that need it. Sonnet costs half as much. This was my most expensive mistake. I ran 1 237 subagents, almost all on Opus, many of them doing routine review work Sonnet could have handled. On Sonnet the two months would have been about $1,600 cheaper.

4. Turn the effort dial before you switch model

Addy Osmani’s model guide for Claude has the numbers for Opus 5.5 on SWE-bench Pro. Medium effort scores 2.5 points below high at 70 % of the price. Low scores 8 points below at a third of the price, and xhigh 1.4 points above at 2.5 times the price. Medium is the default in Claude Code. And when you can check the results automatically, running everything on low and only the failures again on high solved 97 % of the tasks at $0.17 each, against 95.3 % at $0.29 with everything on high. Better and cheaper.

5. Start over with a better prompt

When an answer goes wrong, the correction drags the wrong answer along for the rest of the session. Anthropic’s best practices say to press Esc as soon as it drifts, use /rewind to go back, and after two failed corrections clear and write a better prompt. One good prompt is cheap and good. A long conversation is expensive and worse.

6. Give the agent a check

A test, a build or a script that passes or fails is the cheapest way to avoid rounds of “that didn’t work either”. My projects start every change with a failing test, and the agent isn’t done until the build is green. A specific prompt helps the same way. Anthropic’s cost page uses the example “add input validation to the login function in auth.ts”, which reads a handful of files, while “improve this codebase” reads all of them.

7. Keep CLAUDE.md short

Everything in CLAUDE.md or AGENTS.md is loaded in every session and reread on every request. Anthropic removed over 80 % of Claude Code’s own system prompt for the Claude 5 models without any measurable loss on their coding evaluations. Their docs say to keep the file under 200 lines and move workflows into skills, which only load when they are needed. For every line, ask whether a strong model would do worse without it. If not, delete it.

8. Trim what comes back

Tool output is the part of the context you control most directly. Prefer CLIs like gh over MCP servers, turn off servers you don’t use, and run /context to see what fills the window.

Tools can do some of the trimming. RTK rewrites shell commands like ls, grep, git and test runners so they print less. context-mode keeps large results like logs, web pages and big files out of the conversation and lets the agent search them instead. In my two months RTK saved about $122, most of it on ls, grep and file reads. context-mode saved about $36, and blocked a few reads I needed, so the agent had to fetch the same thing another way. Small numbers next to the habits above, but RTK is free and needs no attention, so I keep it.

9. Measure your own usage

Look at your own numbers before you change anything. /usage in Claude Code breaks it down and recommends a change for anything behind 10 % or more of your recent usage. The transcripts in ~/.claude/projects have the token counts for every single request. The counters in token savers are no help here. RTK counts output Claude Code would have cut anyway, and context-mode counts screenshots by file size, so both claim far more than they save.

10. Write the plan to disk

For bigger jobs, ask the agent to write the plan as a markdown file in the repo and tick off the steps as they land. When you hit the limit, nothing is lost. A fresh session reads the plan and continues, without the history of the old one. It also makes tip 1 painless, since there is nothing in the conversation you need to keep. This one I got right.

Bonus: a second vendor #

On bigger jobs I ask Opus to write the plan, then have Codex review it with GPT-6.1 Sol. The two models tend to spot different mistakes. I send the comments to Opus, which goes through them and runs the plan with Opus subagents on the harder tasks and Sonnet on the simpler ones.

Sol costs the same as Sonnet at API rates, $2 per million input tokens and $10 per million output tokens. And when I hit my Claude Code limit, I carry on in Codex.

── more in #ai-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-10-ways-to-save-t…] indexed:0 read:7min 2026-11-17 · —