Skip to content

AI Agent Cost Calculator

Work out what an AI agent costs per task, per day and per month. Every turn re-sends the whole conversation, so the cost grows faster than the number of steps.

More options
Measure text in

About 0.75 words, 4 characters or 1/667 of a page per token for English text.

Sent at the start of every call.

The user's request and any files given at the start.

Model calls (steps) the agent makes to finish one task.

The model's reply or tool call each turn.

What each tool sends back: search results, file contents, logs.

Your prices

Example price — check your provider. These only show a range per million tokens (input / output); they aren't any provider's price.

Prices are per
Prices are in

Use 22 for weekdays only.

Prompt caching

0 if writing costs the same as input.

Of the repeated part. Lower it if calls are far apart and the cache expires.

Context and thinking

Older turns are dropped or summarised past this size. 0 = no limit.

Reasoning tokens, billed as output, not kept in the context.

Sub-agents

Helpers that each run their own loop, often in parallel.

Uses the same output and tool result per turn as above.

A cheaper model for some steps
Retries and tool fees

Share of tasks that fail and run again in full.

e.g. a paid API or sandbox, in your currency.

e.g. a web search API. Turns − 1 tool calls per loop.

ResultUpdates as you type—A month—Per task—A day—Caching could save a month—Input tokens per task—Of which read from cache—Output tokens per task—Biggest context

Turn by turn, main agent

Per task, by part

How your agent's cost is worked out

The context grows every turn, every call re-sends it, then tokens × prices, then tasks × days.

  1. 1

    The context grows

    6,000 to start
    + 1,800 a turn
    turn 20: 40,200

  2. 2

    Every call re-sends it

    20 × 6,000
    + 1,800 × 190
    = 462,000 in

  3. 3

    Tokens × prices

    462,000 in: $1.39
    6,000 out: $0.09
    no fees
    = $1.48 a task

  4. 4

    Over a month

    × 100 tasks a day
    × 30 days
    = $4,428

Read more: the formula, a worked example and ways to cut the bill

An AI agent works in a loop: it calls the model, the model asks for a tool (search, read a file, run code), the tool's result is added to the conversation, and the model is called again. The model has no memory between calls, so every call re-sends the whole conversation so far. That is why agents use far more input tokens than you might expect from the number of steps.

The formula

context at turn i = system prompt and tools + task input + (i − 1) × (output per turn + tool result per turn)
input tokens per task = turns × (system + input) + (output + tool result) × turns × (turns − 1) ÷ 2
output tokens per task = turns × (output + thinking per turn)
cost per task = input tokens × input price + output tokens × output price + fees (token counts ÷ 1,000,000 when prices are per million)
with caching: repeated tokens × hit share × input price × read % + all other input × input price × (1 + write extra %)
with retries: everything × (1 + retry share)
a month = cost per task × tasks a day × days a month

Worked example

An agent has a 5,000-token system prompt with tool definitions and gets a 1,000-token task. It takes 20 turns; each turn the model writes 300 tokens and the tool sends back 1,500. Example prices: 3 per million input tokens and 15 per million output tokens (shown here in US dollars; any currency works the same). It runs 100 tasks a day, 30 days a month.

  • Context: the first call sends 5,000 + 1,000 = 6,000 tokens. Each turn adds 300 + 1,500 = 1,800, so the 20th call sends 6,000 + 19 × 1,800 = 40,200 tokens.
  • Input tokens: 20 × 6,000 + 1,800 × (20 × 19 ÷ 2) = 120,000 + 1,800 × 190 = 120,000 + 342,000 = 462,000 per task.
  • Output tokens: 20 × 300 = 6,000.
  • Cost per task: 462,000 × $3 ÷ 1M = $1.386, plus 6,000 × $15 ÷ 1M = $0.09, so $1.476.
  • A month: $1.476 × 100 × 30 = $4,428 ($147.60 a day).
  • With caching (reads at 10% of input, writes at 25% extra, 90% hits): the repeated part is the 5,000-token system prompt on turn 1 plus the previous call on turns 2–20, 5,000 + 19 × 6,000 + 1,800 × 171 = 426,800 tokens. 90% of that, 384,120 tokens, is read at $0.30 per million ($0.115236); the other 77,880 are written at $3.75 per million ($0.29205). With the $0.09 of output, a task costs $0.497286, saving $0.978714 (66%) a task, or $2,936.14 a month.

Ways to cut an agent's bill

  • Turn on prompt caching. Almost every call repeats the call before, so caching usually saves more on agents than on anything else.
  • Trim tool results. Big tool results are re-sent on every later turn. Return only the lines the model needs.
  • Fewer turns. Because the context grows each turn, input tokens grow roughly with the square of the turns: 40 turns cost about 3.6 times as much input as 20 here, not twice.
  • Set a context limit or summarise. It stops each call growing, but it also breaks the cache after the system prompt, so check both settings.
  • Use a cheaper model for simple steps such as reading files or formatting, and sub-agents with short, fresh contexts for side tasks.

What this calculator assumes

  • Every turn but the last adds its output and a tool result to the context. Thinking tokens are billed as output and not kept.
  • Turn 1 can read the system prompt and tools from a cache left by an earlier task. Turn i can read the whole of turn i − 1. Anything not read from the cache is written to it.
  • Past the context limit, the oldest turns after the system prompt are dropped each turn, so only the system prompt and tools stay cacheable.
  • A second model's turns are spread evenly, so its price is blended by its share of turns. Switching models can break the cache in practice.
  • A retried task runs again in full, including its fees. The sub-agents' answers to the main agent are assumed to be part of its tool results.

No provider prices are built in: enter what you pay. The example buttons only show a range and aren't any provider's current price. Rules checked 2026-10-18.

Common questions

Why do AI agents cost so much more than a single chat reply?

An agent calls the model many times for one task, and every call sends the whole conversation so far: the system prompt, the tool definitions, the task and every earlier reply and tool result. The context grows each turn, so the input tokens grow much faster than the number of turns. In the worked example, 20 turns use 462,000 input tokens, 77 times the 6,000 tokens of the first call.

How do I work out the input tokens of an agent task?

Add up the context size of every call. If the first call is S + U tokens and each turn adds O output tokens and T tool-result tokens, the total over N turns is N × (S + U) + (O + T) × N × (N − 1) ÷ 2. Doubling the turns roughly quadruples the input tokens once the added turns dominate.

How much does prompt caching save on an agent?

A lot, because almost all of each call is the same as the call before. With cache reads at 10% of the input price, writes at 25% extra and 90% of the repeated part hitting the cache, the worked example drops from 1.476 to about 0.497 a task, a 66% saving.

Are thinking tokens billed?

Yes. Reasoning or thinking tokens are usually billed at the output price even when you don't see them. Many providers don't keep them in the context for the next turn, so this calculator bills them as output only and doesn't add them to the context.

What does a context limit do to the cost?

Once the conversation reaches the limit, older turns are dropped or summarised, so each call stops growing. That caps the input tokens per call, but the start of the conversation shifts every turn, which breaks the prompt cache for everything after the system prompt.

Do sub-agents save money?

They can. Each sub-agent starts with a short, fresh context instead of the main agent's long one, so many short loops can cost less than one very long loop. But each sub-agent also re-sends its own system prompt and tools, so many tiny sub-agents can cost more. Try both in Advanced.

Related calculators

LLM API cost calculatorMonthly AI API bill, with caching and batch, across models.Prompt caching savings calculatorHow much caching your system prompt or documents saves: cost with and without the cache, hit rate from cache lifetime, and break-even reads per write.Context window calculatorWhat fits in an AI model's context window: words, pages, chapters and lines of code, how much your text uses, room for the reply, chat turns, images and RAG chunks.AI token counterCount tokens, words and characters in your text, exact for OpenAI, with cost per model and context-window fill.

Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

Embed this calculator on your site

Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

AI agent cost calculator by Zulu Calculator ↗