Key takeaways
- Cost per completed task is total tokens divided by tasks that passed. In the worked example below a 70% pass rate turns $0.083 per run into $0.119 per completed task.
- The median API price across the 163 models tracked by BenchLM on 10 September 2026 was $0.95 per million input and $3.75 per million output tokens. Output costs 3.9 times input, and agents produce far more output than a chat does.
- 3 multipliers sit between the rate card and the invoice: context re-sent on every one of 10 turns, retries, and coordination between agents.
- A ten-step agent re-sending a growing context can consume five to fifteen times the tokens of the same work done in one call. That range is arithmetic from the accumulation pattern, not a benchmark.
- In the worked run, 56,000 input tokens carry only 8,000 genuinely new ones. The other 48,000 are the same material re-read.
Ask a team what its agents cost and you will usually get a monthly figure from a billing console. Ask what one completed task costs and the room goes quiet.
The calculation is not difficult. It is just longer than the one most people do, because the interesting parts are the terms that do not appear on a rate card.
What is the actual formula?
Total tokens across the whole run, priced by model, divided by tasks that passed.
Written out, so the parts that get dropped are visible:
Cost per completed task = (input tokens × input rate + output tokens × output rate) summed over every call in every run, including retries and runs that failed, divided by the number of runs that passed your acceptance check.
Two clauses in that sentence do the work. Every call in every run means retries and abandoned attempts count. Runs that passed means the denominator is smaller than the number of tasks you attempted. Teams that divide by attempts instead of successes routinely understate their cost by a third or more.
What do the tokens actually cost?
Published rates as of 10 September 2026, across the 163 models tracked by BenchLM. The floor and the ceiling have been moving in opposite directions, because budget tokens fell while frontier pricing rose.
| Tier | Input | Output | Output as multiple of input |
|---|---|---|---|
| Cheapest listed paid API | $0.017 to $0.03 | $0.11 to $0.13 | 4x to 7x |
| Median across 163 models | $0.95 | $3.75 | 3.9x |
| Frontier | Higher, rising in 2026 | Higher | Varies |
That ratio, just under four to one, is the part to internalise. Chat workloads are input-heavy: a long prompt, a short reply. Agent workloads generate plans, code, structured tool arguments and summaries, so they sit much further toward the expensive side of that ratio than the same team’s chat feature does.
Where does the multiplication happen?
Three places, and none of them is visible when you compare rate cards.
Context re-sent every turn. This is the largest and least intuitive. A conversation of ten steps does not send ten units of context. Turn one sends the system prompt. Turn two sends the system prompt plus turn one. Turn ten sends everything before it. The system prompt is paid for ten times.
Retries. A retried step does not cost what the first attempt cost. It costs more, because the failed attempt and its error are usually still in context when the retry runs.
Coordination. Splitting work across agents means each one carries its own instructions and its own copy of the shared state, which is why multi-agent designs run four to eight times the token volume of the single-agent equivalent.
| Component | Assumption | Input tokens | Output tokens |
|---|---|---|---|
| System prompt and tool definitions | 2,000 tokens, re-sent on all 10 turns | 20,000 | 0 |
| Accumulated conversation | Grows 800 tokens per turn, re-sent each time | 36,000 | 0 |
| Model output | 800 tokens per turn, 10 turns | 0 | 8,000 |
| One clean run | 56,000 | 8,000 | |
| Cost at median rates | $0.95 input, $3.75 output per million | $0.053 | $0.030 |
| Total, clean run | $0.083 | ||
| At a 70% pass rate | Failed runs still consumed tokens | $0.119 per completed task | |
The last two rows are the point. A run that costs just over eight cents becomes nearly twelve once you divide by successes rather than attempts. Nothing about the model changed. Only the denominator did.
Why the same work in one call would cost a fraction
Add up the input column: 56,000 tokens, of which 8,000 were genuinely new. The rest is the same material re-read. That accumulation is the structural difference between an agent and a single completion, and it is why a ten-step run can consume five to fifteen times the tokens of the equivalent single call, depending on how fast context grows.
What reduces cost per completed task, in order of payoff?
Four levers, all available without changing model.
| Lever | Attacks | Typical effort |
|---|---|---|
| Prompt caching with a stable prefix | Re-sent system prompt and tool definitions | Hours, if ordering is fixed |
| Raise the pass rate | The denominator, which is the biggest single term | Weeks, via evaluation |
| Cap retries by failure class | Attempts that were never going to succeed | Days |
| Route cheap steps to cheap models | The rate, on steps that tolerate it | Days, needs per-step measurement |
Notice that raising the pass rate appears as a cost lever rather than a quality lever. In this arithmetic they are the same thing: every failed run is tokens spent on nothing, and improving accuracy removes them from the numerator and adds them to the denominator at the same time. Caching is the cheapest lever only where the prefix genuinely holds still, because one changed token at the front invalidates the whole cache.
The number to walk out of your next review with
Not the monthly total. Ask for cost per completed task, and the pass rate used to compute it. Two figures. If either is unavailable, the first useful piece of work is not optimisation, it is measurement.
Frequently asked questions
How do you calculate the cost of an AI agent task?
Sum every input and output token across every call in the run, including retries and failed attempts. Multiply each by the rate for the model that produced it. Then divide the total by the number of tasks that passed your acceptance check, not by the number of tasks attempted.
Why is output more expensive than input?
Providers price generation higher than reading because generating requires a forward pass per token. The median rates tracked by BenchLM on 10 September 2026 were $0.95 per million input and $3.75 per million output, a ratio just under four to one. Agents that write code, plans or long tool arguments are output-heavy, which shifts their cost profile.
What makes agent costs higher than a single model call?
Context accumulation, chiefly. Each turn re-sends everything before it, so a ten-step run pays for early context ten times. On top of that sit retries, which re-send the accumulated context again, and coordination overhead when work is split across agents.
What is a reasonable cost per agent task?
There is no industry figure worth quoting, because task complexity varies by orders of magnitude. The useful benchmark is your own: measure it once, then track whether it moves. A number that rises 30% after a prompt change tells you more than any published average.
Method and sources
- Median API pricing across 163 tracked models as of 10 September 2026: $0.95 per million input tokens and $3.75 per million output tokens, from BenchLM, LLM pricing statistics.
- Lowest listed paid API rate on 14 September 2026: Granite 4.0 Micro at $0.017 per million input and $0.112 per million output tokens, as listed by ComputePrices and ModelGrep.
- Token Economics for LLM Agents: A Dual-View Study from Computing and Economics, arXiv:2605.09104, consulted for per-task cost accounting framing.
- Elias Lumer and colleagues, Don't Break the Cache, arXiv:2601.06007, consulted for how repeated context behaves across agent turns.
- The worked example in this article uses stated assumptions and published median rates. It is arithmetic, labelled as illustrative, and is not a measurement of any real system.