See what your AI agent really costs

How to estimate AI agent costs

A step-by-step method for estimating what an LLM-powered agent will cost before you ship it.

1. Count the model calls per task

An agent rarely calls the model once. Each step in the loop (plan, call a tool, read the result, decide what's next) is usually a separate API request. Count the tool calls a typical task makes and treat each one as one model call.

If you use a reasoning model, count its thinking tokens as output; see are reasoning tokens billed as output tokens?

If much of each call is a repeated prefix, the prompt caching calculator shows how much caching takes off the estimate.

2. Estimate input tokens per call

Input includes the system prompt, tool definitions, conversation history and tool results. Because history grows with each step, use the average across the whole loop, not the first call. As a rule of thumb, one token is about 4 characters of English text.

3. Estimate output tokens per call

Output covers the model's reply, its tool-call arguments and, for reasoning models, thinking tokens, which many providers bill as output.

4. Apply the formula

cost per task = calls × (input tokens × input price + output tokens × output price) ÷ 1,000,000
monthly cost = cost per task × tasks per day × 30

5. Check for discounts and surcharges

  • Prompt caching: repeated prefixes like system prompts and tool schemas are billed at the much lower cached-input price.
  • Batch/flex tiers: several providers offer about 50% off for non-urgent work.
  • Long context: some models charge more above a context threshold (for example 100K or 200K tokens).
  • Peak hours and promos: some prices change by time of day or on a set date. Check the notes on each model page.
  • Tool fees: built-in web search and similar tools are often billed per call on top of tokens.

6. Measure, then re-estimate

Log real token usage from your provider's API responses for a few dozen tasks, then plug the averages into the TokenTab calculator and share the link with your team.

Popular comparisons

Get the TokenTab newsletter

Model price changes and agent cost tips, straight to your inbox. Unsubscribe anytime; we only use your email for this newsletter.