Deva Annamaraju
← All notes

Apr 2026 · 8 min read

the hidden cost of opus 4.7's tokenizer

opus 4.7 shipped with the same $5/$25 rate card as 4.6, but its new tokenizer turns the same text into more tokens: roughly 1x to 1.35x by anthropic's numbers, and more than that in my own small test.

  • LLMs
  • AI
  • Engineering

opus 4.7 kept the same rate card as 4.6: $5 input, $25 output per million tokens. what changed is the tokenizer, so the same rate buys you less text. anthropic says the same input can come out as roughly 1x to 1.35x as many tokens depending on the content, and in my own small test whitespace-heavy text came out higher than that.

the space token

the easiest way to see the tokenizer difference is to isolate it. i pulled token counts for both models straight from the api's usage response, with an empty system prompt and a fixed user turn, so the only thing that changes between runs is the assistant message.

# baseline: shortest possible exchange
messages = [{"role": "user", "content": "hi"}, {"role": "assistant", "content": "hi"}]
opus47: 15, opus46: 9  ← 1.67x

# concatenated, no whitespace between words
messages = [{"role": "user", "content": "hi"}, {"role": "assistant", "content": "hihi"}]
opus47: 16, opus46: 10  ← 1.6x

# one space added between the two words
messages = [{"role": "user", "content": "hi"}, {"role": "assistant", "content": "hi hi"}]
opus47: 17, opus46: 10  ← 1.7x (the space looks like its own token in 4.7)

# 50 space-separated repetitions
messages = [{"role": "user", "content": "hi"}, {"role": "assistant", "content": "hi" + " hi" * 50}]
opus47: 115, opus46: 59  ← 1.95x

"hihi" and "hi hi" differ by one character, a space. opus 4.6 counts the same for both, 10 tokens each. opus 4.7 charges one more token for "hi hi" than for "hihi", which looks like the space between the words getting a token of its own.

over 50 repetitions those extra tokens add up. "hi" + " hi" * 50 comes to 115 tokens on 4.7 and 59 on 4.6. take out the baseline exchange and the 50 extra " hi"s cost 100 tokens on 4.7 against 50 on 4.6, so the token cost doubled for text that is nothing but spaces and one repeated word. anthropic doesn't say which content sits where in its range, only that it varies by content type. my reading is that dense prose lands near the bottom, and anything where whitespace carries structure can go past 1.35x. this toy case did.

what this means for real workloads

anthropic's migration guide puts the increase at "roughly 1x to 1.35x." i'd expect most natural language to land inside that range. code with indentation, yaml config, json with whitespace formatting, structured logs and conversation histories with delimiter-heavy system prompts are where i'd look for numbers above it, though i haven't measured those. the rate card still says $5 per million input, but what you pay per task goes up anyway.

# pricing, april 2026

claude opus 4.7
input: $5.00 / mtok
output: $25.00 / mtok
tokenizer: new. roughly 1x to 1.35x as many tokens per anthropic, more in my whitespace test

claude sonnet 4.6
input: $3.00 / mtok  ← 40% cheaper
output: $15.00 / mtok  ← 40% cheaper
tokenizer: previous tokenizer, same as opus 4.6

claude haiku 4.5
input: $1.00 / mtok
output: $5.00 / mtok
tokenizer: previous tokenizer

don't read my 1.95x as a rate you can plug into a spreadsheet. it's one small test, and the ratios divide whole-request counts, so they include the fixed per-message overhead each model adds, which matters a lot when the content is a few words long. what carries over is the direction: at the same price per token, the bill for a given request moves with its token count, and you won't see that in the dollar-per-million figure on the pricing page. the only way to know your effective cost is to run a sample of your own requests through both models and compare token counts before you commit to a migration.

the benchmarks

to be fair to anthropic, the model is a lot better. swe-bench verified went from 80.8% to 87.6%, ahead of gemini 3.1 pro at 80.6%. swe-bench pro, the harder multi-language variant, went from 53.4% to 64.3%. rakuten says that on rakuten-swe-bench, opus 4.7 resolved 3x more production tasks than 4.6, with double-digit gains in code quality and test quality. notion and hebbia reported something similar for agent accuracy.

vision improved a lot too. opus 4.7 takes images up to 2,576 pixels on the long edge, about 3.75 megapixels, which anthropic says is more than three times what earlier claude models could take. xbow, which uses it for computer use in pen testing, says it scored 98.5% on their visual-acuity benchmark, up from 54.5% for opus 4.6. if you run computer-use agents or document extraction pipelines, that's a big jump in what the model can handle.

none of that makes classification or rag traffic cheaper, though. better coding and vision scores don't offset the tokenizer cost on workloads that never use those skills, so i'd weigh the two separately for each part of your system.

xhigh effort and task budgets

opus 4.7 ships with a new effort level called xhigh. anthropic's docs describe it as the recommended starting point for most coding and agentic use cases, and it sits between high and max. at xhigh the model works harder on complex tasks and spends more tokens doing it. the effort chart in anthropic's launch post, from their internal agentic coding eval, puts opus 4.7 at max just past 200k total tokens and xhigh just past 100k, with xhigh scoring only a few points lower.

task budgets are a new mechanism in public beta: an advisory token ceiling across the full agentic loop. the model can see the budget and paces itself against it. the minimum is 20k tokens, and unlike max_tokens it isn't a hard cap. stack a tokenizer that produces more tokens on top of an xhigh effort default and agentic loops with no budget set, and at scale the spend climbs fast. i'd put task budgets on production agent workloads before a billing surprise makes you do it.

when sonnet 4.6 is the better choice

sonnet 4.6 is $3 input and $15 output per million, 40% cheaper on the rate card, and it still uses the older tokenizer. for classification, rag retrieval, summarization and most content generation, i think sonnet 4.6 is close enough in capability that the cost difference is hard to justify. opus 4.7 earns its premium on autonomous coding agents, complex multi-step tool workflows and vision-heavy pipelines, where the benchmark gaps are real and your workload exercises them.

so instead of moving everything to 4.7 at once, i'd route by request type. that way you get the capability gains where they matter and don't pay the tokenizer cost on traffic that doesn't need it. anthropic's migration guide points the same way: re-benchmark end-to-end cost and latency under the new tokenizer, and update max_tokens to give headroom for the higher token counts before switching.

sources: anthropic, "introducing claude opus 4.7" (april 2026): 1.0 to 1.35x tokenizer range, benchmark table (swe-bench verified and pro, incl. gemini 3.1 pro), agentic coding performance by effort level chart, image resolution, rakuten (rakuten-swe-bench) and xbow (visual-acuity) customer quotes · anthropic migration guide (roughly 1x to 1.35x, re-benchmarking and max_tokens advice) · anthropic api pricing docs (rates; sonnet 4.6 and earlier use the previous tokenizer) · anthropic effort and task budgets docs (xhigh, 20k minimum, advisory cap) · google deepmind gemini 3.1 pro model card (swe-bench verified 80.6%) · vellum ai benchmark analysis · venturebeat opus 4.7 coverage · token counts in the first section are my own api test