A rate card alone will not tell you what it costs to ship a feature in Claude Code. Every time the agent reads files, edits code, runs tests, and inspects failures, input and output tokens compound across the session. Using the pricing breakdown from Anthropic’s Opus 5.5 guide, this post explains how retry turns and prompt cache reuse shape your actual bill.

At a Glance

  • On API list prices, Opus 5.5 cuts input and output token rates by 20% and cache-read rates by 60% compared to Opus 5.
  • Holding token counts constant, the original post’s example session drops from $3.50 to $2.40, a reduction of roughly 31%.
  • Four variables drive per-task cost: how many turns the loop runs, what share of input hits the prompt cache, how many output and reasoning tokens the model generates, and which model you pick.
  • The most reliable benchmark is running one of your own tasks on both models and comparing the numbers in /usage.

About the Original Post

Addy Osmani published this guide on the claude.dev blog on September 25, 2026. It targets developers running Claude Code with an API key or managing usage across an engineering team. Because every dollar figure in the article comes from list prices applied to worked examples, the author recommends plugging in your own session numbers to verify the math on your workload.

What Drives the Cost of a Single Task

Tokens measure the text a model reads and writes. Your prompt, file contents, and tool outputs count as input tokens, while the model’s replies and internal reasoning count as output tokens.

Claude Code works in a loop: it reads the conversation, calls a tool, inspects the tool result, and decides the next step. Fixing a bug might mean reading a file, applying a patch, running a test suite, and patching again when a test fails. Each pass through that cycle is one turn, and every turn resends the entire conversation accumulated so far, so input size grows as the session continues.

Resending the conversation does not mean paying fresh-input prices every time. When the beginning of a request matches an earlier turn, prompt caching serves that shared prefix at a discounted cache-read rate. Your cache hit rate is the share of total input tokens read from cache rather than billed as new input. In the breakdown below, K stands for thousand tokens and M stands for million tokens:

  • Turn count: Suppose a task’s active context grows from 20K to 120K tokens over 40 turns, totaling roughly 2.8M input tokens. With a 90% cache hit rate, input costs about $1.62. Finishing the same job in 25 turns brings input cost down to about $1.02 because the long conversation history is resent fewer times.
  • Cache reads: Those same 2.8M input tokens would cost $11.20 with no cache at all, versus roughly $0.99 at a 96% cache hit rate. Most of the savings in long sessions come from reading repeated context at cached prices.
  • Output tokens: On Opus 5.5, each output token costs 100 times as much as a cached input token. Generating 60K output tokens ($1.20) costs the same as reading 6M tokens from cache. Internal reasoning (thinking) is billed as output too, so raising effort pushes this number up.
  • Model choice: Input, output, and cache unit rates all shift depending on which model runs the turn.

All worked examples in the original post use Opus 5.5 API list prices per million tokens: $4 for fresh input, $20 for output, and $0.20 for cache reads. The simplified session totals omit the initial cache-write fee, which you still need to include when reconciling a full API invoice.

One practical way to cut wasted turns is giving Claude Code a test or build command upfront. Concrete failure output lets the model fix the exact problem instead of guessing across extra turns.

What Changed in Opus 5.5

The first shift is unit pricing. Cache reads dropped from one-tenth of the fresh-input price on Opus 5 to one-twentieth on Opus 5.5. On Pro, Max, and Team subscriptions, the original post notes that the same plan allowance covers roughly 25% more work than on Opus 5, alongside a higher 5-hour rolling cap. Keep subscription usage allowances separate from API dollar billing when reading these numbers.

For API-key users running long agent sessions, cheaper cache reads do most of the heavy lifting because repeated context dominates total token volume. Applying both models’ rate cards to the same example session cuts cache-read spend from $1.00 to $0.40.

API list price chart comparing input, output, and cache read prices between Opus 5 and Opus 5.5

Figure 1. API list prices per million tokens across input, output, and cache reads. Input and output dropped 20%, while cache reads dropped 60%. Source: Original post .

Example session itemOpus 5Opus 5.5
Cache read$1.00$0.40
New input$1.00$0.80
Output$1.50$1.20
Total$3.50$2.40

The Opus 5.5 column multiplies the example session’s token volumes by the new unit rates alongside the $0.40 cache-read figure from the original post:

  • New input: 200K × $4/M = $0.80
  • Output: 60K × $20/M = $1.20
  • Total: $0.40 + $0.80 + $1.20 = $2.40

The overall drop is ($3.50 − $2.40) ÷ $3.50 ≈ 31%. Because token counts stay fixed in this table, the comparison isolates the rate-card cut alone and excludes any savings from finishing in fewer turns. Cache reads show the steepest percentage drop, while output tokens remain the single largest cost item.

The second shift is how much work the model does per task. You may hear that Opus 5.5 is “40% cheaper,” which is Anthropic’s estimate for typical tasks at default settings rather than a 40% cut in token prices. That figure assumes Opus 5.5 finishes jobs using fewer tokens overall. Tightly scoped tasks take a similar number of turns on both models and save mainly the list-price difference, whereas open-ended tasks with broad codebase exploration and trial-and-error tend to widen the gap.

Practical Controls During a Session

Check Verification Loops Before Raising Effort

The effort setting tells the model how much compute to spend on reasoning across four standard tiers (low, medium, high, and xhigh) plus single-session max. Opus 5.5 defaults to medium, whereas Opus 5 defaulted to high. Because Opus 5.5 reasons more thoroughly at the same named tier, avoid carrying Opus 5 effort settings over unchanged.

Spending more on effort can still lower total session cost when extra reasoning prevents a retry spiral. In the original post’s math, adding 20K thinking tokens at high costs $0.40. Compare that with a 10-turn retry loop rereading 100K cached tokens per turn and producing 10K output tokens in total: 1M × $0.20/M + 10K × $20/M = $0.40. Preventing a retry loop of that size pays back the extra reasoning budget right away.

Follow a clear escalation order when a task stalls: first make sure the agent can run tests or a build to verify its own edits, then step up effort, and switch models last.

When to Switch Models

The author uses Opus 5.5 for interactive sessions where a developer is watching the terminal, and reserves Fable 5.1 for long unattended runs or unfamiliar, thorny problems. Fable 5.1 lists at $10 input, $50 output, and $0.25 cache read per million tokens. Subagents that split off search or log-reading chores run on Sonnet or Haiku instead. A practical rule from the post: if Opus 5.5 gets stuck twice on the same problem at xhigh, hand that step to Fable 5.1 and drop back to Opus 5.5 once resolved.

Raising effort costs less than jumping up a model tier, so stop escalating as soon as an earlier adjustment clears the blocker.

Keeping the Prompt Cache Warm

Prompt caching works by matching exact prefixes from the start of a request. Keeping system instructions and earlier turns untouched while appending new messages at the end lets subsequent turns read the shared history at 5% of fresh-input pricing. Writing to the cache for the first time costs more upfront: 1.25× fresh-input price for a 5-minute cache and 2× for a 1-hour cache. Reading a 120K cached context costs roughly $0.02, whereas writing that same 120K context into a 5-minute cache costs about $0.60.

Cache lifetime is 1 hour on subscription plans (dropping to 5 minutes while burning extra usage credits) and 5 minutes by default on API keys. Pausing longer than that window expires the cache. Switching models mid-session, attaching an MCP tool server, or compacting the conversation via /compact also changes the prompt prefix and triggers a fresh cache write.

Running /compact summarizes a long conversation so future turns carry fewer input tokens. Compacting at 150K tokens while the cache is still warm costs roughly $0.25 and trims about $0.025 per subsequent turn, paying for itself within ten turns. Waiting until after a 5-minute cache expires pushes the input cost of /compact alone to around $0.75, so run it before stepping away rather than after returning.

Pick your model, effort, and tool servers before starting a task, then leave them alone while the session runs.

Takeaways

The notes below are this blog’s own interpretation, not part of the original post.

  1. Watching the total bill is not enough; you need to see which bucket spent the tokens. Checking cache share in /usage tells you whether prefix reuse held up, comparing output volume against input flags heavy generation or thinking spend, and comparing cumulative input against current conversation size reveals how many turns the loop ran. If you build custom agents, logging those three ratios per run makes cost spikes much easier to diagnose.

  2. Giving an agent deterministic verification tools cuts expensive retry turns before you ever touch model tiers. In a data agent, for instance, attaching a schema-aware SQL checker catches bad column names or join keys before query execution fails blindly. When an agent loops on errors, ask what self-check tool is missing before reaching for a pricier model.

  3. Lock in shared instructions and active tool definitions at session start. Because prefix caching breaks whenever earlier content changes, appending new context and tool results to the tail of the prompt rather than rewriting system state mid-run keeps cache hit rates high.

What to Try First

  • Run claude update and confirm your CLI is on v2.1.280 or newer. Give Opus 5 and Opus 5.5 the exact same real task, then compare output quality alongside turn count, output tokens, and total cost in /usage.
  • Check your current setting with /effort status. Start clearly scoped tasks at medium and step up only when test failures show the model needs deeper reasoning.
  • Run /mcp before starting a task to review connected tool servers and turn off any servers you do not need for that session.

Original post: What a task costs on Opus 5.5