Skip to content

Build1 publisher3 min readPublished

A 20-turn agent run bills 656,000 input tokens for 59,000 tokens of reading

A dev.to walkthrough prices one research agent off Anthropic's published rates for Claude Sonnet 5 and finds prompt caching takes the same twenty turns from $1.37 to $0.33. The workload behind those numbers is the author's own invention.

The Engineer · Build desk

Illustration accompanying A 20-turn agent run bills 656,000 input tokens for 59,000 tokens of reading

What happened

  • A dev.to walkthrough builds a 20-turn research agent on paper and finds that about 59,000 tokens of read material bill as 656,000 input tokens, because every turn resends the whole history.
  • The post prices that run off Anthropic's published pricing page, using Claude Sonnet 5 at $2 per million input tokens and $10 per million output tokens.
  • Prompt caching takes the same 20-turn run from $1.37 to $0.33, a 76% cut, with hits billed at a tenth of the input price.
  • Doubling the same job to 40 turns multiplies the uncached cost by 3.6, so the price per task grows faster than the turn count.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint A per-task price cannot be read off a per-token rate once each turn carries every earlier turn complete; the estimate has to be summed over per-turn contexts, and that sum depends on tool-result sizes the operator often does not control.
  • cost Instructing an agent to be terse aims at the 4% of the invoice that output tokens account for, so whoever quoted the job at a fixed price keeps paying the other 96%.
  • decision Cache economics now turn on step latency: a team whose tool calls stream for minutes has to buy the longer cache window or accept a fresh write between turns.
  • capability Because context editing and compaction are documented platform features, dropping used tool results is a supported call instead of custom plumbing around the message array.

The 656,000 figure comes out of the post's own assumptions, and it reproduces exactly. The fixed prefix is 6,200 tokens: system prompt, tool definitions, task [7]. Each turn adds 2,800 tokens to the history, about 300 written by the model and about 2,500 returned by the tool [8][9][10]. Turn n therefore bills 6,200 plus (n minus 1) times 2,800, and twenty turns sum to 124,000 plus 532,000, or 656,000 input tokens [2]. At $2 per million that is $1.31, and the 6,000 output tokens add $0.06 [6].

Those are invented numbers, and the author says so. "These are my assumptions, not anyone's production numbers, so swap in your own," the author wrote [22]. The ratio they produce is roughly 11 billed tokens for every token read [1]. For that to transfer to your job, your tool results have to average around 2,500 tokens, which is the figure Anthropic's pricing page uses for an average fetched web page [9], and the history has to survive the run untrimmed, since each turn's input carries every earlier turn complete [5].

Caching is priced so that the break-even is one read. A hit bills at 0.1x the input price against 1.0x uncached, so each hit saves 0.9x; a five-minute write adds 0.25x, which one hit clears, and the one-hour write adds 1.0x and needs two [3][3]. The docs give the same payback [14]. Two defaults decide whether you collect it. Prefixes are assembled in a fixed order, tools, then system, then messages, so a timestamp near the top makes a fresh write of everything below it [15]. The lifetime is counted from the start of the request. A response that streams for four minutes leaves about one minute for the next call to land a hit [16].

Tool definitions ride along on every request, because tool use bills on everything sent, including definitions, calls and results [6]. The pricing page puts the browser use toolset at about 6,600 input tokens per request and computer use at about 4,500 [19]. Twenty uncached turns of browser definitions come to 132,000 input tokens before a single page is read [20]. At $2 per million that is $0.26, close to a fifth of the $1.37 run [4].

The post prices a single model, Claude Sonnet 5 [2], so it does not test whether a cheaper model changes the curve. It does show how far the same model moves on structure. Splitting a 40-turn job into two 20-turn runs, with a short written handoff between them, bills $2.74 instead of $4.98, about 45% less [21][5]. Overnight classification, bulk enrichment and eval suites can go through the Batch API, which takes 50% off in both directions [24][3]. In my view the first thing to check is whether the prefix stays byte-identical between turns, because the rest of the caching column depends on it.

There is a quality claim in the same docs. The post quotes Anthropic's context windows page: "As token count grows, accuracy and recall degrade" [18].

What to watch

  • Whether the browser and computer use toolsets keep their published per-request token counts as tools are added to them.
  • Whether context editing invalidates the cached prefix beneath the tool results it removes, which decides if trimming and caching compose.
  • Whether Batch API pricing stacks with cache-hit pricing on the same request.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories