AI Agent Cost PlannerFree · runs in your browser

Know the bill before the loop

What will your AI agent cost per run?

Estimate worst-case cost from steps, context growth and retries, then get hard caps to paste into your agent.

Describe your agent

Tool results and messages each step adds to the context. The model's own output is added too.

Your cost at a glance

Typical run$4.4925 steps, 10% retries
Worst-case run$29.9850 steps, 20% retries, no cache
Worst-case per day$5,995200 runs

Per month: $26,968 typical · $179,856 worst case

Context grows each step

typicalworst casemax_steps cap

Suggested caps

max_steps: 30
max_tokens_per_run: 1180000
daily_budget_usd: 1349

Estimates only. Prices from the AI API Cost Calculator, updated . A month is 30 days.

Why agents cost more than you expect

A chatbot answers once and stops. An agent works in a loop: it reads the task, calls a tool, reads the result, decides what to do next and calls another tool, until it thinks the job is done. Every one of those steps is a separate request to the model, and every request carries the whole conversation so far.

That last part is what surprises people. Step one sends the system prompt, the tool definitions and the task. Step two sends all of that again, plus the first tool result and the model's first reply. By step twenty the agent is paying to re-read everything it has seen and written in the previous nineteen. The bill does not grow in a straight line with the number of steps; it grows with the area under a rising line.

Input for step i = starting context + (i − 1) × (tokens added + output per step)Cost per run = cost of all steps × (1 + retry rate) × parallel agents

The calculator applies each model's published price per million tokens to every step, bills the cached share of input at the cached price, multiplies by retries and parallel agents, and then by runs per day and 30 days a month.

A worked example

The page opens on a mid-sized agent running on Claude Sonnet 5.5, priced at $2 per million input tokens, $0.10 per million cached input tokens and $10 per million output tokens. It starts with 8,000 tokens of instructions and tools, each step adds 1,500 tokens of tool results and writes 600 tokens, and a run takes 25 steps.

Notice where the money goes. Output is under 2% of the tokens but about 15% of the cost, and the rest is input: the agent re-reading its own history. That is the opposite of a chatbot, where output usually dominates, and it is why the levers that matter for agents are different.

Why the worst case is so much bigger

Agents do not stop on schedule. A tool returns an error and the agent tries again, a search comes back empty and it rephrases, or it never becomes confident the task is done and keeps checking. The worst case here assumes three things go wrong at once:

For the default agent that is $29.98 per run, almost seven times the typical run, and about $5,995 for a day where every run goes badly. Nobody expects every run to hit the worst case, but a budget that cannot survive a bad day is a budget that will be broken by one.

Caps that hold

A cost estimate helps you plan; a cap is what protects you when the plan is wrong. The calculator suggests three, and you can copy them as YAML:

When a cap trips, stop cleanly: save what the agent has done, return a clear message, and log the run so you can see why it ran long. A capped run that fails loudly is far cheaper than an uncapped one that succeeds eventually.

Six ways to cut an agent's bill

  1. Trim tool results. Tokens added per step is usually the biggest lever. Return the fields the agent needs, not whole web pages or full API responses. Halving it from 1,500 to 750 takes the default run from $4.49 to $3.46.
  2. Cache the stable prefix. Keep the system prompt and tool definitions identical and at the very start of every request. Raising the cached share from 50% to 90% takes the default run to $1.72.
  3. Compact the history. Every few steps, replace old tool results with a short summary. The context stops growing as fast, and so do the late steps.
  4. Use a smaller model for routine steps. Planning may need a large model; reading a file or formatting output rarely does. The same agent on Claude Haiku 5.5 costs $0.23 per run.
  5. Check for success early. Give the agent a clear test for "done" so it stops when the task is complete, instead of spending steps double-checking.
  6. Fix the retries at the source. Flaky tools, vague schemas and outputs that fail to parse all multiply the bill. A retry rate that drops from 10% to 2% is a 7% saving on every run.

What the estimate leaves out

Hidden reasoning tokens are billed as output, so add a thinking budget to output per step if your model thinks before acting. Charges for search, code execution or other hosted tools, cache write premiums, batch discounts, taxes and enterprise pricing are not included. Prices are standard pay-as-you-go text prices; long-prompt price tiers are applied step by step where a provider publishes one.

Questions

Why does an agent's cost grow faster than its number of steps?

Each step sends the whole conversation so far: the starting prompt plus every tool result and reply from earlier steps. Late steps therefore cost far more than early ones, and doubling the steps roughly quadruples the part of the bill that comes from that growing history.

What counts as a retry?

Any model call you pay for but have to repeat: a tool call that failed, an answer that did not parse, a rate-limit error after the request was billed, or a run you restart from the top. The retry rate is the share of extra work on top of a clean run, so 10% means every ten steps of real work cost eleven.

Should I count prompt caching?

Only for the part of each request that is identical from call to call and sits at the start, usually the system prompt, tool definitions and earlier turns. If your agent edits its instructions mid-run or waits longer than the provider keeps a cache warm, set a lower share. The worst case always assumes no cache hits.

How do I find my real numbers per step?

Every response from the OpenAI, Anthropic, Google and DeepSeek APIs reports the input and output tokens it billed. Log them for a few real runs: the first call gives the starting context, the growth between calls gives tokens added per step, and the output figure gives output per step.

Where do I put the suggested caps?

Put max_steps in your agent framework's step or turn limit. Check max_tokens_per_run against the usage your code adds up after every model call, and stop the run once it is passed. Enforce daily_budget_usd in your own code before starting a run, because provider spending limits are usually monthly and can react late.

How current are the prices?

They come from the AI API Cost Calculator on this site, where every price was read from the provider's official pricing page. The date under the results is the newest check. Prices can change without notice, so confirm on the provider's page before you set a budget.