AI & Technology · Explainer
An AI agent re-reads its whole conversation on every turn, so its cost climbs with the square of the work. The largest savings come from paying less for that re-read. Sending fewer tokens and generating fewer come after.
lower cost per task from prompt caching on a deep-research benchmark, Claude Fable 5.1
off every token sent through Anthropic's Batch API, cached ones included
fewer tool-definition tokens when tools load on demand through tool search
added to the cost of a short task by context editing, a feature sold as a token saver
The problem
A large language model keeps nothing between requests. To continue a conversation, the application sends the whole thing again: the system prompt, the tool definitions, every earlier message and every tool result.
A 40-turn agent task sends its first turn 40 times.
So the input bill grows with roughly the square of the number of turns. Output costs more again: on every current Claude model an output token is priced at five times an input token. Claude Opus 5.5 lists at $4 per million input tokens and $20 per million output tokens.
The chart prices one such task. It is a simplified model built on our own assumptions, not a measurement: a 5,000-token system prompt, 55,000 tokens of tool definitions, and each turn adding 3,000 tokens of tool results and replies, 800 of them written by the model. Sent as is, the 40 turns cost $19.60 at Claude Opus 5.5 list prices. With prompt caching turned on, the same task costs $2.44, 88 percent less. Adding tool search brings it to $1.78.
Without caching, every turn buys the whole conversation again
Cumulative cost of one agent task, turn by turn. Change the settings to price your own loop.
for 40 turns on Claude Opus 5.5, 88% less than the same task sent as is ($19.60).
Simplified model. Assumes each turn starts within five minutes of the last, so cached entries stay warm; one cache write per turn for the new content; tool search loading about 3,500 tokens of definitions. Leaves out thinking tokens, retries and tool fees. Claude Haiku 5.5 requests over 100,000 tokens bill at five times the rate, which the model includes.
Prices: Anthropic pricing, accessed 28 Nov 2026. Model and assumptions: vizmaya.
Our example has a heavy fixed prefix, so caching saves more than usual. Measured tasks show a smaller gap that is still large. Priced without the cache discount, Anthropic's runs on the SWE-bench Pro coding benchmark would have cost 3.3 times as much on Claude Opus 5.5, and a small bug-triage agent 7.3 times as much on Claude Sonnet 5.5. Short sessions gain least: 1.7 times on a set of short Claude Haiku 5.5 sessions.
The overhead
Much of each request is fixed overhead. For many agents the largest part is tool definitions: every tool's name, description and input schema is sent on every turn, whether or not the model uses it.
Five MCP servers add about 55,000 tokens before the first question
Tokens taken by tool definitions, by Model Context Protocol (MCP) server
Source: Anthropic, Introducing advanced tool use for Claude, 24 Nov 2025.
Anthropic counted 58 tools across five MCP servers at about 55,000 tokens. Adding Jira costs another 17,000 or so, and the company said tool definitions inside its own systems had reached 134,000 tokens before it optimized them.
Attachments are the other hidden weight. Claude reads images in 28-by-28-pixel patches, so cost follows resolution, not content: a 1280×720 screenshot is about 1,200 tokens, while a 4K screenshot on the high-resolution tier is 4,784. A spreadsheet pasted into a prompt can run to tens of thousands of tokens on every turn.
Fix 1 · Don't pay twice
Prompt caching stores the start of a request on the provider's servers. When the next request begins with exactly the same bytes, that part is billed at a fraction of the input price. The conversation is still resent; it is just repriced.
Reading from the cache costs 0.1 times the base input price on most Claude models, 0.05 times on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025 times on Claude Fable 5.2. Writing to it costs 1.25 times the base price for five minutes of storage, or twice the base price for an hour. A five-minute entry pays for itself after one read, a one-hour entry after two.
Caching cut a deep-research task's cost by 80 to 86 percent
Average cost per task on DeepResearch Bench II, the same runs priced with and without the cache discount, US dollars
Source: Anthropic, Optimizing for cost and intelligence, accessed 28 Nov 2026. Anthropic-internal runs; the company calls them directional.
On DeepResearch Bench II, Anthropic priced the same runs both ways. Claude Fable 5.1 fell from $40.58 to $5.64 a task, and Claude Sonnet 5.5 from $5.13 to $1.05. Those runs read 89 to 93 percent of their input from the cache.
That share is the number to watch. Over a full day of real traffic, Anthropic says agent loops read a median 84 percent of their input from the cache, and the best tenth read 94 percent or more. Below about 80 percent, something is usually breaking the cache.
Most of these have one fix: put stable content first and anything that changes per request at the end.
Fix 2 · Let it wait
Work nobody is waiting on, such as evaluations, back-fills, nightly reports and bulk tagging, can go through a batch API. Anthropic's Batch API takes 50 percent off every input and output token in exchange for results within 24 hours, and the discount stacks with cache pricing.
The catch is shape. Each batch request is a single call, so an agent that loops through tools has to be restructured, for example by fetching its inputs up front, before it can use the discount.
Fix 3 · Send less
With tool search, the model starts with a small search tool and pulls in the three to five definitions a task needs. In Anthropic's example the starting context fell from about 77,000 tokens to 8,700, an 85 percent cut. Accuracy on its MCP evaluations rose too, from 49 to 74 percent for Claude Opus 4 and from 79.5 to 88.1 percent for Claude Opus 4.5.
In a separate cost test on an earlier model, with up to 502 tools available, a bug-triage run cost rose from $0.55 to $1.02 when every definition was loaded and stayed at $0.56 with tool search. Anthropic suggests it once definitions pass about 10,000 tokens, with the most-used tools kept loaded.
With programmatic tool calling, the model writes a short script that calls several tools and hands back only the filtered result. On complex research tasks, Anthropic measured average usage falling from 43,588 to 27,297 tokens, 37 percent less.
The same idea works for data. Anthropic asked 25 questions about one table. Pasted into the prompt, the table was about 91,000 tokens per request, and Claude Sonnet 5 answered 7 questions correctly for $5.01. Uploaded and queried with code execution, it answered all 25 for $0.40.
For retrieved documents and transcripts that differ on every request, a small model can strip low-information words before the large model reads them. Microsoft Research's LLMLingua reported up to 20 times compression with little loss of performance. Its successor, LongLLMLingua, used about four times fewer tokens and raised accuracy by up to 21.4 percent on the NaturalQuestions benchmark. Compressed text changes each time, so it belongs after the cached prefix, never inside it.
Downscale images to what the task needs. Send the passages a retrieval step finds instead of whole documents.
Fix 4 · Manage the context
Three techniques shorten what a long session carries forward. Anthropic tested them on short and long runs of a triage agent, on an earlier model. They paid off only when the session was long enough to need them.
Summarizes earlier turns once the conversation nears a size threshold, 150,000 tokens by default on Claude. Saved nothing on the short run.
The agent's own code swapped bulky old search results for one-line extracts. Anthropic advises against it on its newest models, where rewriting earlier turns discards the model's saved reasoning.
Clears old tool results to free room. Each clear rewrites the cached conversation, so on the short run it cost more; on the long run it changed nothing.
Context editing's launch figures look better because they measure something else. In a 100-turn web search evaluation it let agents finish work that would otherwise have run out of room, used 84 percent fewer tokens, and improved task performance by 29 percent, or 39 percent alongside a memory tool. Fewer tokens in the window is a different thing from a smaller bill once caching is on. Use it to make room, and clear in a few large batches.
Fix 5 · Generate less
Output tokens cost five times as much as input tokens on current Claude models, and the model's reasoning is billed as output. Three levers shorten it.
Ask for the format and length you need, ideally with an example. A hard cap on output is a poor substitute: a response that hits it stops mid-thought and usually has to be redone. In Anthropic's tests, only 7 of about 18,000 turns ran past 64,000 tokens.
Newer models take an effort setting that governs how much they think and how many tools they call. On a subset of the SWE-bench Pro coding benchmark, Claude Opus 5.5 solved 87.4 percent of tasks at low effort for $0.11 each, and 95.3 percent at high effort for $0.29.
Re-running only the failures beat every fixed effort setting
Claude Opus 5.5 on a SWE-bench Pro subset: share of tasks solved against cost per task, by effort setting
| Setting | Tasks solved | Cost per task |
|---|---|---|
| low | 87.4% | $0.11 |
| medium (default) | 92.8% | $0.21 |
| high | 95.3% | $0.29 |
| xhigh (one run) | 96.7% | $0.74 |
| low, failures re-run at high | ~97% | ~$0.17 |
| medium, failures re-run at high | ~97% | ~$0.24 |
Source: Anthropic, Optimizing for cost and intelligence: tune effort and re-run failures, accessed 28 Nov 2026. Re-run costs include the failed first attempts.
Running every task at low effort and re-running only the failures at high solved about 97 percent of tasks for about $0.17 each. That is slightly more than running everything at high, for about 40 percent less. It needs a reliable failure signal, such as tests, and the failures take twice as long.
The prompt matters as well. In a 2025 paper, Silei Xu and colleagues asked models to write terse "chain of draft" notes instead of full step-by-step reasoning. It matched or beat chain-of-thought accuracy while using as little as 7.6 percent of the tokens.
Fix 6 · Choose the model last
Model choice changes what the system can do, so it comes after the savings that cost nothing in quality. Compare models on cost per completed task, not price per token. A cheaper model that fails still bills its tokens, then the retry, then whatever the failure costs downstream.
Cost per solved task moving from Claude Opus 5 to Claude Opus 5.5 on the SWE-bench Pro subset, with about the same score: 91.9% to 92.8%.
Claude Opus 5.5 at low effort solved 87.4% for $0.12 per solved task; Claude Sonnet 5.5 at its default solved 87.6% for $0.11.
Claude Haiku 5.5's cost per correct answer on GPQA Diamond, against Claude Opus 5.5. It scored 85% to Opus's 91%.
Routing each request to the cheapest model likely to handle it is the step after that. In the 2024 RouteLLM paper, Isaac Ong and colleagues trained routers that cut costs by more than half in some benchmark settings without lowering response quality.
Two cautions apply. Caches belong to one model, so a cascade gives up cache reuse between its models. And a few hard tasks carry most of the spend: on 20 WideSearch problems, the two costliest accounted for 43 percent of the bill. Those are exactly the tasks a cheaper model is most likely to fail.
Reading the numbers
No. The published figures measure different things, from token counts to dollar cost to list price, on different tasks. Several also claim the same tokens: caching a document and deleting it cannot both save its cost. Treat each as a direction, then measure on your own traffic.
Published savings run from 95 percent to minus 73 percent
Reported reduction for each technique, as its source measured it. Bars to the left of zero mean the cost went up.
Sources: Anthropic pricing and cost guide (accessed 28 Nov 2026); Anthropic, Introducing advanced tool use (Nov 2025) and Managing context on the Claude Developer Platform (Sep 2025); Jiang et al. 2023 (LLMLingua, LongLLMLingua); Xu et al. 2025 (Chain of Draft); Ong et al. 2024 (RouteLLM). Links under Sources & method.
The playbook
Start with the changes that lower cost without touching quality, and keep the trade-offs for last. Judge every change by cost per completed task.
Turn on prompt caching.Keep the start of every request byte-identical and check that at least 80 percent of input is read from the cache.
Batch what can wait.Anything nobody is waiting on goes through a batch API at half price.
Trim what you send.Load tool definitions on demand past about 10,000 tokens, query data files with code instead of pasting them, downscale images, compress long retrieved text.
Manage long sessions.Compact sessions long enough to need it; use context editing to make room, not to save money.
Shape the output and sweep effort.Specify the answer's form, test lower effort settings, and re-run failures at a higher one where you can check results.
Choose the model last.Upgrade to the newest model in your tier, then compare models and routers on cost per completed task.
The same rules hold when the agent is your own coding assistant. Start a fresh session for each task, compact long ones, keep the project instructions file short, and let rarely used MCP tools load on demand.
Token prices keep falling, yet bills keep rising because agents use far more tokens per task. Our earlier story AI tokens fell 1,000x in price. Bills kept climbing follows that paradox, and Why AI forgets explains the context window these techniques are fighting over. More in vizmaya's AI and technology stories.
Method. The interactive chart is a simplified cost model, not a measurement. It assumes a 5,000-token system prompt, the chosen size of tool definitions, 3,000 new tokens per turn of which 800 are model output, every turn starting within five minutes of the last, and one cache write per turn for new content. Tool search is modelled as about 3,500 tokens of loaded definitions (a 500-token search tool plus three to five tools). Thinking tokens, retries and server-tool fees are left out. Percentages in "Do these savings add up?" are each source's own best reported figure, measured on different tasks and units; they are not additive. Prices are Anthropic list prices for its first-party API on 28 November 2026.