ixsoftum
What Claude API pricing actually costs for a real feature
AI-assisted development Data deepdive

What Claude API pricing costs for one agent-built feature

A worked cost model for a five-turn agent session building one feature, priced on current Claude and OpenAI models, with and without prompt caching.

Ava Harlan ·Published 06 Sept 2026·6 min read
Last verified 23 Oct 2026
Key takeaways
  • Agent sessions resend the whole conversation on every turn, so input tokens grow much faster than the code itself. In our five-turn example, billed input is 6.3 times the size of the content read and written.
  • Priced on current models, the example feature costs from about $0.001 (Claude Haiku 5.5, GPT-6 Luna) to about $0.13 (Claude Fable 5.1, GPT-6 Astra).
  • Prompt caching saves about 20% on Claude models and 7% on OpenAI models here, because short early turns fall below the minimum cacheable length. Savings grow with longer sessions.
  • Turn count matters more than feature size: each extra turn resends a longer transcript than the last.

Claude API pricing currently runs from $0.10 to $10 per million input tokens and from $0.50 to $50 per million output tokens, depending on the model. That's the price on the pricing page. What one feature costs when an AI agent builds it depends on something the pricing page doesn't show: how the agent's conversation grows turn by turn.

This piece works through that with a single worked example. It is a cost model, not a billing record. We set out an agent session for one realistic feature, estimated the tokens each turn would carry, and priced it on current models. The assumptions are below, so you can swap in your own numbers.

The example feature and the assumptions

The feature is a GET /invoices/export endpoint for a small Express and Postgres API. It streams a user's invoice history as CSV in batches of 500 rows, so it never loads a whole history into memory, with an optional ?status= filter. It has four tests: the export, the filter, an invalid filter, and a check that one user's export never includes another user's data.

We modeled it as a five-turn agent session, the usual shape of a coding-agent run on a task like this:

  1. Read the existing route file to follow its pattern.
  2. Read the schema to confirm column names and valid statuses.
  3. Write the new route.
  4. Write the tests.
  5. Explain the trade-offs.

To estimate tokens, we wrote out the code and text for each turn and counted them with tiktoken, OpenAI's published tokenizer (cl100k_base). Claude's tokenizer isn't available for local counting, so the Claude figures are an approximation, and real counts will differ somewhat between providers. The code and text came to about 4.2 characters per token, close to the common rule of thumb of 4.

Why the input grows so fast

Counting the content once, the code read for context plus the code and explanation written, gives about 922 input tokens and 1,353 output tokens. A naive estimate would price the feature on those numbers.

That isn't how the API bills an agent. The Messages and Chat Completions APIs are stateless, so every turn sends the whole conversation so far. The fifth request includes everything from turns one to four: instructions, file contents, tool results and the code already written.

Turn What happens Input tokens sent Output tokens
1 Request, decide to read the route file 391 17
2 + route file, decide to read the schema 823 13
3 + schema, write the new route 978 548
4 + write confirmation, write the tests 1,535 518
5 + write confirmation, explain the trade-offs 2,063 287

Each row's input is what that single request sends and is billed for. Across the session that adds up to 5,790 input tokens, 6.3 times the 922 a single count suggests. Output barely changes, 1,383 tokens against 1,353, because output isn't resent the way input is.

That asymmetry matters for cost. Output is priced at five times input on every model below, so a big multiplier on input tokens doesn't mean the same multiplier on the bill.

What the example costs on current models

Applying Claude's and OpenAI's standard prices as of October 23, 2026 to 5,790 input and 1,383 output tokens:

Model Input $/M Output $/M Example cost, no caching
Claude Fable 5.1 $10.00 $50.00 $0.1270
GPT-6 Astra $10.00 $50.00 $0.1270
Claude Opus 5.5 $4.00 $20.00 $0.0508
Claude Sonnet 5.5 $2.00 $10.00 $0.0254
GPT-6.1 Sol $2.00 $10.00 $0.0254
Claude Haiku 5.5 $0.10 $0.50 $0.0013
GPT-6 Luna $0.10 $0.50 $0.0013

The two providers price their tiers in matching pairs: Fable 5.1 and GPT-6 Astra both at $10 and $50, Sonnet 5.5 and GPT-6.1 Sol both at $2 and $10, Haiku 5.5 and GPT-6 Luna both at $0.10 and $0.50. Haiku 5.5's price applies to prompts up to 100,000 tokens; longer prompts cost more.

What prompt caching changes

Most of a late turn's input is earlier turns repeated word for word, which is what prompt caching addresses. On the Claude API, caching is turned on with cache_control. Writing to the cache costs 1.25 times the input price, and reading costs a fraction of it: 0.025 times on Fable 5.1, 0.05 times on Opus 5.5 and Sonnet 5.5, 0.1 times on Haiku 5.5. OpenAI caches automatically on supported models; on GPT-5.6 and later, writes also cost 1.25 times input, and reads cost 0.1 times (0.05 times on GPT-6.1 Sol).

There's a catch for small sessions. Prompts below a minimum length aren't cached: 512 tokens on current Claude models and 1,024 on current OpenAI models. In this example, Claude can cache from turn two and OpenAI only from turn four.

Recomputing the session with each turn reading the previous turn's prompt from the cache and writing the new part:

Model No caching With caching Saving
Claude Fable 5.1 $0.1270 $0.0997 22%
Claude Opus 5.5 $0.0508 $0.0402 21%
Claude Sonnet 5.5 $0.0254 $0.0201 21%
Claude Haiku 5.5 $0.0013 $0.0010 20%
GPT-6 Astra $0.1270 $0.1184 7%
GPT-6.1 Sol $0.0254 $0.0235 7%
GPT-6 Luna $0.0013 $0.0012 7%

These savings are modest because the session is short and output dominates the bill. In longer sessions, where the repeated context runs to tens of thousands of tokens, caching cuts far more. Agent tools generally manage this for you: Claude Code uses prompt caching and keeps a separate cache per model. If you call the API directly, you need to enable it.

What this means at scale

At $0.025 on Sonnet 5.5, a single feature like this is cheap. A team shipping 20 similar features a month would spend about $0.51 on tokens for that work without caching.

The number that grows fastest isn't feature size but turn count. A feature that takes 15 turns because of a couple of debugging rounds costs more than three times as much as one that takes five, because every extra turn resends a longer transcript than the last. Tool use adds to this too: an agent pulling context through MCP servers adds its own turns and tokens.

To estimate your own costs, count the tokens in a typical session's turns, or read them from your provider's usage dashboard. Sum the input across turns rather than counting the content once. Then check whether caching applies at your prompt sizes.

Where the price page stops

Claude's pricing page doesn't tell you what a feature costs, because the multi-turn mechanic matters more than the per-token rate for anything beyond a single prompt. For a moderately sized feature on any current model, the answer is small enough that tokens aren't what limits shipping it. Long, iterative sessions are where the bill grows, so watch turn count.

Correction, October 23, 2026: an earlier version of this article said the author built the feature and was billed for it, and that every artifact was retained. It was a modeled session, which this version now says plainly. We've also updated the prices to current models, corrected the caching savings (the earlier "30 to 34%" ignored minimum cacheable lengths), and linked Claude Code's caching documentation.

Related

This site uses the essential cookie required for the admin login system and Google Analytics to understand traffic. No marketing or ad-targeting cookies are set.

Contact us

Thanks, your message has been sent. We'll get back to you at the address you provided.