Anthropic publishes a sample session in its own cost documentation. A little over six minutes of API time, 5,300 tokens of output, and a running total of $0.55.

Nine hundred and forty thousand of that session's input tokens were served from cache. Price the same session with the cache cold every time, and the identical work costs $3.80.

Nothing about the request changed. The difference is entirely when the messages were sent.

What you are actually paying for

An AI coding agent has no memory between requests. To answer your next message it re-sends the whole conversation: the system prompt, your project instructions, every file it has read, every command it has run and everything those commands printed. A one-line follow-up in an hours-old session is not a one-line request.

That would be ruinous, so every major vendor caches it. The part of the conversation the model has already processed is stored, and re-reading it is priced at a tenth of normal input. Anthropic, OpenAI and Google all landed on the same number: a cache read costs 0.1× the input rate. New material added to the cache costs a premium instead — 1.25× on Anthropic, and on OpenAI from GPT-5.6 onwards.

A long session is not inherently expensive. While the cache stays warm, most of the conversation is re-read at a 90% discount.

The 12.5× moment

Caches expire. When yours does, the next message cannot re-read anything — the whole accumulated conversation has to be processed again and written back. You pay 1.25× where you would have paid 0.1×.

That ratio is a fixed number: 12.5. It is identical on Opus, Sonnet and Haiku, because both the write premium and the read discount are fixed multiples of whatever the base input rate happens to be. A cheaper model does not soften it. It scales the whole thing down and leaves the ratio untouched.

What that costs depends only on how much conversation you have accumulated:

context     one expired break, Opus 5     on Sonnet 5
 20,000 tokens        $0.12                  $0.05
 50,000               $0.29                  $0.12
100,000               $0.58                  $0.23
150,000               $0.86                  $0.35
200,000               $1.15                  $0.46

Roughly a dollar, on Opus, to come back to a full session and type "yes". Not for the word "yes" — for re-reading everything that came before it.

How long you have

Cache lifetimes differ sharply, which is why the same working habit costs different people different amounts.

Claude Code, Pro/Max/Team/Enterprise    1 hour
Claude Code, on usage credits           5 minutes
Claude Code, API key or cloud           5 minutes
OpenAI, GPT-5.6 and later               30 minutes or more
Gemini 2.5 and later                    implicit, not published

One detail in your favour: that clock runs from the last time the cache was used, not from when the session started. Both Anthropic and OpenAI refresh it on every read, at no charge. An eight-hour session of steady work never goes cold. It is the gap that kills it, not the duration.

Read the first two lines together. The gap between them is where the money goes.

On a subscription you get an hour. The moment you exhaust your plan limit and continue on usage credits, that window becomes five minutes. The cache gets twelve times shorter at precisely the point where tokens start costing you money individually rather than coming out of a flat fee. The behaviour that was free all morning becomes the expensive one, and nothing announces the change.

At 150,000 tokens of context, a twenty-minute break costs $0.075 on the subscription side of that line and $0.94 on the other. Same break, same session, same work.

Anthropic does let you buy the hour back — the one-hour cache is available at a 2× write premium instead of 1.25×. If your gaps regularly outrun five minutes, the longer cache is worth the premium. Three requests spread across an hour cost 41% less on the long cache than on the short one, and that figure holds whatever your context size and whichever model you use.

What a day of this looks like

Take a forty-turn session that starts with 12,000 tokens of setup and gains about 3,500 tokens a turn — a normal working day with a normal agent, ending around 150,000 tokens of context.

breaks past the cache window     total       of which re-reading
  0                              $1.46            $0.00
  4                              $2.12            $0.66   (31%)
  8                              $2.94            $1.48   (50%)
 16                              $4.09            $2.63   (64%)

Eight interruptions across a working day is not a lot. Lunch, a couple of meetings, a code review, and the several times you stop to read what the agent just wrote. At that rate half the bill is re-reading material you already paid to read.

On a five-minute cache, sixteen is closer to a typical day, and roughly two thirds of that spend buys nothing new.

Three things this changes

"Don't let it read big files" is overstated. A 25,000-token document — a hundred kilobytes of API reference, say — costs about five cents to carry through the next ten turns while the cache is warm. That is not the problem people think it is. What the big file actually does is raise the price of every subsequent cache miss, because it is now part of what gets reprocessed. The file is cheap; the file plus a coffee break is not.

"Long sessions are expensive" is the wrong half of the sentence. Length is billed at the discount. Discontinuity is billed at the premium. On the same model as the table above, four hours worked straight through comes to $1.88 across forty-eight turns; two hours taken in twelve ten-minute visits comes to $2.13 across twenty-four. Half the work, more money.

Compacting is not free. Compaction rewrites the conversation, which invalidates the cache by design — the tool is doing to you deliberately what a coffee break does to you accidentally. It is often still worth it, because it makes every later turn smaller. But it is an investment with an upfront cost, not a saving, and running it reflexively on a session that was about to end is pure loss.

What actually helps

Finish the thought before you walk away. The cheapest possible habit is to send the next message before the window closes, and the second cheapest is to close the session properly instead of leaving it open across a two-hour gap. Coming back to a stale session is where the money actually goes.

If you are on an API key, buy the hour. A 2× write premium that removes most of your misses pays for itself, and the three-request comparison above — 41% less on the long cache — is the size of the effect.

Watch for the moment your plan tips into credits. That is when the five-minute window arrives, and it arrives silently.

Clear rather than compact between unrelated tasks. Starting fresh costs nothing. Summarising a conversation you are about to abandon costs a full read of it.

Keep the always-loaded material small — project instruction files, tool definitions, unused integrations. Not because it is expensive to re-read, but because it is expensive to re-write, and it sits at the front of every rebuild you ever trigger.

Check your own

Claude Code reports this directly. Run /usage and look for the prompt cache line, which gives the share of input tokens served from cache, the number of misses, and whether the cache is warm right now:

Prompt cache (main): 14 requests
  · 91% of input tokens from cache
  · 2 misses
  · warm (1h TTL, last activity 40s ago)

Ninety-one percent from cache is a healthy session. If that number is low, or the miss count climbs through the day, the cost is going somewhere other than the work. The plan-usage breakdown flags cache misses on its own once they account for a tenth or more of recent usage.

Where this comes from, and what will date

Every price, multiplier and cache lifetime here was read from vendor documentation on 29 August 2026: Anthropic's pricing and Claude Code cost pages, OpenAI's prompt caching guide, and Google's Gemini context caching documentation. The $0.55 session is Anthropic's own published example; the $3.80 is that same example recomputed with all 990,000 input tokens priced as cache writes.

The arithmetic is exact, the session is a model. Reproducing Anthropic's published example to the cent is a check on the pricing maths, not evidence that any particular day looks like the one tabulated above. Context growth of 3,500 tokens a turn is a plausible figure, not a measured one, and your own will differ.

All of this is per-token reasoning. On a flat subscription within your limits you are not billed per request, so the effect shows up as your allowance draining faster rather than as a charge. The dollar figures apply directly to API keys, cloud providers and usage credits.

One asymmetry the table flattens. Google charges to hold an explicit cache — half a dollar per million tokens per hour through 2026 — where Anthropic and OpenAI charge only to write and read one. It does not affect the figures above, because the implicit caching a coding agent gets by default carries no storage fee, but it matters if you are building on the API rather than typing at an agent.

Cache lifetimes are the least stable thing here. They are operational settings, they have changed before, and OpenAI's own wording is a floor rather than a promise. Treat the table as what the vendors said in August 2026 and check it against the current documentation before making a decision that depends on it.

Three vendors is not the market. Cursor, Copilot, Windsurf and the rest sit on top of these same models, and inherit this behaviour, but each adds its own routing and its own billing on top. The mechanism carries over. The numbers do not.