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 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.
| Parameter | Value | If omitted |
|---|---|---|
tasks_monthlyTasks per month | whole number; allowed 0–1000000000 | required |
steps_per_taskSteps per task | whole number; allowed 1–200 | required |
initial_input_tokensFirst-step input tokens | whole number; allowed 0–10000000 | required |
context_growth_tokens_per_stepRetained context added per step | whole number; allowed 0–10000000 | counted as 0 |
output_tokens_per_stepOutput tokens per step | whole number; allowed 0–10000000 | required |
retry_rate_pctRetry probability per attempt (%) | percent: 6.5 means 6.5%; allowed 0–100 | counted as 0 |
max_retriesMaximum retries per step | whole number; allowed 0–20 | default 2 |
success_rate_pctFinal task success rate (%) | percent: 6.5 means 6.5%; allowed 0–100 | default 90 |
input_price_per_1m_tokensInput price (USD / 1M tokens) | amount without a currency symbol; allowed 0–1000000 | required |
cached_input_price_per_1m_tokensCache-read price (USD / 1M tokens) | amount without a currency symbol; allowed 0–1000000 | required |
output_price_per_1m_tokensOutput price (USD / 1M tokens) | amount without a currency symbol; allowed 0–1000000 | required |
cache_hit_rate_pctInput tokens served from cache (%) | percent: 6.5 means 6.5%; allowed 0–100 | counted as 0 |
tool_calls_per_stepPaid tool calls per step | number; allowed 0–10000 | counted as 0 |
tool_price_per_callPrice per tool call (USD) | amount without a currency symbol; allowed 0–1000000 | counted as 0 |
fixed_costs_monthlyOther monthly costs (USD) | amount without a currency symbol; allowed 0–1000000000000 | counted 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"]