AI Agents & AutomationFree calculatorPDF, Excel, Word export

AI Agent Cost Per Task Calculator for Tool-Calling Loops

A tool-calling agent re-sends its whole conversation on every step, so input tokens grow roughly with the square of the step count. This calculator makes that visible and prices a task and a month of tasks.

Your numbers

8 steps
tokens

System prompt, tool definitions and the user request.

tokens

ERP query results are often truncated rows. Measure yours.

tokens

Reasoning text plus the tool call arguments.

$ per 1M
$ per 1M

Your results

Cost per task
$0
Cost per month
$887
Total input tokens per task
88,600
Each step re-reads everything before it.
Total output tokens per task
2,000
Context size at the last step
16,150

Assumes no prompt caching and no context trimming. Real providers may charge differently for cached input or long contexts.

Save results:

Cost per task as steps increase

Sweeps Tool-calling steps per task from 1 to 40, holding your other inputs fixed.

Agent cost model review

Share your step counts and we will sanity check the cost model against your ERP workload. Optional.

Optional. The tool and every export work without this. No spam.

How to use it

Set the number of tool calls a typical task needs, the starting prompt size, and the average size of each tool result. Add output tokens per step and your model's prices. The cost per task is the headline. Then drag the steps slider to see what happens when the agent takes twice as many steps because of a vague tool or a failing query. The chart plots cost per task from one to forty steps, which shows the curve bending upward rather than rising in a straight line.

Formula and reading the result

At step i the input is the base prompt plus all earlier results and outputs, so the sum over n steps is n times base plus (result + out) times n(n-1)/2. Output tokens are simply n times the per-step output. Multiply each by its price per million. If the last-step context approaches your model window, the real agent will fail or need truncation, regardless of cost.

  • Halving tool result size often saves more than switching models.
  • Cutting steps has a compounding effect.
  • Prompt caching on the stable base prefix reduces the first term.

Common mistakes

Teams often price one call and multiply by the step count, which understates cost because later calls are larger. Another mistake is ignoring retries and failed tool calls, which add steps. For ERP agents, unfiltered list queries can return thousands of tokens per call; capping rows and returning only requested fields is the cheapest optimization. Add a hard step limit and a budget guard so a confused agent cannot spend unbounded tokens on one task.

Frequently Asked Questions

Why does cost grow faster than linearly with steps?

Because each step includes all previous messages as input. Step ten carries nine steps of history. The sum of those growing inputs scales with steps squared, while output scales linearly.

Does caching remove the quadratic growth?

It lowers the price of the repeated prefix, so growth is cheaper, but the context still gets longer and uncached portions such as new results are billed normally. Check your provider's cache pricing and minimum sizes.

How do I measure average tool result size?

Log the token count of each tool response for a week of real tasks and take the mean or median. ERP queries vary widely, so also look at the 95th percentile to find outliers worth truncating.

Does this apply to self-hosted models?

The token growth does, but the price is replaced by GPU time and capacity. Use your measured tokens per second to convert total tokens into GPU seconds, or compare with an on-prem cost calculator.

Netray builds ERP agents with step limits, trimmed results and models served on your own GPUs, which changes this cost curve. We can model your workload with you.