Jul 13, 2026

Claude Opus tokenizer cost: pricing and the hidden token tax

Claude Opus pricing is only half the cost equation. Learn how the Opus tokenizer, cache tokens, output length, and routing affect the real cost of every request.

DEEP DIVE8 min readThe Currai team / Engineering

TL;DR: Claude Opus costs more when the same text becomes more billable tokens, even if the published price per million tokens does not change. Anthropic says Claude Opus 4.7 and later use a newer tokenizer that produces approximately 30% more tokens for the same input text than earlier models. Measure token counts with the exact model you plan to call, then calculate input, output, cache, and retry costs from actual API usage.

What is the Claude Opus tokenizer cost?

The Claude Opus tokenizer cost is the amount you pay after text is split into billable tokens. It is not a separate fee. The tokenizer determines how many input and output tokens are multiplied by Claude Opus's token prices, so a tokenizer change can raise the cost of identical text without changing the advertised price per million tokens.

For a standard request, the basic formula is:

request cost =
  (input tokens / 1,000,000 × input price) +
  (output tokens / 1,000,000 × output price)

Production calculations may also include cache writes, cache reads, tool use, web search, regional inference, batch discounts, and retries.

Claude Opus pricing in 2026

At publication, Anthropic lists standard global Claude Opus pricing at $5 per million base input tokens and $25 per million output tokens. Its model pricing reference also publishes separate rates for prompt-cache writes, cache hits, batch processing, and other inference modes.

Token categoryStandard global price per million tokens
Base input$5.00
Output$25.00
Five-minute prompt-cache write$6.25
One-hour prompt-cache write$10.00
Prompt-cache hit or refresh$0.50
Batch input$2.50
Batch output$12.50

Prices and available model IDs change. Check the official pricing page before making a purchasing or routing decision.

Output is five times the base input rate in this schedule. That makes verbose answers, agent scratch work, and repeated failed attempts disproportionately important. Reducing 1,000 output tokens saves as much as reducing 5,000 base input tokens at these rates.

Why the Opus tokenizer creates a hidden token tax

A tokenizer converts text into the units a model reads and generates. Different tokenizers can split the same sentence into different numbers of tokens. Whitespace, punctuation, code, identifiers, non-English text, and structured data can all affect the result.

Anthropic's token-counting documentation states that Claude Opus 4.7 and later use a newer tokenizer. It estimates that the same input text produces approximately 30% more tokens than with earlier models, while noting that the exact increase varies by content.

That difference is easy to miss in a price table. If two Opus versions both list $5 per million input tokens, they appear equally expensive. But if one version counts 30% more tokens for your prompts, its effective price for the same body of text is also about 30% higher before considering changes in answer length, caching, or task success.

This is a workload effect, not a universal surcharge. A short English prompt, a TypeScript repository, and a multilingual contract corpus may experience different changes. Measure representative production inputs rather than applying 30% blindly to every budget.

A worked Claude Opus cost example

Assume an older model counts a support-analysis request as 10,000 input tokens and 1,200 output tokens. At $5 input and $25 output per million tokens:

input  = 10,000 / 1,000,000 × $5  = $0.050
output =  1,200 / 1,000,000 × $25 = $0.030
total                                  $0.080

Now use the same text in a model whose tokenizer produces 30% more tokens. If both the fixed input and a comparable output rise by 30%, the request becomes 13,000 input tokens and 1,560 output tokens:

input  = 13,000 / 1,000,000 × $5  = $0.065
output =  1,560 / 1,000,000 × $25 = $0.039
total                                  $0.104

The listed token prices did not change, yet the text-to-cost result increased from 8 cents to 10.4 cents. Across one million similar requests, that difference is $24,000.

The example isolates tokenization. A newer model may finish the task with fewer retries, use tools more efficiently, or generate a shorter answer. Those gains can outweigh the tokenizer increase. Cost per successful task is therefore more useful than cost per isolated request.

Count tokens before sending an Opus request

Anthropic provides a Token Counting API that accepts messages, system prompts, tools, images, and PDFs. Use the same model ID and request shape intended for generation:

count = client.messages.count_tokens(
    model="claude-opus-4-7",
    system=system_prompt,
    tools=tools,
    messages=messages,
)

estimated_input_cost = count.input_tokens / 1_000_000 * 5

The result is an estimate, not the invoice. Anthropic notes that the token count used during message creation can differ slightly. The generation response's usage fields remain the source for the actual billed token quantities.

Preflight counting is most useful when an application needs to:

  • Reject or summarize context that exceeds a model limit.
  • Estimate the maximum cost before starting an expensive agent run.
  • Compare how two model versions tokenize the same evaluation set.
  • Decide whether a request should use Opus or route to a lower-cost model.
  • Set customer-level budgets or per-request spending caps.

Do not add an extra counting call to every tiny request without measuring the latency and operational benefit. It is especially valuable for long documents, large tool schemas, codebases, and variable retrieval context.

Prompt caching changes the calculation

Repeated context should not always be paid for at the base input rate. Prompt caching lets an application write stable prefixes to a cache and later read them at a lower rate.

With the prices above, a cache hit costs one-tenth of base input. But cache writes cost more than normal input, so caching pays off only when the prefix is reused before it expires. A 100,000-token prefix illustrates the trade-off:

EventApproximate cost
Base input without caching$0.500
Five-minute cache write$0.625
Each later cache hit$0.050

The first write costs more, but repeated hits can reduce the total quickly. Track cache creation and cache-read tokens separately. A low hit rate may mean the supposedly stable prefix changes between requests, cache boundaries are misplaced, or requests arrive after the cache expires.

Six ways to control Claude Opus cost

  1. Measure the target tokenizer. Count the same production sample with each candidate model ID. Do not estimate from words or characters.
  2. Route by task difficulty. Reserve Opus for requests where its additional capability improves success; use a smaller model for classification, extraction, or routine transformations when evaluations support the change.
  3. Limit output intentionally. Specify the desired format and length, set a sensible maximum, and detect repetitive or runaway generation.
  4. Cache stable prefixes. Place reusable instructions, tool definitions, and long reference material before variable conversation content.
  5. Control retrieved context. Deduplicate passages, rerank candidates, and avoid sending documents that do not help answer the question.
  6. Include failures and retries. A request that costs less but fails twice is not cheaper. Attribute every attempt to the same task or trace.

Compare cost per successful task, not price per token

The cheapest model on a pricing page can be the most expensive model in a workflow if it calls tools incorrectly, produces answers that require human repair, or triggers repeated retries. A useful model comparison records:

  • First-attempt and eventual task success.
  • Input, output, cache-write, and cache-read tokens.
  • Tool calls, retries, and fallback models.
  • End-to-end latency and time to a usable result.
  • Human review or correction time.
  • Total cost for the complete task.

Run that comparison on a fixed evaluation set before changing a production route. Then monitor the same measurements after rollout because prompt length, user behavior, and cache hit rates drift over time.

Measure Claude Opus token cost with Currai

Currai connects token economics to the request that created them. Trace an agent or AI feature end to end, record each Claude generation, and inspect input, output, cached tokens, latency, errors, and calculated cost together. Tags for model version, feature, customer, and experiment make it possible to compare Opus routes by cost per successful task instead of relying on a static pricing table.

Start by learning how to track token cost, test agent cost efficiency, and set budgets and alerts for LLM cost. Then create a free account to see where the hidden tokenizer tax appears in your own production traces.

03

Keep going with nearby topics from the Currai blog.