all free tools

agent loop cost calculator

An agent that calls tools does not make one API call per task. It makes one per step, and each call re-sends everything so far: the instructions, the task, and every earlier tool result. Twelve steps can cost several times what the same tokens would cost in one call. Put in the shape of your loop and see the cost turn by turn, with and without prompt caching.

free, no sign-up, runs in your browseropen source on GitHub
the agent
each turn

$0.195 a task, $389 a month

$389API cost per month
$0.1947cost per task
$1,490per month without caching
73.9%caching saves
336,600input tokens processed per task
45,100context on the last turn
$0.0143first turn costs
$0.0180last turn costs
$0.000$0.048$0.096turn 1turn 6turn 12
cost of each turn, cachedwithout caching

same loop on every model

modelper monthper task
Claude Fable 5.2$1,438$0.7189
Claude Opus 5.5$779$0.3894
Claude Sonnet 5.5$389$0.1947
Claude Haiku 5.5$22$0.0112

Every call re-sends the whole conversation, so input grows by 3,100 tokens a turn. Reading the same tokens once, in one call, would cost $0.1490: the loop costs 1.3× that. Caching assumes the shared prefix is warm and turns follow within the 5-minute cache lifetime. Claude API list prices, checked 2026-11-10; Haiku 5.5 switches to its long-context rate on turns over 100K tokens.

questions

why does cost grow faster than the number of steps?

Because input grows every turn. Turn ten reads the instructions, the task and nine tool results; turn eleven reads all of that plus one more. Total input grows roughly with the square of the number of turns, so halving the steps more than halves the input bill.

how is caching modelled?

With a cache breakpoint at the end of each prompt. On every turn, what the previous turn sent is read from cache and only the new tool result and output are written. The shared system prompt and tool definitions are assumed warm, which holds when tasks keep arriving within the 5-minute cache lifetime.

what does output kept in context mean?

The share of each turn's output that later turns re-read. Tool calls and visible text stay in the conversation. If your setup drops earlier thinking from the history, lower this to the visible share.

how do i bring the cost down?

Fewer turns (let a tool do more per call), shorter tool results (return the fields the agent needs, not the whole record), caching on, and a smaller model for steps that only route or extract. The model table shows the same loop on every Claude model.

more free tools

Want the numbers checked against your own process? Book a 20-minute call.