Vikas Goel

Free tool

AI Agent Cost Calculator

Your agent bill isn't driven by the model's price. It's driven by how much context the agent re-sends on every step, and that grows quadratically. Move the sliders to see what your agent really costs, and what it costs once you stop re-sending everything.

Your agent

10
2,000 tokens
1,000 tokens
2,000 tokens

Input tokens per run

Naive agent

155,000

$0.46 / run

Optimized agent

54,500

$0.16 / run

You cut

65%

of input tokens

Saved / month

$30,150

$46,500 → $16,350

Model: naive re-sends full history each step (quadratic); optimized keeps a 500-token running summary and passes tool results by reference (linear). Percentages are architecture-driven; dollar figures use your inputs. Replace with your own numbers.

How the numbers work

A naive agent re-sends its full history and every past tool output each step, so total input tokens are N·S + (R+T)·N·(N−1)/2, where N is steps, S the system prompt, R reasoning per step and T tool output per step. The optimized agent keeps a short running summary and passes tool results by reference, so its cost grows linearly. The full derivation, with the five techniques ranked by impact, is in What an AI agent actually costs in tokens.

When agents run other agents

Multi-agent systems are where this bites hardest. Each agent pays its own quadratic, and a downstream agent usually inherits the upstream output as context it re-sends again. Put a summary and a by-reference handoff at every agent boundary, or the cost multiplies far faster than the step count suggests.

Cheap and wrong is still expensive

Cutting cost is half the job. An agent that is cheap but confidently wrong costs more than any token bill. That's the other half of the architecture, covered in Deterministic AI Agents. If you're getting an agent into production and want a second pair of eyes on cost and reliability, that's the work I do as a fractional AI CTO.

Frequently asked questions

How much does an AI agent cost to run?

It depends mostly on how many steps the agent takes and how much context it re-sends each step, not on the model's per-token price. A naive 10-step agent with a 2,000-token system prompt and 3,000 tokens of reasoning plus tool output per step uses about 155,000 input tokens per run. At $3 per million input tokens that is about $0.47 per run, or roughly $47,000 a month at 100,000 runs. Use the calculator on this page with your own numbers.

What happens to AI token costs when agents run other agents?

They compound. Every agent in a chain that re-sends its full history pays the quadratic cost on its own steps, and when one agent feeds another, the downstream agent often inherits the upstream output as context it re-sends again. Multi-agent systems can multiply token spend far faster than step count suggests. Passing results by reference and keeping running summaries at every agent boundary is what keeps the cost linear.

Why do AI agent costs grow quadratically?

Because a naive agent re-sends the whole conversation and every past tool output on each step. Step 2 re-reads step 1, step 10 re-reads steps 1 through 9. Total input tokens follow N·S + (R+T)·N·(N−1)/2, and the N·(N−1)/2 term is quadratic in the number of steps.

How do you reduce AI agent token costs?

Replace old turns with a running summary (context compaction), store large tool outputs and pass a short reference instead (tool-result externalization), cache the static system prompt and tool schema, route trivial steps to a cheaper model, and constrain outputs to a schema. Compaction and externalization deliver most of the savings because they remove the quadratic term.

Built by Vikas Goel, founder of Thinkerwave AITech. Free to use and share; please link back if you cite it.