An agent task is rarely a single API request. A planning stage may call a model, a retrieval stage may call tools, and a final stage may call a model again with the retrieved material. Your cost estimate needs that workflow, not just the user’s initial message.
Write down one completed task
Start with the stages you can measure: planning, retrieval, reasoning, and response. Record the model, billed input, and billed output for each model call. Include system instructions and tool schemas. Later calls may include earlier messages and tool results, making them more expensive than the first call.
Keep a tool’s own fee separate from the model tokens used to request and read it. For example, a search-call fee and the model’s input charge for search results can both apply. Confirm the exact platform’s rules in its official pricing source.
A small example
Using synthetic rates of $1 per million input tokens and $5 per million output tokens, a planning call with 2,000 input and 500 output tokens costs $0.0045. A response stage with 8,000 input and 1,500 output tokens costs $0.0155. If the task also makes two tool calls at an entered $0.01 each, its total is $0.04.
Forty tasks per normal paying user cost $1.60 monthly. A customer doing five times that activity costs $8. If 10% of paying users are heavy, expected AI cost is $2.24 per paying user before free users and other expenses. These are arithmetic examples, not a vendor quote.
Retries need evidence
Not every failure is billed. Inspect request usage or invoices and enter additional billable attempts. An extra-billed-usage value of 20% multiplies the component cost by 1.2; it does not claim a particular failure probability.
For a stage whose context varies substantially, compare a representative measured task with a separate high-context scenario. A single average can hide the upper tail. Token counts also differ by model tokenizer, so changing providers is a cost comparison under your entered counts, not a quality benchmark.
Price the monthly business
After calculating the task, add monthly tasks per customer, heavy-user behavior, free-user consumption, payment fees, and operating costs. Use contribution margin to understand whether each additional customer helps, then use break-even to understand fixed costs.