What does an agent loop actually cost?

Multi-step agents resend their full history on every step, so cost grows quadratically with step count, not linearly. A single-turn chat calculator will badly underestimate it, so model the real shape instead.

Prices updated Nov 29, 2026150 models20 providers
Start from
Cheapest for this loop

Solar Mini 4.5 (Preview) costs $0.0020 per task, $9.91 a month for 5,000 tasks.

Best value

Claude Haiku 5.5 is the cheapest strong model (ECI 160+): $0.0203 per task, $102 a month.

Quadratic growth

Step 1 sends 3,000 input tokens, step 16 sends 15,750. The task sends 150K in total, 3.1× what a flat estimate of 3,000 per step would give.

Input tokens on each step

One task, 16 steps

150,000 input tokens and 4,480 output tokens per task, before the 18% retry overhead

Grey is the fixed context resent every step (system prompt and tool schemas). Purple is the history that has built up from earlier steps, which is why the bars climb.

The same loop on every model

ModelInput /1MOutput /1MPer taskPer monthvs cheapest
1UpstageSolar Mini 4.5 (Preview)$0.010$0.040$0.0020$9.91cheapest
2DeepSeekDeepSeek V4 Flash 0423OpenVolatile$0.016$0.031$0.0030$14.98+51%
3NVIDIANemotron 3.5 LightningOpen$0.020$0.096$0.0040$20.24+104%
4Inkling 2 MiniOpen$0.026$0.105$0.0052$25.79+160%
5QwenQwen3.7 Flash$0.030$0.130$0.0060$29.99+203%
6TencentHy4 flashOpen$0.035$0.140$0.0069$34.68+250%
7DeepSeekDeepSeek V4 Flash 0731OpenVolatile$0.045$0.136$0.0087$43.42+338%
8UpstageSolar Mini 4$0.050$0.200$0.0099$49.54+400%
9DeepSeekDeepSeek V4.1 FlashOpenVolatile$0.051$0.203$0.0101$50.50+410%
10IBMGranite 4.2 8BOpen$0.060$0.150$0.0114$57.06+476%
11NVIDIANemotron 3.5 Super VLOpen$0.060$0.350$0.0125$62.35+529%
12QwenQwen3.6 35B A3BOpenVolatile$0.050$0.700$0.0126$62.75+533%
13QwenQwen3.5-Flash$0.065$0.260$0.0129$64.40+550%
14Z.AIGLM 4.7 FlashOpen$0.061$0.400$0.0129$64.56+552%
15QwenQwen3.5-9BOpenVolatile$0.080$0.130$0.0148$74.24+649%
16MiniMaxMiniMax M3.1 FlashOpenVolatile$0.075$0.300$0.0149$74.30+650%
17NVIDIANemotron 3 SuperOpen$0.075$0.400$0.0154$76.95+677%
18AnthropicClaude Haiku 5.5$0.100$0.500$0.0203$101.72+927%
19MetaMuse Ember$0.100$0.500$0.0203$101.72+927%
20OpenAIGPT-6 Luna$0.100$0.500$0.0203$101.72+927%
21OpenAIGPT-6 Luna Pro$0.100$0.500$0.0203$101.72+927%
22GoogleGemma 4 31BOpen$0.133$0.223$0.0247$123.60+1148%
23QwenQwen3 Coder NextOpen$0.120$0.800$0.0255$127.35+1185%
24TencentHy3Open$0.132$0.528$0.0262$130.78+1220%
25XiaomiMiMo-V2.6-FlashOpen$0.140$0.280$0.0263$131.30+1225%

Fixed context is resent every step, plus the accumulating history from prior steps, the real shape of a stateless chat-completions loop. Retry overhead is a flat multiplier on total cost.

Why agent costs grow quadratically, not linearly

Chat-completion APIs are stateless — every call resends the full conversation, not just the new part. In a tool-using agent loop, each step's response (and the tool's observation) gets appended to that history, so by step N you're resending everything from steps 1 through N-1 on top of the new content. If each step adds roughly T tokens of new context, total input tokens across N steps work out to approximately T × N(N+1)/2 — quadratic, not linear, growth. Double the step count and the token bill doesn't double, it roughly quadruples. This is the actual mechanism behind the commonly-cited "agents use 4-15x more tokens than chat" figures.

What the inputs mean

Fixed context is what's resent unchanged on every single step — your system prompt plus every tool's schema definition. Tool schemas aren't free: real-world measurements put the average around 700 tokens per tool definition, so an agent with a dozen tools can spend a meaningful chunk of its context budget before any real work happens. Context added per step is the growing part — the model's own response plus whatever the tool returned, both of which get resent on every subsequent step. Output tokens per step is only what the model actually generates each turn (billed at the output rate), which is typically smaller than the total context growth per step, since tool observations aren't LLM-generated but still count as input on the next call.

Why the presets differ so much

The four starting presets are grounded in real step-count data rather than round numbers: coding agents commonly run 12-30 steps per task (SWE-bench agent trajectories average in that range), while a simple lookup-and-answer loop might resolve in 3-4. Because cost grows with the square of step count, that difference matters far more than it looks — a coding agent isn't just "4x more steps" expensive than a simple loop, it's closer to 15-20x on the input-token side alone.

What this doesn't model

This is a planning estimate, not a trace replay: real agents don't take a fixed number of steps every time, context isn't always a clean linear accumulation (some frameworks prune or summarize older history), and retry behavior varies a lot by task. Use the retry-overhead field to sanity-check a range rather than treating the output as exact. For a single-turn (non-agentic) estimate, use the regular calculator instead.

Frequently asked questions

Why does cost grow quadratically instead of linearly with step count?
Because chat-completion APIs are stateless and resend the full conversation on every call. By step N, you're resending everything accumulated from steps 1 through N-1, so total input tokens scale roughly with the square of the step count, not the step count itself.
How much context do tool definitions actually cost?
Real measurements of MCP servers found tool-schema overhead averaging around 700 tokens per tool, with some heavier tools running 1,000+ tokens each — in tool-heavy setups this can consume 30-50% of the context budget before any real work happens.
Is this the same as the regular calculator?
No. The regular calculator models single-turn chat (one request, one response). This models a multi-step agent loop where each step resends the accumulating history, which produces a very different — and much larger — cost shape for the same nominal traffic volume.
Why include a retry/failure overhead input?
Agent tasks fail and retry more often than single-turn chat calls — tool-call errors, rate limits, and multi-step reasoning failures all add real, billed tokens that a naive per-task estimate misses. The retry field applies that as a flat percentage on top of the modeled cost so you can see a realistic range.