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.
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.
| Model | Peak step input | Cost per task | Monthly | With pruning | Pruning saves / mo |
|---|
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.
| Steps | Input tokens | Total tokens | GPT-5.6 Sol / task | GPT-5.6 Sol / mo | GPT-5.6 Luna / mo |
|---|---|---|---|---|---|
| 1 | 2,000 | 2,300 | $0.0140 | $84.00 | $4.56 |
| 2 | 5,800 | 6,400 | $0.0352 | $211.20 | $11.28 |
| 4 | 18,800 | 20,000 | $0.0992 | $595.20 | $31.20 |
| 8 | 66,400 | 68,800 | $0.3136 | $1,881.60 | $96.96 |
| 16 | 248,000 | 252,800 | $1.09 | $6,528.00 | $332.16 |
| 32 | 956,800 | 966,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.
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.
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 kept | Input tokens | Cut | GPT-5.6 Sol / mo | Saved / mo (Sol) |
|---|---|---|---|---|
| 0 — drop them all | 24,400 | 63.3% | $873.60 | $1,008.00 |
| 1 | 34,900 | 47.4% | $1,125.60 | $756.00 |
| 2 | 43,900 | 33.9% | $1,341.60 | $540.00 |
| 4 | 57,400 | 13.6% | $1,665.60 | $216.00 |
| 8 — keep everything | 66,400 | 0.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.
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.
What this calculator does not model
Agent frameworks differ in ways this arithmetic cannot see.
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.
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.