DEV Community

Cover image for How I Cut My Claude Code Token Usage by 60% and Got Better Output

How I Cut My Claude Code Token Usage by 60% and Got Better Output

v. Splicer on May 18, 2026

The first sign something was wrong was the invoice. Not catastrophically wrong. More like “this escalated quietly while I was having fun” wrong. I...
Collapse
 
itskondrat profile image
Mykola Kondratiuk

60% reduction is solid but the better output claim needs scrutiny. shorter context sometimes just means fewer wrong turns, not smarter reasoning - could be trading capability for predictability

Collapse
 
genglin profile image
Genglin Zheng

Based on your description, I've come up with a technique: could we combine claude code and chat? For code-related communication, we could use claude code for concise and direct interaction, while for communication requiring reasoning or thought, we could use chat. The goal is to ensure that the chat doesn't consume our tokens.

Collapse
 
mnemehq profile image
Theo Valmis

"Entropy in the context produces entropy in the response" is the most useful framing I've seen for why session hygiene matters. The model isn't forgetting — it's attending to everything it's been given, including the dead ends and resolved errors. Every failed attempt in the context is material the model is reasoning against when generating the next response.

The five-line handoff pattern is effective for exactly the reason you describe, but it's also doing something for you: it forces you to articulate clearly what state the project is actually in before re-engaging. That clarity benefits your own thinking as much as the model's. Vague prompts are expensive not just because they generate verbose responses — they're expensive because you can't evaluate whether the output was correct if you weren't clear about what correct meant when you started.

Collapse
 
harjjotsinghh profile image
Harjot Singh

"Cut tokens 60% AND got better output" is the counterintuitive truth that more people need to hear: less context often means better results, not just cheaper ones. A bloated context dilutes the model's attention - it has to wade through irrelevant files and stale history to find what matters, and that noise degrades the answer. Trimming to exactly what's needed is simultaneously a cost win and a quality win. They're not a tradeoff; they're the same lever.

This is the single most important thing I've learned building agent systems, and it surprises people every time: context discipline isn't a cost sacrifice, it's a quality upgrade. Feeding the model less of the right stuff beats feeding it more of everything. It's why Moonshift (a multi-agent pipeline that ships a prompt to a deployed SaaS) gives each agent a tight, purpose-scoped context - it's how a build stays ~$3 flat AND produces better output than one bloated mega-context agent would. Excellent post, and the "better output" half is the part most cost articles miss. What was the change that gave you both wins at once - was it context scoping, or something about how you structured the prompts?

Collapse
 
fkiene profile image
François Kiene

The "stop pasting entire files" and "answer budgets" bits are the ones I'd underline. Both are real, and both are also the parts you can stop doing by hand.

Disclosure: I build a compressor for this (llmtrim, open source: github.com/fkiene/llmtrim), so weight me accordingly. After a lot of measuring, the split I keep landing on is that the discipline you describe is the actual lever, but half of it is mechanical and half is judgment.

The mechanical half automates fine. Trimming a pasted file down to the relevant functions, stripping a 200-line command output to the errors before it hits the model, that kind of thing. A proxy can do it on every request so you never have to remember. One catch though, the tools bragging about 80-90% usually get there by deleting content, and it's easy to show a huge number while quietly tanking the answer. Whatever you use, check the answer still came out right, not just the token count.

The judgment half is the better part of your post, and nothing automates it. Mode separation, the five-line handoff, and especially "know when not to use Claude." No proxy saves you from staring at a generated diff like a slot machine when you already knew the answer. That's the real variable.

And measure before you optimize any of it. You can't see the giant prompts or the speculative rewrites until the cost is in front of you, and most of the fix is just that visibility.