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,000monthly 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
- GPT-6.1 Sol vs Claude Sonnet 5.5
- GPT-6 Astra vs Claude Opus 5.5
- Claude Sonnet 5.5 vs Gemini 4 Argon
- Grok 4.7 vs GPT-6.1 Sol
- Grok 4.7 vs Claude Sonnet 5.5
- Gemini 3.8 Flash vs GPT-6 Luna
- Claude Haiku 5.5 vs GPT-6 Luna
- DeepSeek V4 Pro vs GPT-6.1 Sol
- DeepSeek Flash (V4.1 Flash 1017) vs Gemini 3.8 Flash
- Claude Opus 5.5 vs Gemini 4 Argon
- Grok Build 0.1 vs DeepSeek V4 Pro
- MiniMax M3 vs DeepSeek Flash (V4.1 Flash 1017)
- Claude Opus 5.5 vs GPT-6.1 Sol