🏆 US-Registered Digital Marketing Agency Trusted by 200+ brands · USA · UK · Canada · AUS
Advertisement
Advertisement
AI TOOLS

AI Agent Cost Calculator — cost per task run and at monthly volume

Model what an autonomous agent loop actually costs once context accumulation, tool results, and retries are counted.

System prompt, tool definitions, and the user's original request — sent again on every step.
Tool results and the model's own replies are appended to the conversation, so each step carries everything before it.
Editable defaults — replace them with the live rates from your provider's official pricing page before you rely on the result.
How many times the agent runs end to end in a month.
Cost per task run
$0.00
 
0
Input tokens per run
0
Output tokens per run
$0
Monthly cost at volume
0.0x
Vs. flat-context estimate
Input
$0
Output
$0
Retries
$0
Tip: agent cost does not scale with the number of steps — it scales with the square of it, because every step re-sends the entire conversation so far.
Advertisement

The AI agent cost calculator above estimates what one run of an autonomous agent loop costs, and what that becomes across a month of production traffic. It is deliberately not a simple tokens-times-price multiplication, because that is exactly the calculation that leads teams to under-budget an agent by a factor of three or more. An agent re-sends its accumulated conversation on every single step, so the token bill grows far faster than the step count suggests.

Arb Digital builds AI-assisted workflows for clients who need a defensible number before they commit engineering time, and this is the model we use in that conversation. It takes four things a team can actually estimate — how long the loop runs, how much the model says per step, how much text tools hand back, and how often the whole thing has to be retried — and turns them into a cost per task and a monthly figure at your real volume.

What This AI Agent Cost Calculator Does

Enter the size of your base prompt, the number of steps a typical task takes, the output length per step, the size of tool results, your retry rate, and your provider's per-million-token input and output prices. The calculator returns the cost of a single complete task run as the headline figure, then breaks out the total input tokens consumed, total output tokens produced, the projected monthly spend at your stated volume, and — the number most teams have never seen — the multiple between the real cost and the naive flat-context estimate.

The breakdown bars underneath split the per-run cost into input, output, and the portion attributable to retries. On most agent workloads the input bar dwarfs the output bar, which is counter-intuitive when output tokens are priced several times higher. That single visual usually redirects an optimisation effort from "make the model say less" to "stop re-sending everything".

How to Use It

  1. Enter your base prompt tokens. Count the system prompt, every tool or function definition in JSON schema form, and the user's initial request. Tool schemas are frequently the largest hidden component here. Our prompt token estimator will size this quickly if you have the text but not the count.
  2. Set steps per task. One step is one model call inside the loop. If your agent typically calls a tool five times before answering, that is roughly six steps including the final response.
  3. Set output and tool result tokens per step. Tool results are the sleeper cost: a search API or a database query can return several thousand tokens that then sit in the conversation for the rest of the run.
  4. Set your retry rate. This covers failed tool calls that get retried, malformed structured output that is regenerated, and runs abandoned partway and restarted. A 15% rate means the average task costs 1.15 full runs.
  5. Replace the price defaults with the current rates from your provider, then set your monthly task volume and click Calculate.

The Formula: Why Agent Cost Is Quadratic

A single model call costs input tokens times the input rate plus output tokens times the output rate. An agent is a sequence of calls where each one includes everything from the previous ones. At step one the model sees only the base prompt. At step two it sees the base prompt plus the first response plus the first tool result. At step eight it sees the base prompt plus seven rounds of accumulated history.

Written out, the input tokens for a whole run are: steps × base + (output + tool) × steps × (steps − 1) ÷ 2. That second term is the triangular number, and it is why cost curves upward rather than climbing in a straight line. Double the steps from 8 to 16 and the accumulated portion does not double — it roughly quadruples. Output tokens, by contrast, really are linear: steps × output per step. The whole run is then multiplied by one plus the retry rate.

Work the default values by hand to see it. Eight steps, 1,200 base tokens, 900 tokens added per step: the flat part is 8 × 1,200 = 9,600 tokens, and the accumulated part is 900 × 8 × 7 ÷ 2 = 25,200 tokens. Total input is 34,800 tokens against just 2,400 output tokens. The conversation history, not the model's answers, is the product you are buying.

Advertisement

Getting Prices Right Without Hardcoding Them

The price fields ship with placeholder values, and they are placeholders on purpose. Per-token rates change, tiers get renamed, and any article that states a price as a fact is wrong within months. Pull the live figures from the provider's own pricing page before you present a number to anyone: OpenAI's pricing documentation and Anthropic's Claude pricing reference both publish current per-million-token input and output rates for every model they offer.

Two details catch people out. Input and output are priced differently, usually with output several times more expensive, so a single blended rate will be wrong in one direction or the other. And some providers quote per thousand tokens rather than per million — multiply by 1,000 before entering it here. To weigh several models against each other, use the LLM cost comparison tool.

Why Step Count Is the Highest-Leverage Lever

Because the accumulated term is quadratic, trimming steps beats trimming prompts almost every time. An agent that reaches an answer in five steps instead of nine is not 44% cheaper — on the default numbers it is roughly 60% cheaper, because the history it never accumulates was going to be re-sent on every remaining step.

Practically, step count comes down almost entirely to tool design. Agents burn steps when tools are too granular, when a result is ambiguous enough to force a clarifying call, or when the model has to page through output one screen at a time. Consolidating three narrow tools into one that accepts a richer argument removes steps and the history they would have generated. Set the step field to your current average, then to your target, and the gap between the two monthly figures is the business case for that refactor.

Tool Results: The Cost Nobody Budgets For

Teams estimate their prompt carefully and then hand the model a web search result, a full API response, or a hundred rows of query output without counting any of it. Those tokens are billed as input on the step that receives them, and then billed again on every subsequent step, because they are now part of the conversation.

Set the tool result field to 600 and then to 3,000 to see the effect at your own step count. On a long loop, a verbose tool can cost more than the model's entire reasoning output. The fixes are unglamorous: truncate results to the fields the agent actually reads, return identifiers instead of full records, cap list responses, and strip null fields and whitespace from JSON before it enters the context.

Retries Are Not a Rounding Error

A retry rate is easy to wave away as a small percentage, but it multiplies the entire run, including all that accumulated history. Worse, retries in agent systems are rarely evenly distributed — they cluster on the hardest tasks, which are also the tasks with the most steps and therefore the most expensive runs. A 15% average retry rate can mean the expensive decile of your traffic is retrying half the time.

Two structural choices reduce the cost of a retry independently of reducing the rate. Retry from a checkpoint rather than from step one, so a failure at step seven does not re-pay for steps one to six. And validate structured output locally before it re-enters the loop — a schema check that catches malformed JSON costs nothing, while finding the problem two steps later costs the whole intervening context.

Caching, Batching, and the Levers That Move the Input Bar

Once you can see that input dominates, the relevant optimisations become obvious. Prompt caching, where a provider stores a stable prefix of your conversation and charges a reduced rate to reuse it, is the single best fit for agent workloads: the base prompt and tool schemas are identical on every step, which is exactly the shape caching is designed for. Model the saving in the prompt cost optimizer before committing to the refactor.

Where latency permits, offline batch processing is the other lever — many providers offer a lower rate for asynchronous jobs completed within a window rather than in real time. That does not suit an interactive agent, but it suits the evaluation and backfill runs that often consume more tokens than production traffic. The inference batching calculator covers that trade-off.

Where This Model Stops Being Accurate

This calculator assumes a linear conversation that grows monotonically. Real agent systems often deviate, and the deviations mostly reduce cost. Agents that summarise or truncate their history at a threshold flatten the quadratic into something closer to linear beyond that point — if you compact aggressively, model your average post-compaction context as the base prompt instead. Sub-agents that run in their own context window and return only a short result also break the curve, which is precisely why that pattern is popular.

It also assumes uniform steps. For a workload that varies a lot, run the calculator once per task archetype and weight the results by how often each occurs. If your agent uses more than one model — a small one for routing, a large one for reasoning — run it separately per model and add the results, since the price fields hold only one pair of rates.

Need an AI workflow that is costed before it is built?

Arb Digital scopes AI-assisted automation with the token economics modelled up front, so the running cost is a decision input rather than a surprise on the first invoice.

Browse Free Tools Talk to Arb Digital

Common Mistakes to Avoid

  • Multiplying one step's cost by the step count — that flat estimate ignores accumulated history and typically understates a long agent run by two to four times.
  • Leaving tool results out of the token count — everything a tool returns is billed as input on that step and on every step after it.
  • Using a single blended token price — input and output are priced separately, and agent workloads are heavily input-weighted, so a blend distorts the answer.
  • Ignoring the tail of long runs — averages hide the expensive decile, and step limits exist precisely because some tasks would otherwise run away.
  • Budgeting from a development-time sample — test prompts are short and clean, while production inputs are longer, messier, and retry more often.

Related Free Tools From Arb Digital

Size your prompts first with the AI token calculator, check a single model call with the GPT API cost calculator, make sure a long agent conversation still fits using the context window planner, and pressure-test the business case with the AI ROI calculator. The full free online tools hub has the rest.

Frequently Asked Questions

Why is agent cost higher than the sum of its prompts?

Because every step re-sends the whole conversation so far. The base prompt, all previous model responses, and all previous tool results are billed again as input on each new step, so total input tokens grow with the square of the step count rather than in proportion to it.

Do tool results cost tokens?

Yes. Whatever a tool returns is inserted into the conversation and billed as input tokens on that step, then billed again on every subsequent step of the same run. Verbose tool responses are one of the largest avoidable costs in agent systems.

What retry rate should I use?

Use your own measured figure if you have one, counting failed tool calls, regenerated structured output, and abandoned runs. If you have no data yet, model a range rather than a single value, and check how sensitive the monthly total is to that assumption.

Does prompt caching change this calculation?

It can reduce the input side substantially, because the stable prefix of an agent conversation is reused on every step. Enter your effective post-cache input rate in the price field, or model the saving separately before applying it here.

How do I count my base prompt tokens?

Include the system prompt, every tool or function schema you pass, and the user's original request. Tool schemas are often larger than teams expect. A token counting tool will give you the figure from the raw text.

Why is input cost usually larger than output cost here?

Output tokens are priced higher per token, but agents produce relatively few of them and re-read enormous amounts of context. The volume difference typically outweighs the price difference, which is why context management saves more than shortening responses.

Does this work for multi-agent systems?

Run it once per agent, since each sub-agent normally has its own context window and its own step count, then add the results. Sub-agents that return short summaries to a parent are cheaper than one long conversation precisely because they avoid sharing accumulated history.

Figures produced by this tool are planning estimates only — actual spend depends on your provider's current rates, tokenizer, caching behaviour, and the real distribution of task lengths in production.

Advertisement
Advertisement
Arb Digital assistant

👋 Hey! Want to grow your business? Ask me anything — a free marketing proposal is on the table!