The Short Answer
A simple one-step agent task costs a fraction of a cent. A long-horizon coding or browsing task costs dollars, sometimes hundreds. Token price is the least important variable in that range. What you actually pay is cost per successful task: cost per attempt divided by first-attempt success rate, plus the human cost of every failure. Reliability and scaffold design move that number far more than the model you pick.
Why Cost Per Call Is the Wrong Number
The standard version of this post multiplies a dollars-per-million-tokens rate by an assumed token count, lands on four cents per task, then recommends prompt caching and a cheaper model. Every step is wrong on the invoice.
Cost per attempt is not cost per task, because production runs the same task type thousands of times and some fraction fail. The tau-bench paper from Yao, Shinn, Razavi and Narasimhan measured it: GPT-4o class function calling agents succeeded on under 50% of tasks on a single attempt, and their pass^8 rate in retail was under 25%. An agent that looks respectable once clears eight consecutive comparable cases less than a quarter of the time.
The formula worth budgeting against:
cost per successful task
= (cost per attempt / first-attempt success rate)
+ (escalation rate x fully loaded human minutes)
Put numbers in it. A two-cent inference bill at 85% success is $0.024 per attempt-adjusted task. The remaining 15% goes to a human at six minutes each, and at a fully loaded $12 per hour that tail costs $0.18. Inference is about 12% of your true cost. Optimizing the 12% and ignoring the 88% is the standard mistake.
What Actually Lands on the Invoice
Token price is one line of several, and the lines missing from a tokens-per-request dashboard are the ones that surprise finance. The Claude rows below come from Anthropic's Claude Platform pricing docs; the last row comes from the vendors' own pricing pages.
| Cost line | What it costs | In a token dashboard? |
|---|---|---|
| Input tokens | $5 per million on Opus 5, $2 on Sonnet 5, $1 on Haiku 4.5 | Yes |
| Output tokens | 5x input: $25, $10, $5 per million | Yes |
| Reasoning tokens | Output rate on the full internal reasoning, not the summary you see | Rarely separated |
| Tool definitions | Every turn: 286 tokens for the tool-use system prompt on Opus 5, 325 for bash, 700 for the text editor, about 4,500 for computer use, about 6,600 for browser use | Buried in input |
| Web search | $10 per 1,000 searches | No |
| Code execution | $0.05 per container-hour past 1,550 free hours a month, five-minute minimum | No |
| Managed agent sessions | $0.08 per session-hour, metered only while the session status is running | No |
| Observability and vectors | LangSmith Plus at $39 per seat plus metered compute and storage units, Pinecone Standard at a $50 per month minimum | No |
Two rows deserve emphasis. Reasoning is the category that moves most in an agent loop, and Anthropic's own documentation warns that the billed output token count does not match the visible one: you pay for the full thinking process, not the summary in the response body. The field that tells you how much is usage.output_tokens_details.thinking_tokens, and almost nobody logs it. Tool schemas are the other tax, charged on every turn: a forty-turn loop carrying the browser toolset spends roughly 264,000 input tokens on schemas before producing anything. Twelve tools attached in case they are needed is not free optionality.
Worked Arithmetic on Real Published Numbers
Anthropic publishes a worked example in its Claude Managed Agents pricing: a one-hour Claude Opus 5 coding session using 50,000 input and 15,000 output tokens costs $0.705, being $0.25 input, $0.375 output, $0.08 session runtime. Cache 40,000 of those input tokens and it drops to $0.525, a 26% reduction. At the low end, Anthropic's support example runs about 3,700 tokens per conversation on Haiku 4.5, roughly $37 per 10,000 tickets, or $0.0037 each.
Compare that to what a finished task sells for. Intercom's Fin charges $0.99 per outcome, capped at one charge per conversation regardless of how many actions it takes. The factor of 267 between $0.0037 of inference and $0.99 of revenue is the entire business, and it is set by escalation rate and by what a wrong answer costs, not by token rates.
The Scaffold Costs More Than the Model
The Holistic Agent Leaderboard, from Kapoor, Stroebl, Kirgis and colleagues, ran 21,730 agent rollouts across nine models and nine benchmarks for about $40,000. Two findings should change where you spend engineering time.
The scaffold dominates. On Online Mind2Web, SeeAct with GPT-5 Medium cost $171 while Browser-Use with Claude Sonnet 4 cost $1,577, a 9x gap for a two-percentage-point difference in accuracy. Loop shape, tool granularity, and context policy sit upstream of the model dropdown.
Reaching for more reasoning is also not a quality lever. The same study found that in 21 of 36 model-agent-benchmark combinations, increased reasoning effort produced equal or lower accuracy, and it always costs more. The model most often on the cost-accuracy Pareto frontier was Gemini 2.0 Flash, on 7 of 9 benchmarks, at $0.10 per million input tokens. Task type swings cost harder than model choice: ScienceAgentBench averaged about $13 per evaluation, Online Mind2Web over $450.
Four Ways an Agent Bill Goes Exponential
Each of these turns a cheap test run into an expensive production task, and none of them announce themselves on a token dashboard. OWASP catalogues the class as LLM10:2025 Unbounded Consumption, which names denial of wallet as an attack: driving a high volume of operations against a cost-per-use service until the bill becomes the damage.
- Unbounded retry on a permanently failing input. A 400-class error gets retried forever, each attempt a full-context call at full price, with the rate limit as the only cap. Mark 4xx terminal, add a max-attempt counter, cap spend on the key.
- Silent cache misses. A timestamp, a request UUID, or an edited tool description invalidates the prefix. Nothing errors, latency looks normal, and you pay full input rate indefinitely instead of the 0.1x cache-read rate. Detection is two fields: cache_read_input_tokens and cache_creation_input_tokens both sitting at zero across repeated calls.
- Superlinear context growth. Every turn resends the whole history, so an N-turn loop pays roughly N-squared input tokens. Real tasks routinely run triple the turns your tests did.
- Server-side spend invisible to the token meter. An agent averaging six web searches per task adds $0.06 that never shows in a tokens-per-request chart.
The vendors have already repriced around this. Cursor moved its Pro plan off request-based pricing in July 2025, writing that its hardest requests cost an order of magnitude more than simple ones. If a company with full visibility into its own workload cannot hold a flat per-request price, a flat internal estimate will not hold either.
The Decision Rules We Actually Apply
Run through these before writing agent code.
- Do not build an agent for a single step. For classify, extract, summarize, or answer from a document, one call plus retrieval is the baseline. Anthropic's Building Effective Agents guidance says the same thing: find the simplest solution possible, add complexity only when it demonstrably improves outcomes, and expect many use cases to be served by a single call with retrieval and good examples.
- Price the outcome before the tokens. If you cannot state in dollars what one completed task is worth, do not build the agent. Anthropic is explicit that multi-agent systems need tasks valuable enough to pay for the added performance.
- Instrument before you optimize. Log input, output, cache-read, and cache-write tokens plus server-tool call counts against a task ID on every request. Otherwise you cannot find the small share of tasks driving the spend.
- Verify caching actually engages. Minimum cacheable prefixes differ by model: 512 tokens on Opus 5, 1,024 on Sonnet 5, 4,096 on Haiku 4.5. Below that it silently does nothing and returns no error. A read is 0.1x base input and a five-minute write is 1.25x, so an approval gate past the TTL turns the saving into a penalty.
- Do not add a second agent until the task exceeds one context window. Anthropic's June 2025 write-up on its multi-agent research system reported that, on the Opus 4 and Sonnet 4 generation, agents used about 4x the tokens of chat and multi-agent systems about 15x. That is the price of the second agent before it has done anything useful.
- Compact context past about 20 turns. Anthropic reported that context editing cut token consumption by 84% in a 100-turn web search evaluation, and let agents finish workflows that otherwise died of context exhaustion.
- Batch anything asynchronous. A flat 50% cut on input and output, stackable with caching.
- Scope to the horizon models hit. METR's March 2025 measurements put success near 100% on tasks a human finishes in under four minutes and under 10% past about four hours. Longer work belongs in checkpointed sub-tasks.
- Budget for being wrong. In Moffatt v. Air Canada, the British Columbia Civil Resolution Tribunal ordered Air Canada to pay $812.02 in damages and fees over one wrong chatbot answer about bereavement fares, and rejected the argument that the chatbot was a separate legal entity responsible for its own information. The award is small. The precedent, that the output is yours, is what you price.
Two Traps in the Standard Advice
Prompt caching is sold as a lever you pull. It is better understood as a lever that quietly stops working. Anthropic documents that modifying tool names, descriptions, or parameters invalidates the entire cache, that toggling web search or citations rewrites the system prompt, and that changing the thinking configuration always invalidates message blocks. The cached prefix is ordered tools, then system, then messages, so a change at one level invalidates every level below it.
Model upgrades are treated as automatic savings. They are not. Anthropic's pricing page states that Claude 4.7 and later models use a newer tokenizer producing approximately 30% more tokens for the same text, so a migration justified on a flat headline price can raise the bill for identical work.
How We Approach This at SASID
Cost per task is a design constraint we set before architecture, not a metric we discover afterward. Two systems in our portfolio only work because of that ordering: a call center QA system that reached 100% automated coverage where manual review had never exceeded 5%, and a customer platform handling more than 30,000 reviews per day across 200 or more locations against a sub-2-minute SLA. In both, a few cents of drift per task decides the business case. What makes them work is unglamorous: instrument per task from day one, keep the loop short, cap retries, and spend the expensive model only where it changes the outcome.
Get a Free Technical Assessment
If you are working out whether an agent makes economic sense for your workload, we offer a free technical assessment: a 30-minute call about your use case, then a written roadmap within 48 hours covering architecture, cost per task, timeline, and where the spend risk sits. No obligation, and the roadmap is yours to keep. Book at sasid.ai.