← All articles

Measurement

What Claude Code Actually Costs: Where the Tokens Go

The plan table is the easy half of the pricing question. The expensive half is what a session does to your context, turn after turn — and that part can be counted.

Written by Ted Mavera, Product Manager at HarnessUp, the company that makes the tool described here. The texts on this blog are written with the help of artificial intelligence and reviewed by the team before publication.

A metal machine feeding pages in a loop through a glowing violet aperture, beside a glass drawer of cached pages, with a single sheet resting on the floor.

Why this article exists

Search for what Claude Code costs and you get the same page forty times: a table with the plan tiers, a paragraph about limits, and a verdict that depends on what the writer happened to be building that week. The table is correct and almost useless. It answers what you pay to get in. It does not answer why Tuesday's session felt three times heavier than Monday's, on the same plan, in the same repository.

The second question has an arithmetic answer, and that answer is on your machine already. This piece walks through it: what a turn actually re-sends, which of the four lines on the invoice dominates, and where the waste hides in ordinary work. We will keep the product out of the way until the last third, because the method stands without it — and because a cost breakdown that only works if you buy something is not a breakdown.

The one multiplication that explains the bill

A turn is one round trip to the model. Everything in the conversation so far goes with it, unless the harness compacts or you start over. That is the whole trick, and it is the reason a file read once is not paid once. Our documentation puts it in one unit, the token-turn: tokens multiplied by the number of turns a piece of content survives in context.

8,000 tokens × 30 turns = 240,000 token-turns
15,000 tokens × 37 turns = 555,000 token-turns

Read that twice, because it reorders the intuition most people bring to this. A tool that writes less code is not the one that saves the most. A tool that removes from context what has already been used is. A 15k file that arrives on turn 4 and never leaves costs more than three times a 8k file that arrives on turn 1 — and the second one is the one people usually try to optimize.

Four lines, not one: what the invoice is made of

Anthropic's invoice splits input into three bands: new input, cache write and cache read, plus output. The split matters because the three input bands are not priced the same, and because they move in opposite directions as a session grows. Cache reads cost a fraction of the base input price, which sounds like a bargain until you remember that a cache read happens on every turn. Cache writes cost more than plain input and only pay for themselves if the block gets read again before the cache expires.

That deadline is the part most pricing posts leave out. A prompt cache is a lease with a short term, and the meter resets when it lapses. The cache timer in the Utilities demo exists for exactly this: it shows a warm cache going cold after a few idle minutes, so you can watch the moment a long lunch quietly raises the price of your next turn. The percentages change with the price list; the mechanism does not.

Practically, this is why two sessions with the same number of prompts can cost very differently. One keeps a stable prefix and stays warm. The other edits files at the top of the context, breaks the prefix on every third turn, and pays to write the cache again each time.

Four translucent columns of light stacked on a dark desk, three narrow ones and a wider one, each marked with a different small counter and joined at the base.
Four lines, one invoice: new input, cache written, cache read and output.

Where the tokens actually go

Five categories account for most of the avoidable weight in a normal working day. None of them is exotic. All of them are visible in the local transcript after the fact.

1. The context that keeps being re-read

Every message you send drags the whole conversation behind it. At turn 40, the file you opened at turn 3 is still boarding the train, still taking a seat, still being charged. The usual fix — a new session — does work, but people pick the wrong moment: they restart when the conversation feels long instead of when the cost per round crosses the cost of rebuilding the context. Those are different points, and only one of them is where renewing pays off.

2. The whole file for one function

Asking an agent to fix validate() usually delivers the entire auth.ts. Then the whole file stays in context for the remaining turns, most of it irrelevant. The same waste appears in the other direction: a search that returns six hundred matching lines when the first twenty were enough to decide.

3. Tool output nobody reads

A test run that prints nine hundred lines, a build log from a monorepo, the HTML of a documentation page fetched to check one parameter. The transcript keeps all of it. The model reads all of it on the next turn whether it needs to or not.

4. Turns spent discovering the code does not compile

An edit lands, the agent says it is done, you ask for the next thing, and only then does someone run the build. Now there is a round trip to discover a syntax error that a compiler would have reported in two seconds, plus another to fix it, plus the cost of both staying in context. On a normal afternoon this is the quietest line item of the five and, in our experience, the most annoying to watch.

5. The answer with a preamble

"Great question — let me walk through what I'm going to do." It costs output tokens once and input tokens on every turn afterwards, because the answer is now part of the history. Multiply a habit by forty turns and it becomes a line on the invoice.

What the plan tier changes, and what it does not

Claude Code plans are metered in windows — five-hour blocks and a weekly ceiling — and that structure is the reason the pricing conversation keeps going in circles. A bigger plan buys headroom at a higher price. It does not change the fact that a 15k file costs 15k on every turn, and it does not make a re-read cheaper. Upgrade enough times and the waste scales with the plan.

The honest version: if your work is genuinely large, a bigger plan is the correct purchase. The question worth asking first is whether the work is large or the context is just heavy. Those look identical from the outside and have very different fixes.

Measure before you decide anything

The reason this article can be specific is that the numbers are local. Claude Code writes transcripts to disk, with real token usage per turn, and a measurement layer can read them without sending anything anywhere. Our Metering front exists for that and is free: Deep Scan walks the saved conversations and breaks the spend down by source, Harness History opens the receipt for each closed session, Inside the Wallet splits new input, cache read, cache written and output by model, and Plan Usage shows what each window yielded before the limit renewed.

Start with the ugliest session of last week, not with an average. Averages hide the shape of the problem, and the shape is what you can act on: one giant file read at turn 2, one log in the middle, one answer that rambled for six hundred tokens and then got re-read thirty times.

Where HarnessUp fits

This is the part where we sell something, so it comes with the number and the plan it requires. HarnessUp is a local layer that acts through the official hooks of Claude Code and Codex — not a proxy, not an MCP server, nothing that reads your token or your key. It has 151 tools across ten fronts, and a good part of the Savings front maps one to one onto the five categories above.

Renew Session marks the turn where continuing costs more than restarting, and in a counterfactual measured on real history the switch reached 73% of paid context. Code Finder returns the skeleton of a large file on the first read and the body only on request; Delta Read refuses the stretch of a file the agent has already seen; Head Limit caps a grep that returns an encyclopedia; Terminal Guide and Output Diet keep the beginning, the end and the error lines of a long log. First Pass compiles right after the edit, so a broken build travels with the next turn instead of costing one of its own. Response Diet cuts the warm-up text. Memory State rotates the context file into immutable fragments and measured 4.27% of context with 298 turns of survival.

The largest figure we have is less glamorous and more useful: Build Now, which runs the build at the end of a message without spending a model turn, recorded 2,769 builds and 806.7M input tokens re-read that did not happen. None of these numbers are yours. They are what the instrument measured on the machines that ran it, which is the honest way to present a counterfactual — and why the panel shows your own cuts separately from the estimate.

What this breakdown does not promise

Not every token in a session is waste, and a tool that claimed otherwise would be lying to you in a way that is easy to check. Reading a file you need is not waste. Re-reading it on the next turn is a tax you pay for the model's memory, and some of that tax is the price of the work. The point of the arithmetic is narrower: separate what the task demanded from what the harness tolerated, then decide which of the two you want to pay for.

It also does not promise that a cheaper session is a faster one. Compressing a log or cutting a preamble changes what the model sees, and there are cases where the detail you cut was the detail that mattered. That is why every tool here is reversible, and why the measurement layer is free: you should be able to see the trade before you take it.

Start with your own bill. Install HarnessUp free, run Deep Scan on last week's sessions, and find the one line that should not be there.

Install free