The number on a model's pricing page — say $3 per million input, $15 per million output — describes exactly one thing: a single call, with no cache, that stops after one reply. An agent is none of those. It runs a loop, resends a transcript that grows every turn, and — on a reasoning model — spends tokens you never see. If you priced your product off the sticker number, your real bill is arriving 5–10× heavier, and you found out from the invoice instead of a spreadsheet.

Here is the spreadsheet. The point is not a precise forecast; it's to cost the thing you actually ship — a completed task — instead of a token.

The formula, in one line#

For a single agent task, sum this over every turn the loop runs:

per_task_cost =
  turns × (
      uncached_input × in_rate × (1 − cache_hit)
    + cached_input   × in_rate × 0.1          // a cache READ ≈ 10% of a fresh input token
    + output         × out_rate
    + thinking       × out_rate               // reasoning models only; billed as output
  ) ÷ 1_000_000

Everything expensive about agents is in the parts the pricing page omits: the turns multiplier, the split between fresh and cached input, and that last thinking-token line that bills at the output rate and never shows up in your prompt.

Price your product against cost-per-completed-task, not cost-per-token. The token is what the provider sells; the task is what your customer buys.

The three variables that move the number#

1. Cache hit rate — the ~90% lever. An agent's system prompt, tool definitions, and few-shot examples are byte-for-byte identical on every single turn. A cache read is billed at roughly a tenth of a fresh input token, so marking that stable prefix cacheable can cut the input line by about 90% on a multi-turn loop. The catch: the cache write costs a premium (~1.25× input) and entries expire on a short TTL, so caching wins precisely when the same prefix is reused many times, fast — which is the definition of a loop. If you take one thing from this piece, it's: cache the prefix, then measure the real savings rather than assuming them.

2. Output-to-input ratio — the 3–5× tax. Output tokens typically cost 3–5× what input tokens cost. So a verbose agent — one that narrates its reasoning in prose, echoes the whole file it just edited, or returns unbounded tool results — has a bill dominated by what it writes, not what it reads. Constraining output format (structured over prose, diffs over full files, capped list lengths) often saves more than switching models.

3. Thinking-token share — the invisible one. On a reasoning model, the tokens spent "thinking" are generated and billed at the output rate, and they don't appear in the prompt you assembled. On a hard task they can dwarf the visible output. That's a feature when the reasoning earns its keep and a silent margin-killer when you left maximum effort on for a task that didn't need it. Tune reasoning effort per task type, the same way you'd tune a benchmark instead of trusting one headline number.

A worked example#

Take a mid-complexity coding-agent task on a model priced at $3 in / $15 out. Say it runs 8 turns, carries a stable 6,000-token prefix (system + tools), accumulates about 4,000 fresh input tokens per turn as the transcript grows, and writes 800 output tokens per turn, with light reasoning.

Neither number is the pricing page's "$3 per million." The pricing page never mentioned turns, and turns are where agents live.

The founder move#

Compute cost per completed task, then multiply by your retry rate (a task that fails and reruns costs double), then divide it into your price to get a gross margin per action. That single number tells you whether a feature is a business or a liability — the same lesson the market re-learned when agent-software spending hit $206B and the cancellations followed the ones whose unit economics never closed.

And re-run the sheet on every price move. When OpenAI cut a flagship model 80% three weeks after launch, every unit-economics deck built in early July went stale overnight. A price cut is one input to the worksheet, not a reason to reflex-switch: a cheaper model with a worse output ratio, weaker tool-calling (more retry turns), or fatter default reasoning can cost more per completed task at a lower sticker rate. Decide on the task, not the token.

The pricing page answers "what does a token cost." Your customers are buying finished actions. Cost those.