Tokens Per Task: The Real AI Cost Model in 2026
TL;DR
Dollars per million tokens is a marketing axis. Tokens per task is the cost axis, and the two disagree more often than they agree. Terminal-Bench 4.0's maintainers published the proof: Claude Sonnet 5 consumed 21.6 billion tokens on its leaderboard run against 6.5 billion for Claude Opus 5, and scored 12.4% ±3.1 against Opus 5's 51.8% ±3.4 on the aggregated board. Sonnet 5's input price is 40% of Opus 5's, and it still spent 3.3 times the tokens for a quarter of the result.
Three things break the naive comparison. Claude 4.7 and later use a tokenizer producing roughly 30% more tokens for the same text, so Sonnet 5 at $2 against Sonnet 4.6 at $3 is about a 13% real saving rather than 33%. Prompt caching was repriced in 2026 at Anthropic and OpenAI, including a 1.25x charge on OpenAI cache writes that used to be free. And a growing share of the bill is not tokens at all — session runtime, container hours, web searches and per-hour cache storage.
Here is how to measure the only number that matters: cost per completed task.
Tokens Per Task vs Cost Per Million Tokens
Every pricing comparison builds a dollars-per-million table and stops. That table is the least decision-relevant part, because a model does not consume a fixed number of tokens — it consumes however many it needs to finish, and that varies by multiples across models on identical work.
The published evidence is sitting on the Terminal-Bench 4.0 leaderboard. The maintainers reported that Sonnet 5 used 21.6 billion tokens on its run and Opus 5 used 6.5 billion, and that Sonnet 5 sometimes hit timeouts and output-token-exceeded errors along the way. On the aggregated board, Sonnet 5 under Claude Code at max effort landed at 12.4% ±3.1. Opus 5 under Claude Code at max effort landed at 51.8% ±3.4.
I will not convert those counts to dollars: the maintainers did not publish the input-output split, so any dollar figure would be a guess. The ratio is enough — 3.3 times the tokens for roughly a quarter of the completions.
The correct unit is this.
cost_per_completed_task =
(token_spend + runtime_spend + tool_spend, across all attempts)
/ tasks_that_actually_completedThree things in it are usually missing from cost models: all attempts rather than only successful ones, runtime and tool spend as separate SKUs, and a denominator precise enough for a machine to label.
The harness matters as much as the model here — I go through why a leaderboard row is mostly a scaffold measurement in Your Agent Benchmark Number Is Mostly Your Harness.
The Tokenizer Change That Makes Identical Text Cost 30% More
This is the single most consequential line on Anthropic's pricing page, and most dollars-per-million comparison tables still price as though it were not there.
Claude 4.7 and later models, plus Claude Mythos Preview, use a newer tokenizer that Anthropic states contributes to their improved performance — and that produces approximately 30% more tokens for the same text. Sonnet 4.6 and earlier use the old tokenizer.
Affected: Fable 5, Fable 5.1, Opus 5, Opus 4.8, Sonnet 5.
That makes every cross-generation dollars-per-million comparison wrong by about a third. Work the obvious case.
| Sonnet 4.6 | Sonnet 5 | |
|---|---|---|
| Input price per million | $3.00 | $2.00 |
| Tokenizer | older | 4.7-generation |
| Tokens for the same document | 1.00x | ~1.30x |
| Effective input cost for that document | $3.00 | ~$2.60 |
The headline says a 33% price cut. The real saving on identical text is about 13%. If you migrated from Sonnet 4.6 to Sonnet 5 and your bill did not fall by a third, nothing is broken — the model is reading the same text as more tokens. Your historical token series also has a step change at the migration that has nothing to do with your prompts.
The other price movement people missed
Claude Sonnet 5 launched on 30 June 2026 at introductory pricing. On 10 August 2026, Anthropic's API release notes recorded that the introductory $2/$10 per million became the standard price, and that the scheduled increase to $3/$15 on 1 September 2026 would not happen.
Any cost model built between the launch and that announcement, assuming input would rise to $3, is 50% too high on input. Check your spreadsheet before using it to argue for a cheaper model.
The September 2026 Price Tables
Everything below was read from the vendors' own pricing pages on 14 September 2026. These pages change without notice — Google's states that its 3.x Flash pricing runs through 31 December 2026 and doubles on 1 January 2027 — so re-verify before committing a budget.
Anthropic
| Model | Input | Output | 5m cache write | 1h cache write | Cache read |
|---|---|---|---|---|---|
| Fable 5.1 / Mythos 5.1 | $10 | $50 | $12.50 | $20 | $0.25 |
| Fable 5 / Mythos 5 | $10 | $50 | $12.50 | $20 | $1.00 |
| Opus 5 / Opus 4.8 | $5 | $25 | $6.25 | $10 | $0.50 |
| Sonnet 5 | $2 | $10 | $2.50 | $4 | $0.20 |
| Sonnet 4.6 / 4.5 | $3 | $15 | $3.75 | $6 | $0.30 |
| Haiku 4.5 | $1 | $5 | $1.25 | $2 | $0.10 |
All figures per million tokens, from Anthropic's pricing page↗. The Batch API takes 50% off in both directions. The general multipliers are 1.25x for a 5-minute cache write, 2x for a 1-hour write, and 0.1x for a read.
Fable 5.1 and Mythos 5.1 break that pattern: their cache read is $0.25 against a $10 input price, which is 0.025x, not 0.1x. Anthropic states the cheaper read cuts typical workload cost by around 25% and highly agentic workloads by up to around 45% — a vendor claim about its own product, so treat the range as directional. The $0.25 line item is published and checkable, and it changes the caching arithmetic.
OpenAI
GPT-6 Astra, from the OpenAI developer docs model page read on 14 September 2026: a 1,050,000-token context window with a 922,000 maximum input limit, 128,000 maximum output, an April 30 2026 knowledge cutoff, at $10 input / $1 cached / $50 output per million, with a $12.50 cache write. Prompts above 272,000 input tokens bill at 2x the input and cache rates and 1.5x output for the whole request, so the same call at 400,000 tokens is $20 input / $2 cached / $75 output.
The rest of the text line, per million as input / cached / output: gpt-5.5 $5 / $0.50 / $30, gpt-5.6-sol $4 / $0.40 / $20, gpt-5.6-terra $2 / $0.20 / $12, gpt-5.3-codex $1.75 / $0.175 / $14, gpt-5.6-luna $0.20 / $0.02 / $1.20. Batch is 50% off. GPT-6 Astra's reasoning effort ladder is low / medium / high / xhigh / max — the same five rungs Anthropic uses on Opus 5.
Gemini 3.8, 3.7 and 3.6 Flash: $0.75 input, $3.75 output per million, cache read $0.075 — plus $0.50 per million tokens per hour of cache storage. Gemini 3.1 Pro Preview: $2.00 / $12.00 for prompts up to 200K and $4.00 / $18.00 above it, cache read $0.20 rising to $0.40 above 200K, plus $4.50 per million tokens per hour of storage. Gemini 3.5 Flash-Lite: $0.30 / $2.50, cache read $0.03. Batch 50%. Figures from the Gemini API pricing page↗, read 14 September 2026.
Google alone still charges for cache storage by the hour; Anthropic and OpenAI bill on write and read only. That time dimension turns a warm cache held across a slow human-in-the-loop turn into a line item. At $4.50 per million tokens per hour on 3.1 Pro Preview, a 200,000-token cache held across a twelve-hour overnight gap costs $10.80 in storage alone — more than 25 uncached reprocessings of the same prefix at the $2.00 input rate.
I could not confirm exact context windows for the Gemini 3.x line from a Google primary source; the per-model pages did not resolve. Treat any "1M Gemini context" claim as unverified.
On open weights, Kimi K3 is the credible frontier option at $3.00 on a cache miss, $0.30 on a cache hit and $15.00 output, with a 1,048,576-token context. Its weights shipped on Hugging Face on 27 July 2026 under the Kimi K3 License. Read that licence before deploying commercially — every summary of its terms I have seen is secondary.
Prompt Caching Was Repriced in 2026
The standard advice — 90% discount, five-minute TTL, free writes on OpenAI, put a cache breakpoint on your system prompt — is now out of date in five places.
OpenAI now charges for cache writes
On GPT-5.6 and later, OpenAI charges cached input at 0.1x the uncached rate, down from a model-dependent cached-input rate on the earlier generation. But writing to cache now costs 1.25x the standard uncached input rate, where older models carried no write charge. The reuse window also changed: a cached prefix stays eligible for 30 minutes after its most recent write or reuse, against roughly 5 to 10 minutes of idle eviction on the older generation. The minimum is 1,024 visible input tokens, and routing is automatic on 5.6 and later, so prompt_cache_key is no longer needed. The claim that OpenAI cache writes are free is now wrong on the current generation — details in OpenAI's prompt caching guide↗.
Work out your own break-even
With a write charge on both vendors, caching has a payback period. Take a 40,000-token stable prefix on Fable 5.1 at the published rates.
- Uncached, per request: 40,000 × $10 / 1,000,000 = $0.40
- 5-minute cache write, once: 40,000 × $12.50 / 1,000,000 = $0.50
- Cache read, per request: 40,000 × $0.25 / 1,000,000 = $0.01
Model it as one write followed by R reads. Cached: $0.50 + $0.01R. Uncached: $0.40 × (1 + R). Setting them equal gives 0.39R = 0.10, so R ≈ 0.26 — the first read inside the TTL already pays, $0.51 against $0.80. With the 1-hour write at $20 per million the write costs $0.80, giving 0.39R = 0.40 and R ≈ 1.03 — two reads inside the hour, $0.82 against $1.20. That matches Anthropic's own statement that caching pays off after one cache read on the 5-minute duration and two on the 1-hour duration.
Run the same arithmetic on your own prefix and hit rate before turning on the 1-hour TTL. On a cache that is written and never read, a 2x write is a 100% price increase on that prefix.
The minimum cacheable length is 512 to 4,096 tokens, and failure is silent
Below the minimum, caching is skipped with no error and no warning.
| Minimum cacheable prompt | Models |
|---|---|
| 512 tokens | Fable 5.1, Mythos 5.1, Opus 5, Fable 5, Mythos 5 |
| 1,024 tokens | Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.1, Opus 4 |
| 2,048 tokens | Mythos Preview, Opus 4.7, Haiku 3.5 |
| 4,096 tokens | Opus 4.6, Opus 4.5, Haiku 4.5 |
Detection is one check: if both cache_creation_input_tokens and cache_read_input_tokens come back 0, nothing was cached. Assert on that in your client. You also get four explicit breakpoints per request at most, and automatic caching — a single top-level cache_control — consumes one.
The 20-block lookback is why your cache silently never hits
This is the mechanism behind most cache_read_input_tokens always 0 reports. It is documented and almost never quoted.
Anthropic's cache lookback checks at most 20 block positions, and it looks for prior cache writes, not for stable content. A run of consecutive tool_use blocks counts as one position; a run of consecutive tool_result blocks counts as one position.
The worked example in Anthropic's prompt caching docs↗: turn 1 writes a cache entry at block 10; turn 2 has 15 blocks, walks back, and hits; turn 3 has 35 blocks, checks positions 35 down to 16, and misses the turn-2 entry at block 15 entirely. Nothing about your prompt changed. The conversation grew past the lookback window.
Two more details that cost people money:
- The TTL is measured from the start of the writing request, not from the end of its response. A four-minute streamed response leaves roughly one minute of a five-minute TTL.
- Invalidation cascades in order: tools, then system, then messages. Changing
tool_choice, adding images, changing the speed setting, or toggling web search or citations all invalidate.
Cache diagnostics shipped on 13 May 2026
Anthropic put cache diagnostics into public beta on 13 May 2026. Pass diagnostics.previous_message_id on a Messages request with the cache-diagnosis-2026-04-07 beta header and the API returns a cache_miss_reason naming where the prefix diverged from the previous turn. Before this, debugging a cold cache meant bisecting the prompt by hand.
Long Context Stopped Carrying a Price Premium on Claude
On Claude 4.6 and later, and on Mythos Preview, the full 1M-token context window is included at standard pricing. Anthropic's own phrasing: a 900k-token request is billed at the same per-token rate as a 9k-token request. Prompt caching and batch discounts apply at standard rates across the full window. The earlier surcharge tier above 200K is gone.
That removes price as an argument against very large prompts on Claude, and only on Claude: GPT-6 Astra bills 2x input and cache rates above 272,000 tokens, and Gemini 3.1 Pro Preview doubles input and cache rates above 200,000. Two arguments remain even on Claude: latency, and the fact that more context often makes agents worse. The measurement on the second is in a June 2026 paper, "Less Context, Better Agents" (arXiv 2606.10209), which ran GPT-5 over a 50-task hotel expense benchmark.
| Strategy | Completion | Tokens | Wall clock |
|---|---|---|---|
| Full conversation history | 71.0% | 1,480,996 | 14.56 hrs |
| Pruned to last 5 tool interactions | 79.0% | 535,274 | 5.39 hrs |
| Pruned plus automated summarisation | 91.6% | 553,374 | 5.79 hrs |
Pruning plus summarisation beat full history by 20.6 percentage points while using about 63% fewer tokens and finishing in roughly 2.5 times less wall-clock time. More context made the agent slower, more expensive and worse. That is the rare case where the cost lever and the quality lever point the same way — I go through what to do about it in Context Engineering: Why Compaction Is the Wrong First Lever.
The Fixed Overheads You Pay Before the Agent Does Anything
Every request carries token costs unrelated to your prompt. Anthropic publishes them per model, and they fell sharply in the newest generation.
| Model | Tool-use system prompt (auto/none) | (any/tool) |
|---|---|---|
| Opus 5 | 286 | 406 |
| Opus 4.8 | 290 | 410 |
| Opus 4.7 | 675 | 804 |
| Opus 4.6 | 497 | 589 |
| Sonnet 5 | 354 | 474 |
| Haiku 4.5 | 496 | 588 |
Opus 5 at 286 tokens against Opus 4.7 at 675 is a 58% cut in a cost you never chose to pay.
Toolsets are bigger. computer_toolset_20260801 runs about 4,500 input tokens, and disabling zoom removes roughly 410. browser_toolset_20260801 runs about 6,600, with all four optional members adding roughly 880. The bash tool is 325 tokens on Opus 5, 4.8 and 4.7 against 244 earlier. text_editor_20250429 is 700. Use the token-counting endpoint for your exact configuration before shipping — these move with model versions.
MCP fleets are the expensive version of this
Anthropic's documentation puts a typical five-server setup — GitHub, Slack, Sentry, Grafana and Splunk — at around 55,000 tokens of tool definitions before Claude does any work. Tool search typically cuts that by over 85%, loading only the 3 to 5 tools needed.
There is a quality argument underneath the cost one: Anthropic states that Claude's ability to pick the right tool degrades once you pass 30 to 50 available tools. Those 55,000 tokens buy worse tool selection as well as a larger bill. The MCP transport also changed under you this year — I cover that in MCP Went Stateless: Migrating Your Server.
Programmatic tool calling, including the null result
Anthropic publishes both sides of this one.
- On a 75-tool project-management agent benchmark, programmatic tool calling reduced billed input tokens by roughly 38% with no change in task accuracy.
- Across production API traffic, requests whose tools array holds 10 to 49 definitions see typical savings of 20% to 40%.
- On BrowseComp and DeepSearchQA it improved performance by an average of 11% while using 24% fewer input tokens.
- On tau-squared-bench, where each turn makes one or two sequential tool calls, it left scores unchanged and cost roughly 8% more. Short sequential chains do not benefit.
The mechanism: tool results from programmatic invocations do not count toward token usage at all — only the final code execution result does. That is why the win scales with the number of intermediate calls and inverts on workloads that make one or two.
Session Runtime Is a Separate SKU Now
Tokens are no longer the whole bill. Anthropic's Managed Agents charge $0.08 per session-hour on top of tokens. Runtime accrues only while a session is running — idle, rescheduling and terminated time are free — and it replaces code-execution container-hour billing. The Batch discount does not apply. The worked example from the docs, recomputed:
| Line item | Cost |
|---|---|
| 50,000 input tokens on Opus 5 at $5/M | $0.25 |
| 15,000 output tokens at $25/M | $0.375 |
| 1 session-hour at $0.08 | $0.08 |
| Total | $0.705 |
Move 40,000 of that input to cache reads at $0.50 per million and the same session falls to $0.525: $0.05 of uncached input, $0.02 of cache reads, $0.375 of output, $0.08 of runtime.
The rest of the non-token SKUs, from the same pricing page:
- Code execution is free alongside web search or web fetch. Otherwise, 1,550 free container-hours per organisation per month, then $0.05 per hour per container with a 5-minute minimum.
- Web search is $10 per 1,000 searches. Web fetch is free beyond the token cost of what it pulls in.
- Setting
inference_geotousapplies a 1.1x multiplier to every token category on Claude 4.6 and later — a 10% surcharge set once in a compliance review and then forgotten.
What a Completed Task Actually Costs
Anthropic's long-running-agent team↗ published the same brief priced two ways. A retro game maker built by the model on its own: 20 minutes, $9, broken gameplay. The same brief through their full generator and evaluator harness: 6 hours, $200, working mechanics. The $9 run is 22 times cheaper and worth nothing, because it produced no working artifact. Cost per completed task there is undefined — the denominator is zero.
They also broke a digital audio workstation built with Opus 4.6 out by phase: planner 4.7 minutes and $0.46, build about 3 hours 20 minutes and roughly $114, QA about 25 minutes and roughly $10, for a published total of $124.70 over 3 hours 50 minutes. Planning was 0.4% of the bill and build was about 91%. The planner is not where the money is.
Multi-agent architectures move the other way. Anthropic's January 2026 guidance states that multi-agent implementations typically use 3 to 10 times more tokens than single-agent approaches for equivalent tasks, and reports an experiment splitting agents by software development role in which the subagents spent more tokens on coordination than on actual work. I go through when that multiple is worth paying in Multi-Agent Systems Are a Context Decision, Not an Org Chart.
Instrumenting Cost Per Completed Task
None of this helps unless you measure your own system. Here is the shape of the per-attempt record, deliberately flat so you can group it later; the values are worked from the published rate card, not from a production log.
{
"task_id": "inv-2026-0814-117",
"attempt": 2,
"outcome": "completed",
"model": "claude-opus-5",
"harness_version": "agent-loop@4.2.1",
"input_tokens": 9120,
"output_tokens": 2044,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 41300,
"session_seconds": 412,
"web_searches": 3,
"usd_tokens": 0.1174,
"usd_runtime": 0.0092,
"usd_tools": 0.03,
"usd_total": 0.1566
}The arithmetic on that record, at the September 2026 Opus 5 rates: 9,120 input at $5 per million is $0.0456; 2,044 output at $25 per million is $0.0511; 41,300 cache reads at $0.50 per million is $0.0207, giving $0.1174 in tokens. 412 seconds of session runtime at $0.08 per hour is $0.0092. Three web searches at $10 per thousand is $0.03. Total $0.1566.
Five rules for using it:
- Divide by completed tasks, not requests. Sum
usd_totalacross every attempt, failed ones included, and divide by tasks that reachedoutcome: completed. - Define completed with a grader, not a vibe. If a human decides, you cannot compute the metric continuously and you will stop computing it.
- Report a p90, not a mean. Agent cost distributions have long tails, and a mean that looks fine hides the tasks that ran for six hours.
- Always log both cache fields. If both are zero, caching is off and nobody told you.
- Stamp the model and harness version on every record. Without them, a tokenizer migration looks exactly like a regression in your prompts.
Then you can answer the question that decides your architecture: which model, at which effort, under which harness, gives the lowest cost per completed task on your workload. That answer will not match any leaderboard. For costs beyond inference, see the real cost of AI integration; for vendor API differences, Claude API vs OpenAI.
The Levers, Ranked by Measured Effect
| Lever | Measured effect | Source and date |
|---|---|---|
| Prune plus summarise context | +20.6 points completion, ~63% fewer tokens on one 50-task hotel expense benchmark | arXiv 2606.10209, 8 June 2026 |
| Tool search over a 5-server MCP fleet | Over 85% off ~55,000 definition tokens | Anthropic tool search docs |
| Programmatic tool calling, 10 to 49 tools | 20% to 40% fewer input tokens | Anthropic docs |
| Batch API where latency allows | 50% off both directions | Anthropic and OpenAI pricing |
| Programmatic calling, one or two calls per turn | About 8% more expensive, no score change | Anthropic docs |
| Multi-agent decomposition | 3x to 10x more tokens | Anthropic, 23 Jan 2026 |
The bottom two rows matter most: two widely recommended techniques have published negative results on the wrong workload, released by the vendor that sells them.
Key Takeaways
- Tokens per task decides the bill, not dollars per million. Sonnet 5 used 21.6B tokens to Opus 5's 6.5B on Terminal-Bench 4.0 and scored 12.4% ±3.1 against 51.8% ±3.4.
- Claude 4.7 and later produce about 30% more tokens for identical text. Sonnet 5 at $2 against Sonnet 4.6 at $3 is roughly a 13% real saving, not 33%.
- OpenAI cache writes are no longer free. GPT-5.6 and later charge 1.25x on writes and 0.1x on reads, with a 30-minute reuse window.
- Google alone bills idle cache time: $0.50 per million tokens per hour on 3.x Flash, doubling on 1 January 2027, and $4.50 per million tokens per hour on 3.1 Pro Preview.
- The 20-block lookback looks for prior cache writes, not stable content — the usual reason
cache_read_input_tokensis always 0. Cache diagnostics, shipped 13 May 2026, name the divergent block. - Non-token SKUs are material now: $0.08 per session-hour on Managed Agents, $0.05 per container-hour after 1,550 free, $10 per 1,000 web searches, and a 1.1x multiplier when
inference_geoisus.
About the Author
I'm Uvin Vindula — a Web3 and AI engineer based between Sri Lanka and the UK. I build production agent systems, and the first thing I instrument is cost per completed task, because it is the only number that survives a model swap. You can see my work at iamuvin.com or reach out at hello@iamuvin.com↗.
If your agent bill is growing faster than your task volume, let's talk about your project.
Working on a Web3 or AI project?
More in AI & Machine Learning
- Your Agent Benchmark Number Is Mostly Your Harness
- Multi-Agent Systems Are a Context Decision, Not an Org Chart
- Context Engineering: Why Compaction Is the Wrong First Lever
- MCP Went Stateless: Migrating Your Server

Uvin Vindula
Web3 and AI engineer based in Sri Lanka and the UK. Author of The Rise of Bitcoin. Founder of ASI Research Labs. Director of Blockchain and Software Solutions at Terra Labz. Founder of uvin.lk — Sri Lanka's Bitcoin education platform with 10,000+ learners.