Skip to content
MyStackCost
Leer en español

AI Agent Cost Calculator

Find out what an AI agent costs when it solves a task in several steps, why it uses many more tokens than a single chatbot reply, and how much you save compared with doing the task by hand.

Your numbers

🤖 Task and model

Each step is one call to the model: think, call a tool, read the result.

$2.00 input · $10.00 output per million tokens (USD). Anthropic official pricing

🧮 Tokens per step

System instructions and tool definitions, sent on every step.

Step k receives S + U + (k − 1) × (O + T) input tokens: it carries every earlier output and tool result.

🔁 Retries and external tools (optional)
%

Tasks that fail and run again from the first step.

USD

For example, a search or data API billed per call. Use 0 if there is none.

🧑‍💼 Compare with a person (optional)
USD

Salary plus benefits and overhead, per hour. Leave the minutes at 0 to skip the comparison.

Results

Cost per task

$0.19

Monthly cost

$374.00

Yearly cost

$4,488

Includes retries (10% of tasks run twice) and external tools.

Input tokens per task
77,000
Output tokens per task
3,300
Tokens vs. a single call
29×
Cost per task done by a person
$6.25
Savings per task
$6.06
Monthly savings
$12,126

A simple one-step query uses 2,800 tokens: S + U input and O output.

Where the cost per task goes
  • Input tokens82% of the cost$0.15
  • Output tokens18% of the cost$0.03
  • External tools0% of the cost$0.00
How the cost per task grows with the number of steps
StepsInput tokens per taskCost per taskMonthly cost
12,750$0.0088$17.60
524,750$0.07$132.00
10(current)77,000$0.19$374.00
20264,000$0.59$1,188

Same model and tokens per step; only the number of steps changes. The cost grows faster than the steps because each step re-sends everything before it.

Cost per task with each model
  • Claude Haiku 5.5Anthropic$0.00935
  • GPT-6 LunaOpenAI$0.00935
  • Gemini 3.1 Flash-LiteGoogle$0.02
  • Gemini 3.8 FlashGoogle$0.07
  • Claude Sonnet 5.5Anthropic · Selected$0.19
  • GPT-6.1 SolOpenAI$0.19
  • Gemini 4 ArgonGoogle$0.19
  • Gemini 3.1 Pro (preview)Google$0.19
  • Claude Opus 5.5Anthropic$0.37
  • Claude Fable 5.1Anthropic$0.94
  • GPT-6 AstraOpenAI$0.94

Results are reference estimates based on the values you enter and the assumptions explained on this page; they are not a quote or financial advice. Official prices are set by each provider and may change, so confirm them on the provider’s website before making a decision.

How the cost of an AI agent is calculated

A chatbot usually answers with one call to the model. An agent solves a task in several steps: it reads the request, decides which tool to use, reads the result, decides again, and so on until it finishes. Each step is a call to the model, and each call re-sends everything that happened before. The calculator adds up the cost step by step:

Input tokens of step k  = S + U + (k − 1) × (O + T)

Input tokens per run    = N × (S + U) + (O + T) × N × (N − 1) ÷ 2
Output tokens per run   = N × O

Model cost per run      = Σ (step input tokens ÷ 1,000,000 × input price
                             + O ÷ 1,000,000 × output price)
Cost per task           = model cost per run × (1 + retry %) × exchange rate
                        + cost per external tool call × calls per task

Monthly cost            = cost per task × tasks per month
Yearly cost             = monthly cost × 12

Where N is the number of steps, S the base context sent on every step (system instructions and tool definitions), U the user’s request, O the output tokens of each step and T the tokens each tool returns. A simple one-step query uses S + U input tokens and O output tokens; the calculator compares the agent with it to show how many times more tokens the agent uses.

Prices come from the list that is updated automatically every day, in US dollars per million tokens. If the input of a step goes over a model’s long-context threshold, that step (input and output) is charged at the higher price; earlier steps keep the normal price. If you pick another currency, the calculator converts the model cost with an editable exchange rate, and the external tool cost and the hourly cost of the person are entered directly in that currency.

Worked example

A software company runs a research agent that answers customer questions about its product. It handles 2,000 tasks a month, and each task takes 10 steps. Every step sends 2,000 tokens of instructions and tool definitions, the customer’s question is 500 tokens, each step writes 300 tokens and each tool returns 700 tokens. 10% of tasks fail and run again from scratch, and each task makes 3 calls to a search API at $0.01 per call. Without the agent, a person needs 15 minutes per task at $25 an hour.

With a model priced at $2.00 per million input tokens and $10.00 per million output tokens (example prices; the calculator uses the current ones):

  • Input tokens per run: 10 × (2,000 + 500) + (300 + 700) × 10 × 9 ÷ 2 = 25,000 + 45,000 = 70,000
  • Output tokens per run: 10 × 300 = 3,000
  • Model cost per run: 70,000 × $2 ÷ 1,000,000 + 3,000 × $10 ÷ 1,000,000 = $0.14 + $0.03 = $0.17
  • With 10% retries: $0.17 × 1.1 = $0.19 of model per task, which is 77,000 input and 3,300 output tokens on average
  • External tools: 3 × $0.01 = $0.03 per task
  • Cost per task: $0.22
  • Monthly cost: $434.00, or $5,208 a year
  • A simple one-step query uses 2,800 tokens, so the agent uses 29× as many tokens
  • The same task done by a person: 15 ÷ 60 × $25 = $6.25. The agent saves $6.03 per task, or $12,066 a month

Amounts are rounded the same way as in the calculator; each step uses the unrounded values.

Input tokens are 71% of the cost per task, output tokens 15% and the search API 14%. Even though each step writes only 300 tokens, the accumulated context makes input the largest item by far.

How the cost grows with the number of steps

With the same tokens per step, retries and tools, this is how the cost changes when the agent needs more or fewer steps:

Steps Input tokens per task Cost per task Monthly cost
1 2,750 $0.04 $77.60
5 24,750 $0.10 $192.00
10 77,000 $0.22 $434.00
20 264,000 $0.62 $1,248

Going from 10 to 20 steps doubles the steps but multiplies the input tokens by more than three. That is the effect of the accumulated context: every new step carries all the previous ones.

Why agents cost much more than a chatbot

Three things make an agent more expensive than a single model call:

  1. The context accumulates. Each step re-sends the instructions, the request and every earlier output and tool result. The last step of a 10-step task reads the whole history, which is why input tokens grow with the square of the steps.
  2. The number of steps multiplies everything. Each step is a full call to the model, with its base context. An agent that takes 20 steps where 10 would do pays more than double.
  3. Retries repeat the whole run. When a task fails halfway and starts again, you pay for both attempts. A retry rate that looks small adds up across thousands of tasks.

Tool results are often the hidden part of the bill. A search that returns ten full web pages, or a database query that returns every column, can add thousands of tokens that the agent then carries on every later step.

How to reduce the cost of an agent

  1. Use fewer steps. Give the agent tools that do more in one call (one search that returns what it needs instead of three narrow ones), and stop the task as soon as it has an answer.
  2. Summarize the context between steps. Instead of carrying every earlier result in full, replace old steps with a short summary. The input of later steps stops growing so fast.
  3. Make tool results shorter. Return only the fields and paragraphs the agent needs. Cutting T from 700 to 300 tokens in the example lowers the input of every later step.
  4. Use the right model for each step. Simple steps, such as choosing a tool or extracting a field, can run on a small, cheap model, while a more capable model handles planning and the final answer. Compare the cost per task of every model in the chart above.
  5. Reduce retries. Validate the inputs before starting, set step limits and resume from the last good step instead of starting from scratch.
  6. Keep the base context lean. System instructions and tool definitions are sent on every step. Remove tools the agent never uses and rules that no longer apply.

Our guide on how to reduce LLM API costs covers more techniques, such as prompt caching and batch processing. To compare the monthly cost of a single model call across providers, use our LLM API cost calculator, and if your assistant answers customers in one call per conversation, our AI chatbot ROI calculator estimates the savings against your support team.

What this estimate does not include

The calculator assumes every step adds the same tokens and every task takes the same number of steps. Real agents vary from one task to the next, so use the average of a sample of real tasks and compare a typical and a pessimistic scenario. It does not include prompt caching or batch discounts, reasoning tokens that some models bill as output, the cost of the infrastructure that runs the agent, or the time spent reviewing its work. Use the result to compare options and set a budget, not as a guaranteed figure.

Frequently asked questions

Why does an agent cost so much more than a single call to the model?

Because every step re-sends the whole conversation so far. Step 10 includes the instructions, the request and the outputs and tool results of the nine steps before it. The input tokens grow with the square of the number of steps, so doubling the steps roughly quadruples the part of the cost that comes from the accumulated context.

What counts as a step?

Each call to the model. A typical agent step is a model call that decides what to do, asks for a tool (a search, a database query, a calculation), and then receives the tool result as input on the next step. If your agent framework logs model calls, count them for a few real tasks and use the average.

How are retries counted?

As tasks that fail and run again from the first step, so a retry costs the same as a full run. With 10% retries, the model cost per task is multiplied by 1.1. Retries of a single step cost less; if that is your case, enter a lower percentage.

Where do the AI model prices come from?

From the same price list as our LLM API cost calculator. It is checked automatically every day against public sources that track the official rates, and the page shows the date of the last update and links to each provider's pricing page. If a step goes over a model's long-context threshold, that step is charged at the higher price.

Does the calculator include prompt caching discounts?

No. Several providers charge less for input tokens that repeat from one call to the next, which is common in agents because each step starts with the same instructions and history. The discounts and conditions vary by provider and model, so the calculator uses the standard price and the result is a conservative estimate.

Is the data I enter stored?

No. All calculations run in your browser. Values only leave your device if you use the share button, which puts them in the link you copy.

About the prices used

Prices updated automatically on October 15, 2026, source: OpenRouter and LiteLLM.

Official pricing pages:

Published:

Why AI agents cost more than you expect

An AI agent can burn dozens of times more tokens than a chatbot. Why accumulated context drives the bill up, with worked examples and ways to bring it down.

LLM API Cost Calculator

Compare the monthly cost of OpenAI, Claude and Gemini models from users, queries per day and tokens per query.