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.
$0.195 a task, $389 a month
same loop on every model
| model | per month | per 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
- ai roi & token cost estimatorMonthly Claude API cost, cost per task and ROI for a workload
- eu ai act compliance auditorRisk tier, obligations and dates for one AI system
- agent workflow fit scorerIs this process a good fit for AI agents, and what shape?
- ai build vs buy calculatorThree-year cost: SaaS tool, custom agents, or keep it manual
- ai accuracy proof calculatorHow many test cases prove a vendor's accuracy claim?
- ai model routing calculatorWhat sending each request to the cheapest capable model saves
- human review staffing calculatorHow many reviewers an AI workflow's escalations need
- ai vendor scorecardWeighted comparison of AI vendors, with must-haves and a swing check
- gdpr dpia screener for aiDoes this AI use of personal data need a DPIA?
- llm judge agreement calculatorDoes your LLM judge agree with people beyond chance? Cohen's kappa
Want the numbers checked against your own process? Book a 20-minute call.