How it works
An agent calls the model again after every tool use, and each call re-sends the whole conversation so far. Input at step k = starting context + (k − 1) × (tokens added + output per step), so total input over s steps = s × start + (added + output) × s(s − 1) ÷ 2. From step 2 on, the part that was already sent in the previous step can be read from the cache at the cached price. Output = steps × output per step. The cost grows roughly with the square of the number of steps, which is why long agent runs get expensive.
⚠ Estimates for information only — not financial advice.
FAQ
How can I make agents cheaper?
Cache the fixed start of the prompt, keep tool results short (return only what is needed), summarise old steps, and use a smaller model for simple steps.
Why is my real bill higher?
Agents may retry failed steps, think before answering (billed as output) or write to the cache at a premium. Compare with the usage numbers in your API logs and adjust the inputs.
Checked 10 Nov 2026. Token accounting for multi-step tool use (each model call re-sends the conversation), with default list prices from our AI price file (Anthropic official pricing page, checked 10 Nov 2026).