Your session's context is what you pay for, on every single turn. This puts the number where you'll see it — and tells you when to /clear.
One session, start to finish. Green under 150K tokens, yellow past it, red past 350K.
$ git clone https://github.com/mcancellotti/tokendiet $ cd tokendiet && python3 install.py
Copies the script into ~/.claude/ and sets the statusLine block in settings.json, leaving the rest of your settings alone — with a backup next to it. On Windows the same installer runs as python install.py. Python 3.8+, no dependencies, MIT.
I tried to cut my own bill the obvious way: asking for shorter replies. Then I measured my five largest sessions. Output was about a tenth of the spend, and only a quarter of that was prose. I had been optimizing roughly 1.5% of the bill.
The driver is session length, not verbosity. Every turn re-sends the accumulated context, so a session that has grown to 500K tokens pays for 500K on every turn, whether the answer is three words or three pages. Cost grows quadratically with how long you stay. The lever is knowing when to clear.
Most context meters show how full the window is. That number is real, but it isn't the one attached to your card. Here is the same 500K session, read both ways.
Reads as plenty of room left. Nothing here suggests you should stop.
Same session. Every question you ask from here costs two and a half times what it cost at 200K — until you clear.
So the colours key off absolute token counts, not percentages: yellow at 150K, red at 350K. The bar still fills relative to the window, because knowing how much room is left is useful too. It just isn't what determines the bill.
The bar tells you where the session stands. The second line tells you what it means for the next thing you type — the turn that just finished, set against the first turn of the session.
Nothing there is modelled or predicted. A turn's cost is the difference between two readings of the session total, and the multiplier is that figure measured against the first turn that cost anything. It is the argument on this page reduced to a single number, taken from your own session: the question you are about to ask costs nearly seven times what the same question cost ninety minutes ago.
The multiplier stays hidden until it passes 1.15x — a line that prints 1.0× every turn is a line people stop reading.
A statusline is drawn by your terminal. It never enters the conversation, so watching your spend does not add to it.
The alternative would be a hook injecting a warning into the context on every prompt — paying for that warning in input tokens each turn, out of exactly the budget it exists to protect. And no automation can run /clear for you: it's a harness command, not something a hook or a skill can invoke. Whatever you build, a human makes the call. The job is to put the number in front of that human as cheaply as possible.
| Variable | Default | Effect |
|---|---|---|
| TOKENDIET_WARN | 150000 | Tokens at which the bar turns yellow |
| TOKENDIET_HIGH | 350000 | Tokens at which it turns red |
| TOKENDIET_TURN | 1 | Set to 0 to drop the per-turn second line |
| NO_COLOR | unset | Set to anything to drop the colour |