Paste This Into Claude Code, Never Run Out Of Tokens Again
456 segments
Claude just told me to come back in 5
hours and I still have a lot of work to
do today. I didn't have it do anything
massive. I didn't even run it for 8
hours straight. So, I set myself out on
a journey to understand why I kept
reaching my session limit and how I can
stop that from happening ever again.
[music] And the crazy part is almost
none of my usage limit was because of
what I typed. 0.01% [music]
of it to be exact. That is just how
these tools work. And once you see the
mechanism behind it, you can cut most of
your costs down. So, in this video, I'm
going to give you a prompt you can paste
[music] into Claude code that audits
your setup, then the seven fixes that
actually move your token consumption
[music]
down. Starting with the one that costs
nothing and ending with a trap that is
probably [music] doubling your bill
right now. Let's get started. Here is
the best way for me to explain token
consumption. These models have no
memory. None. Absolutely none. So, every
time you hit enter, your entire
conversation gets wrapped up and sent
again from the top. Your first message
costs what you typed. Your second
message costs what you typed plus the
answer plus the first message. By
message 20, the thing you just wrote is
that silver box at the top. It's every
single thing here. Everything under it
is stuff you already paid for being paid
for again. That is why it compounds the
way that it does. A 3,000 token file
your agent reads at turn four of a
40-turn session does not cost you 3,000
tokens. It costs you 3,000 tokens 37
more times. I mean, look at this
messages line right here. That is not
what you asked. That is all of this
chat's history compounding over and over
and over again. And the reason that
matters is that your setup is not the
same as mine. So, let me show you how to
find your own version of this. This is
the prompt. I've included it in the
description for free. You don't have to
give me your email for it. Paste it into
Claude code and it will audit your
actual configuration. It reads your
context breakdown, checks whether tool
deferral is on, measures your memory
files, looks at your cache hit ratio,
and flags scheduled tasks that are
firing while you sleep. You can
screenshot this video right now and send
this to your AI agent. This will let you
know what is consuming the most amount
of tokens for you and which of these
next seven fixes matter the most for
you. Mine came back with these problems
and I'm fixing them in order of what
actually saves me the most. The highest
leverage thing you can do to cut costs,
costs you nothing and is five letters
long. When you finish a job and start
with a different one, use {slash}clear.
Do not keep going in the same thread
because it is it is convenient. That old
conversation is not sitting there
quietly. It is being resent on every
message you send until the session ends.
Watch this. Messages are at 80,000
tokens and if I
write {slash}clear
and hit enter and boom, just like that,
messages are back to 0%. And Anthropic's
own docs say it plainly. When you want a
fresh start instead of continuity,
{slash}clear costs you nothing. Here's
why this beats everything else in this
video. Every other fix I'm about to show
you reduces one component of your
context. Clearing resets the entire base
that all of those components are a
fraction of. 96%
of my spend was rereading history. This
is the one tool that deletes the
history. One thing before you go
clearing everything, use {slash} rename
inside your session first, so you can
use {slash} resume later, which allows
you to restore the session in case you
ever urgently needed it. You are not
throwing the work away, you're stopping
the next job from carrying it. And that
fix is free. The next one is the
opposite, because it is something you
are probably already doing on purpose to
save money. This is the one I want you
to actually remember. When you're
running low, what do you do? You
probably switch to a cheaper model. You
hit {slash} model, drop from Opus to
Sonnet, and you feel great about it.
That switch is the most expensive thing
you can do. Here's why. Your
conversation is cached, and cache reads
cost 1/10 of normal output. That is why
long sessions do not bankrupt you. But,
the model is part of the cache key.
Change the model, and none of your
history matches the cache anymore. So,
the entire conversation gets reprocessed
at full price. On Opus 5, at 200,000
tokens of context, that turns a 10-cent
turn into a 1-dollar turn. 10 times more
expensive. It's absolutely invisible,
and you did it to yourself while trying
to save money. Effort level does the
same thing, by the way. Fast mode does
the same thing, as well. So, things that
break it, switching models, changing
effort, turning on fast mode, connecting
or disconnecting an MCP server if your
tools load up front, enabling a plugin
that ships an MCP server, and
compacting. Also, and this one is nasty,
upgrading cloud code and then resuming a
long session. Anthropic's docs literally
call that the most expensive request you
will send. Things that are safe, editing
files in your repo, editing your memory
file, changing output style, changing
permission mode, invoking skills and
commands, recaps, rewinds, and spawning
a sub agent. So, the rule is simple.
Pick your model and your effort at the
start of the session and then leave
those settings alone. If you want to be
on a cheaper model, start there. So,
that is the expensive keystroke. The
next three fixes, however, aren't
something you've ever typed. Yet, they
burn away at your context. Picture this,
you type in install remotion for me.
Your agent goes off and runs the actual
commands and 800 lines come back.
Package names, version numbers,
warnings, a funding message. You did not
read a single one of them. You just
wanted to know that it actually worked
and it installed the thing you asked it
for. But, your agent does not get to
skim. All 800 lines went into your
conversation and you pay for them again
on every message until you clear. So,
put a filter in front of it and you do
not write it this next part. You asked
for it. You can give it a prompt like
the one I'm showing on the screen as I'm
talking right now. It will create one
small file that sits between your agent
and the command and it cuts the output
down before your agent ever sees it.
Your agent writes it, your agent
installs it, and from then on it just
works. Anthropic ships a working version
of this so your agent has something to
copy from. Their online on it is
reducing context from tens of thousands
of tokens to hundreds. You do this once
and it works on every session after
that. And this fix is output coming in.
The next fix is what is already sitting
in your context before you have ever
typed anything. You connect Gmail, then
Notion, then Slack, and each takes you a
single prompt to install, and it feels
free, but it's not free. Every tool you
connect comes with an with an
instruction manual, what it can do, what
to send, what comes back, and your agent
has to read that manual before allowed
to touch the tool. GitHub on its own,
for example, costs you 26,000 tokens.
Slack is 21,000 tokens. All of that gets
loaded into every single session before
you type a single word. Now, here's the
good news. Claude has released an update
that makes sure your agent does not read
every manual anymore. It loads the
contents page, and it only opens the
section it actually needs when it needs
it. You still have access to the same
tools, but that cost has went down 85%.
That part is handled for you. It is on
by default, and you do not have to do
anything. But, you are still paying for
the contents page. And the contents page
grows every single time you connect
something new. So, here's the fix, and
it takes about 30 seconds. Type in
And just with that, you will see a panel
of every single tool you have ever
connected in one list
with a switch next to each one. Go down
in that list and turn off anything you
have not used in the last like month.
You're not deleting it, it stays set up,
it just stops loading. One last thing to
check while you are here, run /context,
and find the tools line when it loads
up. So, we'll go ahead and expand, and
there we go. We have system tools and
system tools right here. If it says
deferred, you are on the new behavior
and the manuals are staying shut when
you don't use them. So, as you can see,
it's only using up 17,000
context tokens and 20,000 of the active
tokens of skills I am currently using in
this session right now. And the good
news is turning tools off mid-session
does not cost you anything. As long as
that line says deferred, connecting and
disconnecting just appends. It does not
rebuild your cache the way switching
models does. And the next thing
everybody tells you to do is delegate to
sub-agents. So, I want to be honest
about that because what you have been
told is sort of half true.
Everybody says sub-agents save tokens,
but they do not. They move them. Here
are Anthropic's own numbers from their
documentation. So, over here we have a
simulation of how context windows work.
And if I go ahead and go through the
simulation, we get a prompt like use a
sub-agent to research this session. And
if you look at the context window, when
we hit send, boom, just like that, the
sub-agent has spent very few tokens
because what we see is a sub-agent reads
about 6,000 tokens of files and what
comes back to your main context is a 420
token summary. That looks like a massive
win. And in your main window, it is.
But, do the math on the whole thing.
That sub-agent loaded its own system
prompt, its own copy of your memory
file, its own tools, and then did the
reading. It burned roughly 9,800
tokens to save you 5,700.
In isolation, you lost. And Anthropic is
blunt about this elsewhere. Their
multi-agent research post says agents
use around four times more tokens than
chat and multi-agent systems about 15
times more tokens than chat. But, when
is using sub-agents actually worth it?
The answer is when three things are
true. The output is high volume, you
will not need the detail again, and the
session is going to continue for many
more turns. And that third one is the
whole game because those 5,700 tokens
you avoided would have been resent on
every remaining turn. But, if you
delegate and then immediately end the
session, you just paid extra for
nothing. One free upgrade if you do
this, set the sub-agents model to Haiku.
That is a five times reduction on the
isolated work and it does not touch your
main session's cache. And that brings me
to picking models properly, where
there's a myth I want to kill. Half of
what you ask for is small. Rename these
files, write me a commit message, clean
up this list. The useful heuristic is to
use the dumbest model that will still
finish the job. But, remember fix two.
Pick the right model at the start of the
session. Switching mid-session costs you
more than the saving. The better way to
do this is per skill and per sub-agent.
So, you can run Haiku for the grunt work
without ever touching your main session
model and without invalidating anything.
Every fix so far assumes you are sitting
at the keyboard. The next one is what
happens when you're not. This is the
trap I promised you at the start. A
scheduled task fires on its interval
whenever you are there or not. And every
time it fires, it sends your full
context, not a bit of it, all of it. So,
if that task is attached to a bloated
session, you're paying for that entire
context on every fire forever at 3:00 in
the morning, while you're asleep. Now,
here is the part that turns it from
expensive to painful. Your cache
expires. On a subscription, it lasts 1
hour. So, if your task runs less often
than once an hour, every single fire
misses the cache and reprocesses your
whole context at full price, instead of
the 1/10 cache price. 10 times the cost
on a schedule, forever. So, how often
your task runs is a real cost setting.
If your task can run every 45 minutes
instead of every hour or 2 hours, it is
cheaper to run it more often. And while
I'm here, a correction on the opposite
claim. People say leaving Claude code
open in the background burns your
limits. Anthropic's documents background
usage at under 4 cents a session. That
is not your problem. Your scheduled
tasks are your problem, and your live
agent teams, because each one keeps
consuming until it exits. That is the
one that doubles your bill without you
touching the keyboard even. And those
are the seven that burn your token
consumption number. So, let me clear out
the advice that does not, because some
of it is actively wrong. All right,
let's talk about what does not work.
Number one, writing shorter prompts. In
my logs, everything I actually type came
to 0.01%
of the bill. Your prompt length is a
rounding error. Vague prompts do cost
you, but through the file reads and the
rework they trigger, not through length.
Number two, compacting to save tokens.
This one is backwards. To write you a
summary, it has to send your entire
conversation one more time. So, the
thing you did to save money is the
single most expensive message of the
session. And then it wipes your cache on
purpose, because the conversation is
summarized is no longer exists. Clearing
is free. Compaction buys you continuity,
not savings. And if you only want to
undo a few back turns, use {slash}
rewind instead. Rewind takes you back to
a point your cash already knows, so
nothing has to be reread. Number three,
screenshotting text to save tokens. A
picture is not cheaper than the words in
it. On Opus 5, one screenshot of your
screen costs you about 2,700 tokens. A
4K one is nearly 5,000. That is a lot of
text. Paste the text instead. It is
cheaper and your agent can actually edit
it. It cannot edit a picture though. And
finally, PDFs, while I'm on format.
Every page of a PDF costs you between
1,500 and 3,000 tokens just for the
words on it. And then your agent also
takes a picture of that page and you pay
for that picture, too. You basically pay
for every page twice. Ask your agent to
turn it into a plain text file first and
the same document costs you about a
quarter as much. And there is one last
thing you need if any of this is going
to stick. Four things, three of them are
already sitting in your terminal and you
have probably never opened them. {slash}
context. This is the one you're going to
use the most. It shows you what is in
your window right now, line by line, so
you can see exactly what is taking up
the room. Then we have {slash} usage.
This one is underrated. It shows you how
much of your plan you have burned
through. And then it tells you what
burned it, not roughly. It names the
specific skill, the specific tool, the
specific agent. So if one thing on your
machine is quietly eating your limits,
this is where it confesses. Then inside
of that, you have what is this one
session costing you? The cost or slash
cost. And how much of it was your agent
re-reading history versus doing new
work. And the fourth one is the burn
rate meter that is in the corner of your
cloth code screen. Having a number
moving while you work changes your
behavior more than any rule I have given
you. And if you want the number I opened
this video with, it is sitting on your
machine right now. Every session you
have ever run is logged in a folder. And
every single reply in there records what
it costs. So, ask your sub agent to go
read them and work out your own
percentage. That is literally what I
did. And then, you have your number
instead of mine. You did not run out of
tokens because you asked too much. You
ran out because almost everything you
paid for was your agent re-reading
things you already sent, and nobody ever
showed you where the switch was. So, now
you know. Clear between jobs because it
is free and it resets the base
everything else is a fraction of. Pick
your model and effort once and leave
them alone because the thing you do when
you are trying to save money is the most
expensive move on the board. Filter your
tool output before it lands. Disconnect
the tools you never use and check that
line in context stays deferred. Delegate
when the session has a long way left to
run and not when it does not. And go
look at what your scheduled tasks are
doing at 3:00 in the morning. One honest
note to finish on, the labs are not
going to fix this for you. Not because
they're being difficult, but because
they're not graded on how few tokens you
use. It is your desk. You have to keep
it clean. The token usage audit prompt
is in the description and I would run it
once a week or whenever you feel you've
been burning through a lot of your
tokens fast. Things drift, you add a
server, you install a plugin, you change
a setting, and 6 weeks later you are
back where you started wondering why you
are hitting limits again. Comment below
with what shocked you the most in this
video. And if you enjoyed this video,
make sure to leave a like. And if you're
new to my channel, then subscribe
because I have a ton more content like
this coming your way. And oh, what would
you know? Over here, the algorithm gods
seem to think that you will really enjoy
this video. So, click it, and I'll see
you there.
Ask follow-up questions or revisit key timestamps.
Este vídeo explica por qué los usuarios de Claude Code agotan rápidamente sus límites de tokens, revelando que la mayor parte del consumo proviene de la relectura constante del historial de chat, no de lo que el usuario escribe. El autor proporciona una guía práctica para auditar la configuración de Claude Code y detalla siete estrategias clave para optimizar el consumo de tokens, incluyendo el uso frecuente de /clear, mantener configuraciones constantes para no romper el caché, filtrar salidas de herramientas innecesarias, gestionar los conectores de herramientas, usar sub-agentes solo cuando sea necesario, y optimizar las tareas programadas que se ejecutan en segundo plano.
Videos recently processed by our community