Tool · Last verified 2026-08-23

Agent Loop Cost Calculator

Short answer: an agent re-sends everything it has already done, on every step. At a 2,000-token system prompt, 300-token outputs and 1,500-token tool results, an 8-step task sends 66,400 input tokens and 2,400 output tokens — 75.9% of the input is history the model already read. That costs $0.0162 – $0.3920 per task, or $96.96 – $2,352.00 a month at 200 tasks a day. Set your own loop below.

Live calculator

Price your loop

Six inputs: the block every step re-sends, what the model writes per step, what each tool returns, how many steps a task takes, how many tool results you keep, and how many tasks you run a day.

—tokens per task
—of input is re-read history
—cost per task, cheapest to dearest
—monthly at this volume
Cheapest model—
Dearest model—
Pruning saves, per month—
ModelPeak step inputCost per taskMonthlyWith pruningPruning saves / mo
Step input grows: — from the first step to the last. Pruning tool results: keeping the last few in full cuts input tokens by —. Quadratic: input tokens grow with the square of the step count — twice the steps is roughly four times the input. Pricing data verified —
The curve

Doubling the steps quadruples the reading

Same 2,000-token system prompt, 300-token outputs and 1,500-token tool results — only the step count changes. Monthly figures are 200 tasks a day, 6,000 a month.

StepsInput tokensTotal tokensGPT-5.6 Sol / taskGPT-5.6 Sol / moGPT-5.6 Luna / mo
12,0002,300$0.0140$84.00$4.56
25,8006,400$0.0352$211.20$11.28
418,80020,000$0.0992$595.20$31.20
866,40068,800$0.3136$1,881.60$96.96
16248,000252,800$1.09$6,528.00$332.16
32956,800966,400$4.02$24,115.20$1,217.28

Eight steps cost 22.40x one step on GPT-5.6 Sol, and sixteen cost 3.47x eight: the line bends because input tokens grow with the square of the step count while output grows only linearly. The last step of an 8-step loop sends 14,600 input tokens against the first step's 2,000 — 7.3x. This is the shape where cutting context pays back fastest, and where model choice matters most: the same 8-step loop is $96.96 a month on GPT-5.6 Luna and $2,352.00 on Claude Opus 5, a 24.3x spread.

Where it goes

75.9% of the input is already read

Of the 66,400 input tokens an 8-step task sends, 50,400 are prior outputs and tool results the model has already seen. Only 16,000 are the system prompt, re-sent once per step. Nothing new is being read in those 50,400 tokens — the loop is paying to re-read its own transcript.

Tool results are the bulk of it. Each step appends 300 tokens of model output and 1,500 tokens of tool output, so 83.3% of everything added to the trajectory is tool payload — a database dump, a search page, a file diff. It is cheaper per token than output because it is billed as input on the next step, but there is five times more of it, and every later step pays for it again.

That points at the highest-return fix: keep the reasoning chain, drop the payloads. Pruning tool results keeps every step's model output — the part that carries the plan — and drops the bulky observations once they are no longer the most recent.

66,400 input tokensAn 8-step task at the defaults: 50,400 history, 16,000 re-sent system prompt.
2,000 → 14,600First step to last step — every step re-reads the whole trajectory.
83.3% tool payload1,500 tool tokens against 300 output tokens added per step.
2,400 output tokensEverything the model actually wrote, across all eight steps — 3.5% of the task.
Pruning

Keep the last few tool results

Same 8-step loop, same 2,000-token system prompt and 300-token outputs. Only the number of tool results kept at full size changes — older ones are dropped, model outputs are always kept.

Tool results keptInput tokensCutGPT-5.6 Sol / moSaved / mo (Sol)
0 — drop them all24,40063.3%$873.60$1,008.00
134,90047.4%$1,125.60$756.00
243,90033.9%$1,341.60$540.00
457,40013.6%$1,665.60$216.00
8 — keep everything66,4000.0%$1,881.60$0.0000

Pruned monthly cost is the pruned input at 6,000 tasks a month plus the same 2,400 output tokens. Cutting the system prompt cannot match this: halving it from 2,000 to 1,000 tokens removes only 8,000 tokens across eight steps, a 12% cut, against 33.9% from keeping two tool results. The payload is where the money is. Across the eight tracked models the same pruning saves $27.00 – $675.00 a month at 200 tasks a day.

Headroom

How long a loop can run

A loop stops being a cost problem long before it stops fitting. At the default shape, 32 steps peak at 57,800 input tokens — comfortably inside every window we track, all 8 of 8. The binding constraint is arithmetic, not capacity: the same 32 steps cost $4.02 per task on GPT-5.6 Sol, $24,115.20 a month at 200 tasks a day.

The one cliff to watch is OpenAI's long-context rule. Above 272,000 input tokens in a single step, the input rate roughly doubles and the output rate rises by half. At the default shape a loop needs 152 steps before any step reaches 273,800 tokens — far past the point where the bill has already become the problem. Bigger tool payloads get there sooner; the live table flags how many steps cross the line for your own numbers.

Practical reading: budget steps, not tokens. A hard step cap is the only control that bounds an agent's spend, because cost per task rises with the square of whatever the cap allows. See What Is a Context Window? for the limits themselves.

32 steps: 57,800 peak8 of 8 tracked models still fit — capacity is not the constraint.
152 steps to 272KWhere the default shape finally triggers OpenAI's long-context rates.
$4.02 per taskWhat those 32 steps cost on GPT-5.6 Sol, against $0.0140 for one step.
Cap the stepsCost per task is quadratic in the step budget; nothing else bounds it.
Boundaries

What this calculator does not model

Agent frameworks differ in ways this arithmetic cannot see.

One model, one loopNo routing between a planner and a worker model, no cheap tier for tool formatting. Mixing tiers is one of the biggest real-world savings and is not modelled here — price each tier separately.
No cachingA stable system prefix repeated every step is exactly what prompt caching targets. These figures are the uncached ceiling; a cached prefix can remove most of the 16,000 re-sent system tokens.
No retries or failuresLoops that retry, backtrack or call tools twice send more tokens than planned. A failed 8-step run still bills every step it took.
No parallel tool callsSteps that fan out to several tools at once change the token shape; model them as one step with a larger tool result.
Your inputs, your architectureStep counts, output sizes and tool payload sizes are yours — we publish no claims about how agents should be built, only what each token costs.
Verified data onlyPer-1M rates come from official provider documentation, re-verified weekly — see how we verify and the pricing changelog.
FAQ

Agent loop cost questions

Why does a multi-step agent cost so much more than a single call?

Because every step re-sends everything that came before it. At the defaults on this page — a 2,000-token system prompt, 300-token outputs and 1,500-token tool results — one step sends 2,000 input tokens and eight steps send 66,400, 33.2x. Cost grows almost as fast: $0.0140 for one step against $0.3136 for eight on GPT-5.6 Sol, 22.40x. Input tokens grow with the square of the step count, so doubling steps roughly quadruples the input half of the bill.

How much of an agent's bill is re-read history?

75.9% at the defaults on this page. Of 66,400 input tokens across an 8-step task, 50,400 are prior outputs and tool results the model has already seen once; only 16,000 are the system prompt, sent once per step. That share rises with step count, which is why long loops are the most expensive shape in LLM billing.

What is the cheapest way to cut agent cost?

Stop re-sending old tool results. Keeping only the last two tool results in full drops input tokens from 66,400 to 43,900 — a 33.9% cut worth $540.00 a month on GPT-5.6 Sol at 200 tasks a day. Keeping none drops them to 24,400, 63.3% off, worth $1,008.00 a month. Pruning preserves the reasoning chain while removing the bulky payloads, which is why it beats shortening the system prompt.

Do tool results cost more than the model's own output?

They are cheaper per token, because tool output is billed as input on the next step, but there is far more of it. At the defaults each step adds 1,500 tool tokens against 300 output tokens, so tool results are 83.3% of everything appended to the trajectory — and they are re-sent on every subsequent step.

When does OpenAI's long-context surcharge hit an agent loop?

When a single step's input exceeds 272,000 tokens, which roughly doubles the input rate and adds 50% to the output rate. At the default shape on this page that takes 152 steps, where the step input reaches 273,800 tokens. A 32-step loop peaks at 57,800 tokens and never triggers it. The live table flags how many steps cross the threshold for your own inputs.

Does this page upload my agent parameters?

No. Step counts, token sizes and task volume stay in this browser tab. There is no form, no account, no API call and no storage — the arithmetic runs against the same published per-1M rates the rest of the site uses.

Methodology

Where these numbers come from.

Step i of an agent loop sends the system prompt plus everything appended by the previous steps, so input tokens are system + (i − 1) × (output + tool result). Summed over n steps that is n × system + (output + tool result) × n(n − 1) / 2 — quadratic in the step count. Output tokens are n × output per step. The pruned variant keeps every step's model output but only the last k tool results, so its input is system + (i − 1) × output + min(i − 1, k) × tool result. Cost per task sums input tokens ÷ 1,000,000 × the input rate and output tokens ÷ 1,000,000 × the output rate step by step; monthly is cost per task × tasks per day × 30. OpenAI steps above 272,000 input tokens use the higher long-context rates, flagged in the table. Token rates are re-verified weekly against official provider documentation: OpenAI 2026-08-23, Anthropic and Google 2026-08-09 to 2026-08-16. Caching, batch, retries, parallel tool calls, routing and taxes are excluded throughout.

Official sources: OpenAI model docs, Anthropic pricing, Google Gemini API pricing.

Retrieval-shaped loopsChunk size, top-k and overlap: RAG Context Cost Calculator.
Chat-shaped growthThe same re-send curve in a human conversation: Conversation Cost Growth Calculator.
Price any request shapeInput, output and volume into monthly spend: API Cost Calculator.
Trim what you sendRepeated instructions and markup: Prompt Weight Analyzer · HTML Token Savings.
How pricing worksPer-1M rates, two counters and the formula: How LLM Token Pricing Works.
The output premiumWhy generated tokens cost 5.00x–8.33x more: Input vs Output Tokens.
Windows and capsHow much context you actually get: What Is a Context Window? · Context Window Checker.
Seven cost leversRanked by return, from model choice to re-sent history: How to Reduce LLM API Costs.
Provider rate cardsOpenAI · Claude · Gemini · all three.
Price directionIs token pricing going up or down? The eight-model basket index reads 87.1 against its 2026-08-09 baseline — down 12.9%, with both cuts scheduled to lapse: LLM Pricing Index.
A fourth providerDeepSeek prices input three ways — a cache-hit rate, a cache-miss rate and a peak/off-peak clock — at $0.30/$1.20 per 1M tokens on flash at peak, exactly half off-peak, with a 384,000-token output cap: DeepSeek API Pricing.
How we verifySources, weekly cadence and what our estimates exclude: Methodology · Pricing changelog.