AI Agent Cost Calculator

Agent workflow

One step is one model call. Monthly tasks count original tasks, before step retries.

Include tasks that ultimately fail. Do not add step retries here.

Planned model calls in one complete workflow, from 1 to 200.

System prompt, tool schemas, user task and initial retrieved content.

Net history kept for the next call, including previous output and tool results. Zero means fixed-size context.

Average billed output for each attempt, including billable reasoning tokens.

Retries and success

Retries repeat a step, including its paid tools. Final task success is a separate business outcome.

Chance an attempt requires another try, until the retry limit is reached.

Additional attempts after the first. Zero disables retries; maximum 20.

Share of original tasks that meet your success criteria after retries.

Prices and tool fees

All prices are USD. Token rates are per 1 million tokens; replace the example prices with your own rates.

Price for input not served from cache. Use a blended rate if needed.

Price for a cached input token, not a percentage discount.

Price for generated tokens, including charged reasoning output.

Effective share of all input tokens billed as cache reads, including cold starts and expiry.

Average paid calls in each step attempt. Fractions are allowed; zero means no paid tools.

Weighted average fee for search, scraping, execution or other paid tools.

Hosting, subscriptions, cache-write/storage charges or other monthly overhead. Not multiplied by retries.

Estimated monthly total (USD)
Variable cost per started task
Cost per successful task
Expected successes per month

Monthly cost breakdown

Uncached input · first attempts
$440.00
Cached input · first attempts
$44.00
Output · first attempts
$192.00
Tool fees · first attempts
$400.00
All extra retry costs
$118.36
Other monthly costs
$0.00

Retry costs include extra input, output and tool fees. They are separate from first attempts to avoid double counting. Displayed amounts are rounded.

Expected model calls per month
Input tokens per month
Output tokens per month
Monthly savings from cache reads
Expected attempts per step
Step-by-step context and cost

Input is for the first attempt of each step. Costs include expected retries and tools, but exclude monthly overhead.

Step-by-step context and cost
StepInput tokensStep cost (USD)Running total (USD)
12,000$0.010656$0.010656
23,000$0.011877$0.022533
34,000$0.013098$0.035631
45,000$0.014319$0.04995
56,000$0.01554$0.06549
67,000$0.016761$0.082251
78,000$0.017982$0.100233
89,000$0.019203$0.119436

Example prices are illustrative, not a live model rate card. Results are planning estimates in USD.

Every task is budgeted for all steps, even if it fails. Retries use the same context and repeat tool fees. Cache misses use the regular input rate. Add cache-write/storage charges to other costs; tiered pricing, taxes and early stops are not inferred.

About this tool

This calculator estimates the monthly cost of running a multi-step AI agent from your own token prices, task volume, retry behavior, cache share and tool fees. Developers and product teams use it to budget workflows and compare designs before launch. Cost per successful task is the total monthly spend, including failed attempts and overhead, divided by the number of tasks that succeed.

How it works

Enter monthly task volume and the number of model calls in a workflow. Estimate the first prompt and the history retained after each step, then set retry limits and final task success. Add your input, cache-read and output rates, paid tool fees and monthly overhead. The estimate updates as you type; expand the step table to see how context accumulates.

Example

With the example inputs, 8 steps consume 44,000 input tokens before retries. A 10% retry probability and at most 2 retries give 1.11 expected attempts per step. At 10,000 tasks per month, the total is $1,194.36. With 90% final success, 9,000 successful tasks cost about $0.132707 each, including failed work.

Assumptions and limits

The model assumes context grows by a constant amount per step, retries repeat a step at the same cost, and cache share is a flat percentage of input. It does not fetch provider prices, count tokens from real prompts, model rate limits, batch discounts, long-context price tiers or summarization calls. Use measured usage for a final budget.

Frequently asked questions

Why do more steps increase input costs so quickly?

Retained history is sent again on later calls. Each step adds context, so total input grows quadratically with step count when history grows by a constant amount. Context growth already includes retained output and tool results; the calculator does not add them twice. Set growth to zero for fixed-size context, and budget any summarization calls separately.

How are retries, caching and successful tasks modeled?

Retries are capped extra attempts at each step, with the same token and tool costs. Final business success is entered separately. Cost per success divides the entire monthly bill, including failed tasks and overhead, by expected successes. Cache share is an effective share of billed input, not an automatic guarantee that a prompt is eligible for caching. Use measured usage and your provider's rates for a closer estimate.

How can I reduce the cost of an AI agent workflow?

Common levers are fewer steps, less retained history per step, a higher share of cacheable input, fewer retries and fewer paid tool calls. Change one input at a time in the calculator to see which lever moves the monthly total most for your workflow.

Where do I find input, cached input and output prices?

Use your model provider's current pricing page or your billing dashboard. Prices are usually quoted per million tokens and differ by model, so enter the rates for the exact model you plan to use.

What is the difference between cost per task and cost per successful task?

Cost per task is the variable cost of one started task, including expected retries, tokens and paid tool calls, but without monthly overhead. Cost per successful task divides the full monthly bill, overhead included, by the tasks expected to succeed. With the example inputs, a started task costs about $0.119436, while each of the 9,000 successful tasks costs about $0.132707. The gap widens as the success rate falls, so the success-based figure is usually the one to use when you price a feature per outcome.

Calculation method

I=NB+GN(N−1)2,A=∑k=0RpkI=NB+\frac{GN(N-1)}{2},\qquad A=\sum_{k=0}^{R}p^k

I is input tokens per task before retries; N is steps; B is first-step input; G is retained context added per step. A is expected attempts per step, p is retry probability as a fraction, and R is the maximum retries. Variable task cost sums input, output and tools, multiplied by A. Monthly total adds fixed costs; cost per success divides that total by expected successful tasks.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
tasks_monthlyTasks per monthwhole number; allowed 0–1000000000required
steps_per_taskSteps per taskwhole number; allowed 1–200required
initial_input_tokensFirst-step input tokenswhole number; allowed 0–10000000required
context_growth_tokens_per_stepRetained context added per stepwhole number; allowed 0–10000000counted as 0
output_tokens_per_stepOutput tokens per stepwhole number; allowed 0–10000000required
retry_rate_pctRetry probability per attempt (%)percent: 6.5 means 6.5%; allowed 0–100counted as 0
max_retriesMaximum retries per stepwhole number; allowed 0–20default 2
success_rate_pctFinal task success rate (%)percent: 6.5 means 6.5%; allowed 0–100default 90
input_price_per_1m_tokensInput price (USD / 1M tokens)amount without a currency symbol; allowed 0–1000000required
cached_input_price_per_1m_tokensCache-read price (USD / 1M tokens)amount without a currency symbol; allowed 0–1000000required
output_price_per_1m_tokensOutput price (USD / 1M tokens)amount without a currency symbol; allowed 0–1000000required
cache_hit_rate_pctInput tokens served from cache (%)percent: 6.5 means 6.5%; allowed 0–100counted as 0
tool_calls_per_stepPaid tool calls per stepnumber; allowed 0–10000counted as 0
tool_price_per_callPrice per tool call (USD)amount without a currency symbol; allowed 0–1000000counted as 0
fixed_costs_monthlyOther monthly costs (USD)amount without a currency symbol; allowed 0–1000000000000counted as 0

Examples

  • ?tasks_monthly=50000&steps_per_task=12&initial_input_tokens=3000&context_growth_tokens_per_step=800&output_tokens_per_step=400&retry_rate_pct=5&input_price_per_1m_tokens=3&cached_input_price_per_1m_tokens=0.3&output_price_per_1m_tokens=15&cache_hit_rate_pct=60
  • ?tasks_monthly=2000&steps_per_task=4&initial_input_tokens=1500&output_tokens_per_step=250&input_price_per_1m_tokens=1.25&cached_input_price_per_1m_tokens=0.125&output_price_per_1m_tokens=10&tool_calls_per_step=2&tool_price_per_call=0.01&fixed_costs_monthly=50

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="ai_agent_cost_calculator"]