Multi-Turn AI Agent Cost Calculator

Simulate compounding input token bills as conversation history, tool outputs, and reasoning loops grow across every agent turn.

8 turns
Monthly Agent Spend (30d)Uncached
$0.00

$0.00 per run across 0 monthly runs

Cost per Run
$0.00
Cumulative Tokens / Run
0
Context Replay Multiplier
1.0x
Caching Impact
$0.00/mo
Cost Breakdown per RunMax turn: 0 tok
Context 0%
Tools 0%
Output 0%

Transparent Formula & Methodology

Dataset: 2026-11-27

In a stateless multi-turn agent loop of N turns, let S be static system and tool schema tokens,U₀ the initial user prompt, ΔU new user/environment tokens per turn, T_tool tool output payload tokens appended per turn, and O assistant output tokens per turn.

Total_Input_Tokens = N·(S + U₀) + [N·(N − 1) / 2] · (O + T_tool + ΔU)

The cumulative tool-payload replay term [N·(N − 1) / 2] · T_tool is isolated so you can see exactly how much of your input bill is caused by re-sending prior tool outputs. When Prefix Prompt Caching is enabled, turn 1 writes the static schema at the provider's cache-write rate and each subsequent turn t ≥ 2 reads the prior prefix I_(t−1) at cachedInputPer1M while paying write/input rates only on the new turn delta.

Frequently Asked Questions

Why does multi-turn AI agent cost grow quadratically instead of linearly?

LLM APIs are stateless, so every new turn must resend the system prompt, initial query, and all prior user, assistant, and tool-call messages. Across N turns, earlier tokens are re-billed roughly N(N-1)/2 times, turning linear step counts into quadratic token totals.

How does prompt caching reduce multi-turn agent bills?

Prompt caching lets the provider reuse key-value state for the static system prompt and the growing conversation prefix from previous turns at cached read rates (up to 75% to 90% cheaper than standard input), charging write/full input only on the newly appended delta.

Why do tool-call results inflate agent costs so rapidly?

Raw JSON payloads, web scrapes, and SQL or file outputs returned by tool calls are appended into the message history. A single 2,000-token tool output on turn 2 gets replayed across every remaining turn unless summarized or pruned.

How can I cap runaway multi-turn agent spend in production?

Set strict max-turn limits, trim or summarize older tool stdout payloads before appending to history, enable prefix prompt caching on static tool schemas, and route planning or summarization steps to a lower-cost fast model.