Everyone quotes AI cost as a per-token price: "GPT-4o is $2.50 per million input tokens." That number is real, and also almost useless for budgeting an agent. A single chat message is one API call. An agent completing a task is often dozens of calls — reading tools, retrying, re-reading a growing context, thinking step by step. The per-token price barely moved; your bill moved 50×. This is why the first real API invoice shocks people.
Every LLM call costs: (input tokens × input rate) + (output tokens × output rate), priced per million tokens. A rough sense of the spread in 2026:
| Model | Input /1M | Output /1M |
|---|---|---|
| GPT-4o | $2.50 | $10.00 |
| Claude Sonnet 4 | $3.00 | $15.00 |
| Gemini 2.5 Pro | $1.25 | $10.00 |
| Grok 4.5 | $2.00 | $6.00 |
| GPT-4o mini | $0.15 | $0.60 |
| DeepSeek V4 Flash | $0.14 | $0.28 |
One modest chat call — say 1,500 input and 500 output tokens — on GPT-4o costs about $0.0088. Feels like nothing. That feeling is the trap.
An agent doesn't make one call per task. It loops. A single "handle this support ticket" or "research this and write it up" task typically fans out into many model calls:
Say one agent task = 20 model calls, and because context grows, the calls average 8,000 input + 1,200 output tokens on Claude Sonnet 4 ($3 / $15 per 1M):
That's from a task that "only" costs 84 cents. Change the model, the call count, or the context size and the monthly number swings by 10× in either direction — which is exactly why guessing doesn't work. Run your own numbers in the calculator →
The single biggest lever. If every step re-sends the full history, input tokens dominate the bill. Trim history, summarize old turns, and use prompt caching where the provider supports it — cached input can be 10× cheaper.
Using a flagship model for routing, classification, or simple tool selection is pure waste. A mini/flash model at 5–20× lower cost handles most sub-steps fine; save the expensive model for the hard reasoning.
Output is 3–5× the price of input on most models, and thinking tokens bill as output. Cap max tokens, and dial reasoning effort down when a task doesn't need it.
An agent with no step limit can loop forever on a task it can't finish — burning money on every turn. Always cap the number of steps.
A lot of runaway loops start as a design problem rather than a budget one: an agent with no defined scope or escalation rule will keep improvising instead of stopping and handing off. Northbench's guide to building an AI employee that actually works covers that structure — scope, SOPs, escalation, and a definition of done.
Everything above is the expected bill. The scary bill is the unexpected one: a retry storm, an infinite tool loop, a prompt-injection that hijacks your agent, or a leaked key someone else is now spending. Any of these can run 20–100× your normal rate for hours before you notice — and by the time a monthly invoice or a delayed provider limit reacts, the money is gone.
This is the gap every provider's native control leaves open. Their limits are delayed (OpenAI up to 24 hours), account-wide (one runaway takes everything down), or monthly — none of them stop one agent's next call in real time. We break that down provider by provider:
A self-hosted proxy that meters every AI call in real time, per agent, and hard-stops a runaway at the budget you set — across OpenAI, Claude, Gemini, Grok, Groq, DeepSeek, Mistral, and OpenRouter. Your keys and prompts never leave your server. One line to install.
Cap your agent's bill — from $99/yr →An AI agent's cost isn't the per-token price — it's that price multiplied by every call the agent makes re-reading its own growing context and thinking out loud. Budget for the multiplier, trim what you can, and put a real-time per-agent cap in front of the runaway you can't predict. The math is manageable once you can see it.