AI agent cost runs from well under a cent to several dollars per completed task, and the model's token price is the smallest part of the spread. Anthropic's own published example processes 10,000 support conversations at roughly 3,700 tokens each on Claude Haiku 4.5 for about $37, which is $0.0037 per conversation. That number only holds if every conversation succeeds on the first try. (Source: Anthropic pricing)

The figure that survives contact with production is cost per successful task: total spend on every attempt divided by the tasks that actually completed correctly. Include model tokens, tool calls, retrieval, execution, retries, monitoring, and human review. A workflow at 60% first-pass success with one retry costs 1.67 times its advertised per-attempt price, before a single human minute is counted.

That denominator changes the buying decision. Token prices tell you what the model charges. They do not tell you whether the workflow finishes the job, how often it retries, or how much review a person must do. This guide gives you an AI agent cost calculator method that works across hosted APIs, agent platforms, and self-hosted infrastructure.

Use the worksheet below to make four decisions:

  • whether the workflow has a viable cost per outcome;
  • whether retries or tool calls are driving waste;
  • what belongs in your AI agent cost per month forecast;
  • which control to change before switching models.

What counts in AI agent cost?

An AI agent is a software workflow that uses a model to choose steps, call tools, inspect results, and continue until it reaches a stopping condition. The model is one cost layer. A browser session, database lookup, sandbox, search request, or approval queue can add cost around it.

Separate variable costs from fixed costs before comparing vendors. Variable costs scale with work. Fixed costs exist even when the agent is idle. Mixing them makes a small test look expensive or a high-volume deployment look cheap.

Cost layerTypical unitWhat makes it grow
Model inferenceInput, cached input, reasoning, and output tokensLong context, verbose answers, repeated loops
ToolsSearch, API, transaction, browser, or code callMore steps, failed calls, large results
Retrieval and memoryEmbeddings, vector search, storage, database readsLarge collections and frequent refreshes
ExecutionContainer, browser, sandbox, or GPU time (see GPU cost per million tokens)Long-running tasks and concurrency
Review and supportHuman minutes, evaluation, incidentsLow confidence, risky actions, edge cases
Fixed operationsPlatform, logging, backups, engineeringProduction requirements and retention

Provider pricing pages expose different pieces of this stack. Anthropic separates input, cache writes, cache hits, and output. Google separates input, output, context caching, and storage. The worksheet keeps those units visible instead of pretending one token rate represents the whole product. When estimating agentic AI latency cost, record model time, tool wait time, timeout retries, and review minutes beside token spend. (Source: Anthropic pricing, Google Gemini pricing, NVIDIA inference TCO)

The AI agent cost per successful task formula

Use this formula for an outcome that has a clear pass or fail state:

Cost per successful task = total cost of all attempts ÷ successful tasks

Total cost includes every attempt, including attempts that time out, call the wrong tool, exceed a token limit, or reach a human. Successful tasks are the runs that meet your acceptance test without hidden correction work. Usage, latency, throughput, and input/output mix all affect the allocated cost of an inference workflow. (Source: NVIDIA inference TCO)

Use a published rate for the worked example instead of assigning arbitrary dollar values to model work. Suppose a month contains 100 initial attempts and 25 retry attempts, all using Claude Haiku 4.5 with the 8,000-input, 800-output token shape used in the next section. Anthropic lists that model at $1 per million input tokens and $5 per million output tokens, so one attempt costs $0.0120. This example covers model tokens only. Keep tool, infrastructure, retrieval, and review charges separate until you have an invoice or usage record for them. (Source: Anthropic pricing)

ComponentCalculationCost
Initial model attempts100 × $0.0120$1.20
Retry model attempts25 × $0.0120$0.30
Model-token total$1.20 + $0.30$1.50
Successful tasks80-
Cost per successful task$1.50 ÷ 80$0.0188

This is a reproducible calculation from a published model rate and an explicit token shape, not a provider bill. Add tool calls, runtime, retrieval, support, and review from measured records before using the result as a budget.

AI agent cost by model at current list prices

The table below prices one agent step at published list rates read on 2026-08-29, holding the task shape constant at 8,000 input tokens and 800 output tokens. That shape is a stated assumption covering a system prompt, tool definitions, retrieved context, and a short structured answer. The last three columns divide the per-attempt cost by first-pass success rate, which is the whole point: the same model costs a different amount depending on how often it finishes the job. (Source: Anthropic pricing, OpenAI pricing)

ModelInput $/MTokOutput $/MTokPer attemptPer success at 95%at 80%at 60%
gpt-5-nano$0.05$0.40$0.0007$0.0008$0.0009$0.0012
gpt-5-mini$0.25$2.00$0.0036$0.0038$0.0045$0.0060
Claude Haiku 4.5$1.00$5.00$0.0120$0.0126$0.0150$0.0200
gpt-5$1.25$10.00$0.0180$0.0189$0.0225$0.0300
Claude Sonnet 5$2.00$10.00$0.0240$0.0253$0.0300$0.0400
gpt-5.4$2.50$15.00$0.0320$0.0337$0.0400$0.0533
Claude Opus 5$5.00$25.00$0.0600$0.0632$0.0750$0.1000

Read the table across, not down. Claude Haiku 4.5 at 60% success costs $0.0200 per completed task, which is more than gpt-5 at 95% success costs at $0.0189, even though gpt-5's headline input price is 25% higher. A cheaper model that fails more often is not a cheaper model. This is why model selection cannot be made from a pricing page alone: you need the success rate on your own acceptance test before the price column means anything. (Source: Anthropic pricing, OpenAI pricing)

Two costs sit outside the token table and are easy to forget. Server-side tools bill separately, with Anthropic charging $10 per 1,000 web searches, or $0.01 per search, on top of the tokens the results consume. Managed agent runtimes add a time charge, with Claude Managed Agents metering session runtime at $0.08 per session-hour while a session is actively running. An agent that makes three searches per task adds $0.03, which exceeds the entire model cost of every row above gpt-5. (Source: Anthropic pricing)

AI agent cost calculator worksheet

Start with a ledger that records one row per task or one aggregate row per fixed workload. Do not estimate success rate from a few impressive demos. Use a defined acceptance test, such as a valid JSON result, a correctly updated record, or a human-approved answer.

InputExampleHow to capture it
Initial attempts100Count task IDs entering the workflow
Retry attempts25Count every additional model or tool cycle
Successful tasks80Apply the acceptance test after the final step
Input tokens2.0 millionProvider usage response
Output tokens0.4 millionProvider usage response
Cached tokens0.8 millionProvider cache usage fields
Tool and API spend$1.20Vendor invoices or request logs
Execution and storage$0.80Container, browser, GPU, and database bills
Review minutes40Approval and correction records
Review rate$0.10/minuteLoaded internal cost assumption

For model costs, store input, output, and cached usage as separate fields. OpenAI exposes cached-token usage in the response, and Langfuse supports separate usage and cost details for input, output, cached tokens, and other usage types. Inferred prices are useful, but provider-reported usage and cost should win when both exist. (Source: OpenAI prompt caching, Langfuse cost tracking)

Add a stop_reason and task_status field. Useful statuses include completed, corrected, escalated, timed_out, and failed. Those fields show whether a cheap model is creating expensive downstream work.

AI agent cost per month: three planning scenarios

Monthly forecasting starts with successful tasks, not raw requests. Multiply the measured cost per successful task by the number of outcomes you need, then add fixed platform and operations costs. Separate peak demand, uptime, and fixed infrastructure from per-task usage so the forecast does not hide idle capacity. (Source: NVIDIA inference TCO)

Monthly planSuccessful tasksCost per successful taskFixed operationsIllustrative monthly cost
Pilot1,000$0.08$120$200
Team workflow5,000$0.12$300$900
Customer-facing20,000$0.18$900$4,500

These are planning examples, not predictions. The higher unit cost in the last row models a tool-heavy workflow with more review and support. Your measured result may fall as utilization improves, or rise when concurrency creates queueing and more retries.

Keep three forecasts beside each other: normal volume, a 3× spike, and a degraded-quality month. The degraded case matters because a provider outage, changed tool schema, or larger context can increase attempts without increasing successful outcomes. NVIDIA's TCO method also treats throughput, latency, peak demand, uptime, and input/output mix as cost inputs rather than optional details. (Source: NVIDIA inference TCO)

AI agent cost optimization that protects success rate

The best AI agent cost optimization changes waste while preserving the acceptance test. Start with the largest measured cost bucket. Provider usage data can expose cached input and output separately, which makes it easier to test whether a prompt or model change actually lowers spend. (Source: OpenAI prompt caching)

  • Cap steps, tokens, elapsed time, and spend per task. Stop the run or request approval when a limit is reached.
  • Route classification, extraction, and simple tool selection to a lower-cost model. Reserve a stronger model for ambiguous or high-risk cases.
  • Keep stable instructions and tool schemas at the start of the prompt. Cache repeated context when the provider's terms make the reuse profitable, and run the prompt caching cost reduction break-even before assuming a cache pays for itself.
  • Limit tool output. A search response that returns ten pages of irrelevant text can cost more in follow-up tokens than the search request itself.
  • Track retries by reason. A retry caused by malformed JSON needs a different fix from a retry caused by a slow external API.
  • Sample human review by risk and confidence. Review every payment action, but sample low-risk read-only tasks.

Langfuse notes that usage buckets must be mutually exclusive. If a provider reports inclusive input tokens plus cached tokens, subtract the cached portion before storing the ordinary input bucket. Otherwise your cost report can count the same tokens twice. (Source: Langfuse cost tracking)

When is an AI agent cheaper than a human?

Compare the agent with the fully loaded human cost for the same accepted outcome. A useful human baseline includes wage, benefits, management, software, waiting time, correction work, and the percentage of tasks that need escalation.

For a quick test, use an explicit planning assumption: a person costing $30 per hour and taking six minutes has a $3.00 variable baseline. Against the table above, even Claude Opus 5 at 60% success costs $0.1000 per completed task, so the model layer is roughly 3% of that baseline. The comparison is almost never lost on tokens.

It is lost on the layers around them. Add three web searches per task at $0.01 each, a quarter-hour of managed session runtime at $0.08 per hour, and one human review minute at the same $30 per hour loaded rate, and the agent's cost per accepted task moves from $0.1000 to roughly $0.65. The human baseline is $3.00. That is still a win, but it is a 4.6x margin rather than the 30x the token price implied, and a second review minute per task takes it to $1.15 and a 2.6x margin. Model choice moves cents; review rate and retry rate move dollars. (Source: Anthropic pricing, Retool AI pricing)

Inference: an agent should not be called profitable because its token bill is small. It is profitable when the value of the accepted outcome exceeds model, tools, infrastructure, review, support, and allocated build cost. Retool's discussion of hybrid human and AI workflows reaches the same practical point: the economic unit should reflect completed work, not an isolated API call. (Source: Retool AI pricing)

FAQ

How much does an AI agent cost per successful task?

Divide the total cost of all attempts by the number of accepted outcomes, then add human review and allocated fixed costs. Token prices alone understate the result because failed attempts, tool calls, execution time, and review still consume resources. Use production traces and an explicit acceptance rule for the denominator. (Sources: Langfuse cost tracking; NVIDIA inference TCO)

How do you calculate AI agent cost per successful task?

Use (model + tools + execution + review + allocated fixed costs) / successful tasks. Count retries and failed attempts in the numerator, but only outcomes that pass the acceptance test in the denominator. Report the time window, workload, model mix, and success definition beside the result. (Sources: Langfuse cost tracking; NVIDIA inference TCO)

How much does an AI agent cost to run per month?

AI agents can cost fractions of a cent or several dollars per accepted task, depending on model usage, tools, retrieval, execution, retries, and review. Measure total spend across all attempts, divide by successful tasks, then add fixed platform and operations costs for a monthly forecast. Provider usage records and infrastructure metrics are the reliable inputs. (Source: Langfuse cost tracking, NVIDIA inference TCO)

Is an AI agent cheaper than a human?

For a repeatable task, usually yes on variable cost, but by less than token prices suggest. A $30 per hour person taking six minutes sets a $3.00 baseline. An agent on a premium model at 60% success, three searches, and one review minute costs about $0.65, a 4.6x margin that shrinks fast as review minutes rise. (Source: Anthropic pricing, Retool AI pricing)

How do retries and human review affect AI agent cost?

Retries increase model, tool, and execution spend without increasing accepted output unless a later attempt succeeds. Human review can dominate cost even when tokens are cheap: multiply review minutes by the loaded hourly labor rate and include that amount in every accepted-task calculation. (Sources: Langfuse cost tracking; Retool AI pricing)

How can you reduce AI agent cost without reducing success rate?

Route simple steps to cheaper models, cache stable context, constrain unnecessary tool calls, and shorten retries only after measuring task acceptance. Optimize cost per successful task rather than cost per request; a cheaper run that fails more often can raise the actual cost of completed work. (Sources: OpenAI pricing; Langfuse cost tracking)

For trace design and model-cost instrumentation, see our Langfuse vs Opik observability comparison. For the infrastructure input, see GPU cost per million tokens. To cut the model layer first, see prompt caching cost reduction.

References