Loading...

Agent Cost

AI Agent Cost & Latency Calculator

Estimate the total token cost and latency of an agent run: multiple steps, tool calls, and growing context across a loop.

Updated FreeNo signup

10 steps

Latency assumptions

$0.4063

1m 37s

132,500

5,000

A 10-step run on GPT-5.4 moves 137,500 tokens and costs about $0.4063 (with context growing each step — the usual driver of agent cost). Cost per step averages $0.0406.

Latency is a rough estimate — real speed varies with load, output length, and tool round-trips. Tune the assumptions above.

TL;DR

A multi-step agent's cost is dominated by growing context, not just step count. A 10-step agent at ~2k input / 500 output tokens per step costs roughly $0.1000 on GPT-4o and $0.2250 on Claude Opus 4.8 with flat context — and several times that once context accumulates. Set your steps, tokens, and model above; the worked-example table is below.

Worked example: a 10-step agent

Updated Jul 5, 2026

A 10-step agent at 2,000 input and 500 output tokens per step (flat context) costs, per run:

Cost of a 10-step agent run by model
ModelCost / runPer step
DeepSeek V4 Flash$0.004200$0.000420
GPT-4o mini$0.006000$0.000600
Gemini 2.5 Flash$0.0185$0.001850
Gemini 2.5 Pro$0.0750$0.007500
GPT-4o$0.1000$0.0100
GPT-5.4$0.1250$0.0125
Claude Sonnet 5$0.1350$0.0135
Claude Opus 4.8$0.2250$0.0225

Real agents accumulate context each step, so their cost grows faster than this flat example — enable "context accumulates" in the tool to see it.

How it works

Per step, cost = (inputTokens ÷ 1e6) × inputPerM + (outputTokens ÷ 1e6) × outputPerM, summed over steps. With "context accumulates" on, the input for step i grows to base + (i−1) × (input + output), approximating how each turn appends the prior output and the next tool observation to the prompt.

Latency = steps × (time-to-first-token + output ÷ output-speed + tool latency). The speed, TTFT, and tool-latency assumptions are adjustable because they vary by provider and load. Prices come from the shared cost calculator data layer, verified 2026-07-05.

FAQ

How much does an AI agent cost per run?
It depends on steps, tokens per step, and model. A 10-step agent at 2,000 input / 500 output tokens per step (flat context) costs about $0.1000 on GPT-4o and $0.2250 on Claude Opus 4.8. Real agents accumulate context each step, so costs usually run several times higher — use the calculator with 'context accumulates' on.
Why does agent cost grow faster than the number of steps?
Because context accumulates. Each step appends the model's previous output and the new tool result to the prompt, so the input tokens billed on step N include everything from steps 1..N-1. A 20-step loop can cost far more than twice a 10-step loop even at the same per-step output.
How do I estimate agent latency?
Total latency ≈ steps × (time-to-first-token + output tokens ÷ output speed + tool latency). Output speed (tokens/sec), TTFT, and per-step tool time are all adjustable here because they vary widely by provider, model, and load. Treat the number as a rough planning estimate, not a guarantee.
How do I reduce agent token cost?
Cut steps (better planning, fewer tool calls), trim what you feed back into context (summarize or drop old tool results), use prompt caching for the stable system prompt and tool definitions, and route cheap steps to a smaller model. Reasoning-heavy models also spend hidden thinking tokens, which this tool folds into output tokens.