All tools
Cost · free, no sign-up

How much does one agent task actually cost?

An agent resends the entire conversation on every turn, so history is billed again each time it grows. The cost is quadratic in turns, which is why agent bills surprise people.

6 inputs5 questions answeredUpdated for 2026 hardware
Agent Loop Cost Calculator — How much does one agent task actually cost?
Answer first

The short answer

Computed from this tool’s default settings — turns in the task and the rest as most people start. Change them below for your own case.

Cost per task$1.560

A 20-turn task bills about 445K input tokens — 11.7× the 38K of actual content, because every turn resends the history. Prompt caching is the fix: the prefix is identical every turn, so a high hit rate cuts the dominant term to a tenth.

The calculator

Agent Loop Cost Calculator

Why a coding agent bills far more than the tokens you think you sent.

Your setup
20

One turn is one model call — a tool use and its result.

Resent on every single turn unless it is cached.

Tool output plus the model’s own reply, which both stay in the history.

0
Cost per task$1.560

A 20-turn task bills about 445K input tokens — 11.7× the 38K of actual content, because every turn resends the history. Prompt caching is the fix: the prefix is identical every turn, so a high hit rate cuts the dominant term to a tenth.

Billed input445K tok
Content you wrote38K tokWhat people assume they pay for
Resend multiplier11.7×
Output15K tok
TurnsBilled inputCostPer turn
555K$0.221$0.0442
10148K$0.555$0.0555
20445K$1.560$0.0780
401,490K$4.920$0.1230
805,380K$17.040$0.2130
Inputs

What each setting changes

Every input moves the result for a reason. This is what each one does and where to find the value for your own machine.

SettingDefaultWhat it changes
Turns in the task20 turnsOne turn is one model call — a tool use and its result.
System prompt and tools8000 tokensResent on every single turn unless it is cached.
New content per turn1500 tokensTool output plus the model’s own reply, which both stay in the history.
Input price3 per 1MYour own figure in per 1M, starting from 3. Change it to match what you actually run.
Output price15 per 1MYour own figure in per 1M, starting from 15. Change it to match what you actually run.
Prompt cache hit rate0 %Anywhere from 0 to 100 %.
Worked examples

Real answers across turns in the task

The same calculation run at a range of settings, with everything else left at its default. These are computed by the tool itself, not written by hand.

Turns in the taskCost per taskBilled inputContent you wroteResend multiplier
1$0.0358K tok10K tok0.8×
26$2.379696K tok47K tok14.8×
51$7.5352,321K tok85K tok27.5×
75$15.1314,763K tok121K tok39.5×
100$25.8008,225K tok158K tok52.1×

A 1-turn task bills about 8K input tokens — 0.8× the 10K of actual content, because every turn resends the history. Prompt caching is the fix: the prefix is identical every turn, so a high hit rate cuts the dominant term to a tenth.

Method

How this is calculated

No lookup tables and no invented constants. Here is the arithmetic, so you can check it against your own numbers.

An agent resends the whole conversation on every turn, so the history is billed again each time it grows. Total input is the sum of a growing prefix, which is quadratic in the number of turns — doubling the turns roughly quadruples the input cost, not doubles it.

This is why prompt caching matters more for agents than for anything else. The prefix is identical turn to turn, so a high hit rate turns the quadratic term into a tenth of itself.

These are well-founded engineering estimates, not benchmark results. Your quantisation, runtime and context length all move the real number, and usable memory is an assumption rather than a specification. See the full methodology for every assumption behind these figures.

Use cases

Who this is for

The three situations that bring people to this calculation.

Use case 01

Running coding agents

See what a task really costs.

Use case 02

Bill investigation

Find the resend multiplier behind the number.

Use case 03

Evaluating caching

Quantify what a cache hit rate saves.

Walkthrough

How to use this calculator

Four steps, no account, nothing leaves your browser.

  1. Set turns in the task

    Start at the top of the panel. Every figure recalculates as you change it — there is no submit button, because watching the number move is the point.

  2. Adjust the rest to match your setup

    5 further settings: system prompt and tools, new content per turn, input price, output price, prompt cache hit rate. Defaults are the common case, so change only what differs for you.

  3. Read the headline, then the table

    The large figure answers the question. The table underneath shows how the answer changes across nearby settings, which is usually where the decision actually gets made.

  4. Check it against the method

    The arithmetic is written out above. If a number looks wrong for your hardware, the assumptions are the first place to look — usable memory and quantisation are the two that vary most.

Questions

How much does one agent task actually cost: common questions

The questions people ask about this, answered without hedging.

Why is my agent bill so much higher than my token count suggests?

Because the conversation is resent every turn. Twenty turns of 1,500 new tokens is 30,000 tokens of content but roughly 300,000 tokens of billed input, since turn twenty pays for everything turns one to nineteen produced.

Why do coding agents cost so much?

Because every turn resends the whole history. Twenty turns of 1,500 new tokens is 30,000 tokens of content but roughly 300,000 tokens of billed input — turn twenty pays for everything the first nineteen produced.

Does doubling the turns double the cost?

No, it roughly quadruples it. The billed input is the sum of a growing prefix, which grows with the square of the turn count.

How do I make agents cheaper?

Prompt caching first — the prefix is identical each turn, so a high hit rate cuts the dominant term to a fraction. Then keep tool output terse, and start fresh tasks rather than continuing one long session.

Is a cheaper model the answer?

Sometimes, but a weaker model often takes more turns to finish, and turns are the term that grows quadratically. Cost per task can rise even as cost per token falls.

The rest of the set

All 50 run on the same arithmetic, so answers across them agree.

Coverage

Searches this page answers

Different ways of asking the same question, all resolved above.

agent cost per taskwhy is claude code expensivecoding agent token costllm agent cost calculatoragent loop token usageprompt caching agentscost per task ai agenthow much does one agent task actually costagent loop cost calculatoragent loop cost calculator onlinefree agent loop cost calculator
Next step

Now find the models that fit

Sizing is only half the problem. Model Radar takes your hardware and shows which models actually run on it, ranked by what they are good at — the same arithmetic as this page, applied to every model worth running.