Agent loops bill every turn: the model re-reads a growing transcript, calls tools, and appends results. Move one slider and this page recomputes the whole run turn by turn, then shows where prompt caching stops paying and retries double the bill.
Turn i re-sends the full transcript: the system prompt plus every tool record from turns 1 through i-1, then adds this turn's new tool records. The context therefore grows linearly, and turn N is always the most expensive one. Output tokens are generated once per turn and never re-billed; input tokens are billed every time they are re-read.
With caching on, only the first turn pays a full-price cache write (1.25x input rate at a 5-minute TTL, 2x at 60 minutes). Each later turn re-reads the stored prefix at 10% of the input rate, as long as the gap since the previous turn is inside the TTL. A gap past the TTL expires the cache, so that turn writes it again at full price.
Caching is not automatically profitable. A cached read is cheap, but the write costs a premium (25% extra at the 5-minute TTL). Break-even needs the discount to outweigh that premium over the remaining turns: with a write premium of 25% and reads at 10%, caching pays off once the prefix is re-read more than r > (w-1)/s = 0.278 times per write, where w is the write multiplier and s the read discount. Runs of ten or more turns usually clear that bar easily; a one-shot call never can.
Each tool call succeeds with probability p or is retried, up to R times. The expected number of attempts for one call is the finite series E = sum_{k=0..R} k * p^(k-1) * (1-p) + (R+1) * p^R * (1-p) + p^(R+1)... simplified: when retries always eventually succeed within the cap, the expected attempts per call are (1-p^(R+1))/(1-p). Tool records from failed attempts also enter the transcript, so retries raise both the token count and the re-read cost of every later turn.
Rate-limit premiums, batch discounts, model routing, and per-provider overhead are out of scope. Prices are entered by you against the rates shown in the model list; if your negotiated rates differ, type them in and the run re-prices instantly.
Because the transcript is re-sent on every turn. After nine turns of three tool records at 800 tokens each, turn ten carries about 24,000 tokens of history plus the system prompt, and every one of those input tokens is billed again.
Once the prefix is re-read enough times per write. At Claude's list terms (write premium 1.25x, read discount 0.1x) the break-even is a bit over one extra re-read per write; anything longer than a handful of turns is comfortably past it. A single-turn call should leave caching off.
At a 95% success rate and a cap of two retries, expected attempts per call are about 1.05, small. At 70% success the expectation climbs past 1.4, and every failed attempt still writes its tool record into the transcript, which every later turn then re-reads at full input price.
They are common list rates as of mid-2026 and they are editable. Check your provider's pricing page before relying on a budget figure; this tool models arithmetic, not tariffs.