AI Agent Cost Calculator

  • The agent re-reads its full history at each step, so its cost grows quadratically with the number of steps.
  • Prefix caching bills the repeated system prompt and tool definitions at the cheaper cache read rate.
  • Truncating tool results and summarizing the history keep the input from growing endlessly.
  • The calculator gives an order of magnitude for budgeting, not an exact invoice, since paid tools are excluded.

How much does an autonomous AI agent cost? This calculator estimates the cost of a task performed by an agent in several steps, then its monthly cost, taking into account the growing history, tool calls, cache, and sub-agents.

How to use it

  1. Choose a starting model (research agent, code agent, support agent, or data entry agent): its assumptions fill the scenario and remain editable.
  2. Select a model from the list, or enter your own price per million tokens.
  3. Adjust the scenario: system prompt and tools, number of steps (average, minimum, maximum), tool calls, generated tokens, retry rate, sub-agents, and the share of input served by the cache.
  4. Enter the number of tasks per day and working days per month, then read the cost per task, the monthly cost, the cumulative cost curve, the breakdown, alternative models, and cost-saving levers.

Why an agent’s cost increases with the number of steps

An agent re-reads its entire history at each step: the system prompt, its own outputs, and its tool results. The input cost of each step is therefore higher than the previous one, and the cost of the entire task grows quadratically with the number of steps, not linearly. The calculator shows this with a cumulative cost curve and compares the last step to the first.

Principles behind the calculation

  • At step k, the input equals the system prompt and tools, plus k-1 times the generated tokens, plus k-1 times the tool results; the output equals the tokens generated per step.
  • With cache, the effective input price is the share served by the cache multiplied by the cache read price, plus the remainder multiplied by the normal input price. The system prompt of the first step is billed at the cache write price when the model has one.
  • The total is multiplied by one plus the retry rate, then by one plus the number of sub-agents multiplied by their relative cost.
  • Some models apply a different rate beyond a context threshold: it is applied to the relevant steps. If the maximum context is exceeded during the task, the tool indicates at which step this happens.
  • Prices are OpenRouter’s public rates per million tokens, updated daily; conversion to euros uses an exchange rate updated with them.

How to reduce an agent’s cost

  • Enable prefix caching: the system prompt and tool definitions, identical at each step, are re-read at the cache read rate.
  • Truncate tool results: send only the useful part of a page or file to the agent.
  • Summarize the history every few turns so the input doesn’t grow endlessly.
  • Change the model: the alternative models table replays the same scenario on the three cheapest models, among those with a comparable index.

For independent queries, without growing history, use the API cost calculator instead. To check if a history fits in a model, try the context window calculator, and to choose between several models, the model comparator.

Limitations to know

The starting models are editorial assumptions, not measurements: the actual cost depends on how your agent behaves. The calculation does not include paid tools (web search, for example), nor the cost of the call that summarizes the history, and the initial task is included in the system prompt. The result is an order of magnitude for budgeting, not an invoice.

Frequently asked questions

What’s the difference with the API cost calculator?

The API cost calculator assumes independent queries. An agent, however, re-reads its history at each step: its cost cannot be deduced from an average query multiplied by the number of steps. With a single step and no tools, both tools give the same result.

Does caching really reduce an agent’s bill?

Yes, when the model offers a cache read rate: the tool applies it to the share of input served by the cache and calculates the savings obtained. For a model without a cache price in our data, the calculation is done without cache and the tool indicates it.

Is my scenario data sent anywhere?

No. The calculation is done in your browser and no data is sent to an AI. The ‘Copy link with my parameters’ link only contains your scenario values.