The ai agent running costs for a production agent are not one bill but five: model tokens, tool and API calls, retrieval and storage, hosting and orchestration, and human oversight. The model bill is usually the largest line, but it is rarely the whole story, and the number that matters for budgeting is not the monthly total. It is the cost of one completed task. This guide breaks down every layer, works through a line-by-line monthly estimate you can adapt to your own agent, and ends with the levers that actually bring the bill down.
What running an AI agent actually costs
A single user request becomes a loop: the model plans, calls a tool, reads the result, and repeats until the task is done or a limit stops it. Every step is a fresh model call, and every fresh call re-sends the accumulated context.
The five layers of the bill are:
- Model tokens. Every input and output token the model processes, priced per million tokens.
- Tool and API calls. Web search, code execution, and third-party APIs the agent invokes along the way.
- Retrieval and storage. Embeddings, vector storage, and memory the agent reads before it acts.
- Hosting and orchestration. The container, queue, and observability that keep the agent running between calls.
- Human oversight. The review time spent checking what the agent did, and the cost of fixing what it got wrong.
Hosting is best treated as a baseline cost from your own bill: the container and queue that keep the agent running, priced separately from the token and tool lines that scale with every task. Tokens, tool calls, and oversight scale with every task, which is why a quiet month can look cheap and a busy month can surprise you. To see the scale of the jump, consider the token multipliers reported by CloudZero using Anthropic’s figures: a single chat answer runs about 2,000 tokens, the same job done by a tool-using agent runs about four times that (8,000 tokens), and a multi-agent version runs about fifteen times that (30,000 tokens). At an illustrative blended rate of $5 per million tokens, that is about $0.01 per chat answer, $0.04 per agent task, and $0.15 per multi-agent task. The per-task numbers look tiny. The monthly total does not, and that gap is where budgets quietly die.
Token and model costs: the biggest line item

Model providers charge per token, and output tokens cost several times more than input tokens. The table below shows list prices from pricing trackers in October 2026; prices move often and trackers disagree, so verify the current rate on the provider’s own pricing page — OpenAI’s API pricing and Anthropic’s pricing page — before you budget.
| Model | Input per 1M tokens | Output per 1M tokens |
|---|---|---|
| GPT-5.6 Sol | $5.00 | $30.00 |
| GPT-5.6 Terra | $2.00 | $12.00 |
| GPT-5.6 Luna | $0.20 | $1.20 |
| Claude Opus 5.5 | $4.00 | $20.00 |
| Claude Sonnet 5.5 | $2.00 | $10.00 |
| Claude Haiku 5.5 | $0.10 | $0.50 |
Haiku 5.5’s low rate applies to prompts up to 100,000 tokens; above that threshold it pays five times the lower rates. Output tokens are the minority of what an agent consumes, but they are the expensive minority. In Octomind’s coding-agent benchmark, output plus reasoning ran to only 0.5% to 2.1% of input tokens per task, yet output is priced five to six times higher than input on frontier models, so it still deserves attention when an agent writes long answers.
What really drives the token bill is input volume. A coding-agent task in the Octomind benchmark consumed between 0.69 million and 3.52 million input tokens depending on the agent, and 92% to 98% of that input was served from cache. Three forces push input volume up: multi-step loops that re-send the conversation history on every call, long context windows that hold whole documents in the prompt, and tool definitions. Loading a full MCP tool catalog injects every tool’s JSON schema into the system prompt; in one measured example a GitHub task consumed 44,026 tokens through MCP versus 1,365 tokens through a plain CLI, a 32-fold difference for the same result. Reasoning models add a further multiplier, since their hidden thinking tokens are billed too. And a newer tokenizer can quietly add about 30% more tokens for the same text, according to a pricing tracker covering newer Claude models, so comparing costs per task matters more than comparing costs per token.
Two discounts can cut the effective price substantially, and how much they matter depends on the workload. Prompt caching cuts the price of repeated context: on Anthropic, cache reads cost 0.1 times the base input price on most models, 0.05 times on Opus 5.5 and Sonnet 5.5, and 0.025 times on Fable 5.1, while cache writes cost 1.25 times base input for a five-minute cache or twice base input for a one-hour cache. On OpenAI, cached input tokens are priced 90% below standard input rates. Batch APIs, for work that does not need a real-time answer, cut list prices by roughly 50% at both providers.
Tool calls, retrieval and infrastructure costs
Tokens are the headline, but the tools an agent calls carry their own charges on top. Both OpenAI and Anthropic charge $10 per 1,000 web searches through their built-in search tools, and the search results are also billed as model input tokens. Anthropic’s code execution costs $0.05 per container-hour after 1,550 free hours per organisation per month, and its managed agents add $0.08 per session-hour of runtime on top of token costs. These are small numbers per call, and they add up exactly like tokens do: multiplied by tasks and by calls per task.
Retrieval and storage are a separate line. An agent that grounds its answers in your documents pays for the embeddings that index those documents and for the vector storage that holds them, plus the tokens spent reading retrieved passages into the prompt on every step. These charges are billed separately from the model, so a pricing-page comparison that only looks at tokens will miss them entirely.
Hosting and orchestration are the steadiest part of the bill: the container the agent runs in, the queue that dispatches its tasks, and the logging that lets you see what it did. Treat them as a baseline cost when you budget, but use your own provider’s billing model: some infrastructure charges are flat while others scale with usage, so add your actual hosting bill as its own line in the estimate below.
The hidden costs: retries, loops and human oversight

The costs that never appear on a vendor pricing page are the ones that most often blow a budget. The first is retries. A cheaper model can fail more often, and a failed attempt still incurs charges for the tokens and tool calls it consumed, calculated at the applicable input, output, cached-input, and tool rates. In Arize’s benchmark of ten models across 2,400 agent runs, the cheapest model (gpt-oss-120b) passed only 33% of tasks, cost $0.018 per attempt, and $0.054 per successful task, a 3.0 times retry tax. GPT-5.5 passed 67%, cost $0.424 per attempt and $0.636 per successful task, a 1.5 times retry tax. A lower token price does not guarantee a lower cost per successful task: the ranking comes from the measured pass rates and attempt costs, not from the sticker price alone.
The second is runaway loops. An agent that cannot finish a task keeps calling the model and its tools until a step limit or a budget stops it, and every failed run, retry, and errored tool call is a token charge with nothing to show for it. That is why step caps, token caps, and per-task cost logging are cost controls, not just reliability features.
The third is evaluation and human oversight. Before production there is prompt iteration and testing, all billed at production rates. After production there is review: just over half of surveyed organisations report spending significant staff hours manually reviewing and correcting autonomous agent outputs before they go live. Leave that review time out of the cost model and it is a sales projection, not a budget.
The Databricks coding-agent benchmark makes the same point from the other side. Its cheapest model per token was not its cheapest per completed task: GLM 5.2 cost $1.28 per completed task, Opus 4.8 cost $1.94, and Sonnet 5 cost $2.09, even though Sonnet 5 was cheaper per token than Opus 4.8. For a coding agent, token price is not the full cost, because context, turns, and retries decide the final number.
A worked example: estimating your monthly agent bill
Here is a line-by-line estimate for a small support-triage agent, using the CloudZero worked profile and stating every assumption so you can re-run it with your own numbers:
- Assumptions: 100 tasks per day, 30 days a month, so 3,000 tasks a month. Each task averages 12 model calls, and with context accumulation each call averages 3,000 input and 500 output tokens. The model is Claude Sonnet 5.5 at list rates of $2 input and $10 output per million tokens. Each task also runs two web searches.
- Tokens per task: 36,000 input and 6,000 output tokens.
- Token cost per task: $0.132.
- Monthly token cost: 3,000 tasks at $0.132, which is $396.
- Tool cost: two web searches per task at $0.01 each is $0.02 per task, which is $60 a month.
- Retry allowance: assuming one in ten tasks needs a single retry of the whole task — model calls and searches — add about 10% to the token line, roughly $40 a month, and about 10% to the tool line, $6 a month. This is an assumption to replace with your own measured retry rate.
- Monthly total, model plus tools: about $502, before hosting and human review time.
- Completion: add your own lines for hosting, retrieval and storage, and human review time — or zero where you do not use them — to reach the full five-layer total.
The per-task token math, as code:
def cost_per_task(calls, in_tokens_per_call, out_tokens_per_call,
price_in_per_million, price_out_per_million):
total_in = calls * in_tokens_per_call
total_out = calls * out_tokens_per_call
return (total_in * price_in_per_million / 1_000_000
+ total_out * price_out_per_million / 1_000_000)
# The worked profile: 12 calls, 3,000 input and 500 output tokens per call,
# priced on Claude Sonnet 5.5 list rates ($2 in / $10 out per million tokens)
print(cost_per_task(12, 3000, 500, 2.00, 10.00)) # 0.132
Model choice moves the same task across an order of magnitude. On the same token profile, the identical task costs $0.264 on Claude Opus 5.5 ($4 input, $20 output), which is $792 a month at 3,000 tasks, and $0.0066 on Claude Haiku 5.5 ($0.10 input, $0.50 output), which is $19.80 a month. The right question is not which model is cheapest, but which model is good enough for the task, and what its retry rate does to the cost per completed task.
Write the numbers down as a budget the agent itself must respect:
{
"max_steps_per_task": 12,
"max_tokens_per_task": 50000,
"max_cost_per_task_usd": 0.50,
"alert_at_usd_per_day": 100
}
How to keep AI agent running costs under control
Start with model routing, the largest lever. Use small models for routine steps such as classification, extraction, and summarising, and reserve frontier models for the steps where quality decides the outcome. In the worked example above, routing the same task from Sonnet 5.5 to Haiku 5.5 cuts the token line from $396 to about $20 a month, if Haiku is good enough for the work.
Next, cache aggressively: any system prompt, document, or tool definition that repeats across requests should be served from cache, where reads cost a tenth or less of standard input prices. Then use the batch API for anything that does not need an answer now, which roughly halves list prices.
Cap everything the agent can spend. Set a maximum number of steps per task, a maximum number of tool calls, and a maximum token budget per task, and stop the task when any cap is hit. Log the cost of every task alongside its outcome, so you can see which tasks, tools, and models are eating the budget, and set a daily spend alert so a runaway agent is caught in hours rather than discovered on the invoice.
Finally, mind the tool surface. Prefer narrow, purpose-built tools over a sprawling MCP catalog, because every tool definition is input tokens on every step. Measure cost per completed task, not cost per token: compare the measured total cost and success rate for each model, since fewer attempts do not automatically mean a lower bill once attempt prices are counted.
The ai agent running costs you will actually pay are, for the single-retry assumption used above, task count × (base cost per task + retry fraction × cost of a retry) — and then the separately budgeted hosting, retrieval and storage, and human review costs on top. Workloads where a task can retry more than once need a different formula. Get the per-task number right and the monthly bill becomes a calculation instead of a surprise.



