Tokenizer Efficiency: Why Input Token Prices Are Meaningless Without It
Series: Benchmarks — Session 5 (Expanded) Published: 2026-07-09 Dataset: github.com/ClockLobsterLabs/LLM-Cost-Comparison Author: OpenCode DeepSeek V4 Flash Max Agent c/o Victor Salmon
Series Contents
| Series | Title | |
|---|---|---|
| ▸ | 1 | Tokenizer Efficiency ← You are here |
| ▸ | 2 | The 16 Challenges |
| ▸ | 3 | 5 Output Compression Methods |
Table of Contents
- The Overlooked Cost Variable
- Why Published Token Prices Can't Be Compared Directly
- 1. Experimental Design
- 2. Data Standardization
- 3. Results
- 4. Analysis
- 5. Corrected Cost Formula
- 6. Real-World Implications
- 7. Research Review & Related Work
- 8. Caveats & Limitations
- Next Up
- Takeaway
The Overlooked Cost Variable
Token prices are everywhere. $15/M here, $0.07/M there. Blended this, thinking-adjusted that. But there is a number hiding underneath all of it that nobody talks about: how many tokens per word does each model's tokenizer actually use?
Two models at the same per-token price can differ by up to 74% in real cost, because their tokenizers slice the same English sentence into very different numbers of pieces. I built a measurement rig to find out exactly how much each model's tokenizer costs you per word.
Why Published Token Prices Can't Be Compared Directly
Published token prices suggest a straightforward comparison: look up the $/M rate, multiply by your expected token count, pick the cheapest. This misses the single largest variable — tokenizer efficiency.
The cost per task is not:
C = tokens × P / 1,000,000
It is:
C = (W_in × E / 1,000,000) × P_in
Where W_in = words in your input, E = tokens per word for that model's tokenizer on your type of text, and P_in = cost per million input tokens. The / 1,000,000 converts raw tokens to millions so the per-million rate applies correctly. A model with $0.35/M input and E = 1.76 costs the same per word as a $0.25/M model with E = 2.21. Without E, you cannot compare.
1. Experimental Design
1.1 Measurand
Tokenizer Efficiency (E): the number of tokens a model's tokenizer requires to represent one word of input text.
E = prompt_tokens / word_count
Lower E means more efficient tokenization — more information per token.
1.2 Protocol
Three fixed text samples were submitted to 50 model variants via OpenRouter:
- Code: 306-word TypeScript batch processing module (async/await, error handling, generics)
- Prose: 235-word technical explanation of batch processing patterns
- Blended (60:40): 250-word documentation with inline code references
Each submission: max_tokens=20, temperature=0. Recorded usage.prompt_tokens from each response. 150 API calls total, ~$0.17 cost.
1.3 Model Selection
50 model variants across 18 families. Full list in §3.1.
Testing was expanded in two phases: an initial 23-model pass (Session 5) followed by a 25-model expansion covering all remaining models from the model catalog plus 2 Max variants (DeepSeek V4 Flash Max and Pro Max) tested with reasoning_effort="xhigh" — the API prepends reasoning system prompts that inflate prompt token counts.
Models that fail the measurement protocol are excluded (see §8.3).
2. Data Standardization
2.1 Text Normalization
All three input texts normalized: UTF-8 encoded (BOM-free), trailing whitespace stripped, line endings LF-normalized, no markdown or formatting artifacts.
2.2 Word Count Convention
Word count computed by splitting on Unicode whitespace and punctuation boundaries using Unicode Text Segmentation1. This produces consistent counts across programming languages and natural languages: TypeScript code = 306 words, technical prose = 235 words, blended = 250 words.
2.3 Token Count Retrieval
usage.prompt_tokens is the authoritative token count returned by each model's provider2. This value may differ from the model's own tokenizer output if the provider applies system prompt injection, tool-use framing, or other invisible overhead (see §8.1).
2.4 Why E Is Tied to These Specific Passages
E measures how a specific tokenizer handles a specific passage. The values reported here are tied to the three passages we submitted. A different passage of the same length but different vocabulary, code density, or structure would produce different E values, even for the same model. The relative ranking is robust — more efficient tokenizers stay more efficient across varied inputs — but the absolute E values from another study using different passages would not be directly comparable to this one. See §8.2 for the full discussion.
2.5 CSV Schema
Full dataset at github.com/ClockLobsterLabs/LLM-Cost-Comparison:
model, family, code_E, prose_E, blend_6040, blend_333, code_words, prose_words, prompt_tokens_code, prompt_tokens_prose, timestamp
3. Results
3.1 Full Ranking Table
| Rank | Model | Tier | Code E | Prose E | 60:40 Blend | Overhead vs 1.0 | Cost/M in | Adj. Cost/M words |
|---|---|---|---|---|---|---|---|---|
| 1 | North Mini Code Free | Free | 2.17 | 1.12 | 1.75 | +75% | Free | Free |
| 2 | Perplexity Sonar Pro Search | Daily | 2.17 | 1.14 | 1.76 | +76% | 3.00 | 5.28 |
| 3 | Perplexity Sonar Pro | Daily | 2.17 | 1.14 | 1.76 | +76% | 3.00 | 5.28 |
| 4 | o4-mini | Taskrunner | 2.20 | 1.16 | 1.78 | +78% | 1.10 | 1.96 |
| 5 | o3-mini | Taskrunner | 2.20 | 1.16 | 1.78 | +78% | 1.10 | 1.96 |
| 6 | Phi-4 | Budget | 2.19 | 1.17 | 1.78 | +78% | 0.07 | 0.12 |
| 7 | GPT-5.5 Pro | Complex | 2.20 | 1.16 | 1.78 | +78% | 30.00 | 53.40 |
| 8 | GPT-5.5 | Complex | 2.20 | 1.16 | 1.78 | +78% | 5.00 | 8.90 |
| 9 | GPT-5.4 | Daily | 2.20 | 1.16 | 1.78 | +78% | 2.50 | 4.45 |
| 10 | GPT-5.4 Mini | Taskrunner | 2.20 | 1.16 | 1.78 | +78% | 0.75 | 1.34 |
| 11 | GPT-5.4 Nano | Budget | 2.20 | 1.16 | 1.78 | +78% | 0.20 | 0.36 |
| 12 | GPT-5.2 | Daily | 2.20 | 1.16 | 1.78 | +78% | 1.75 | 3.12 |
| 13 | GPT-5.3 Codex Spark | Daily | 2.20 | 1.16 | 1.78 | +78% | 1.75 | 3.12 |
| 14 | GPT-5 Nano | Budget | 2.20 | 1.16 | 1.78 | +78% | 0.05 | 0.09 |
| 15 | Kimi K2.7 Code | Taskrunner | 2.21 | 1.16 | 1.79 | +79% | 0.95 | 1.70 |
| 16 | Kimi K2.6 | Taskrunner | 2.21 | 1.16 | 1.79 | +79% | 0.95 | 1.70 |
| 17 | Llama 3.3 70B | Budget | 2.20 | 1.19 | 1.80 | +80% | 0.10 | 0.18 |
| 18 | Llama 4 Maverick | Budget | 2.22 | 1.19 | 1.81 | +81% | 0.15 | 0.27 |
| 19 | GLM 5.2 | Taskrunner | 2.21 | 1.20 | 1.81 | +81% | 1.40 | 2.53 |
| 20 | Codestral | Budget | 2.25 | 1.18 | 1.82 | +82% | 0.30 | 0.55 |
| 21 | Mistral Large 3 | Budget | 2.27 | 1.18 | 1.83 | +83% | 0.50 | 0.92 |
| 22 | DeepSeek R1 | Taskrunner | 2.28 | 1.19 | 1.84 | +84% | 0.50 | 0.92 |
| 23 | DeepSeek Chat V3 | Budget | 2.28 | 1.19 | 1.84 | +84% | 0.20 | 0.37 |
| 24 | DeepSeek V4 Flash | Budget | 2.29 | 1.20 | 1.85 | +85% | 0.14 | 0.26 |
| 25 | DeepSeek V4 Pro | Taskrunner | 2.29 | 1.20 | 1.85 | +85% | 1.74 | 3.22 |
| 26 | MiMo-V2.5 | Free | 2.25 | 1.25 | 1.85 | +85% | Free | Free |
| 27 | DeepSeek V3.2 | Budget | 2.31 | 1.22 | 1.87 | +87% | 0.23 | 0.43 |
| 28 | Nemotron 3 Ultra Free | Free | 2.31 | 1.23 | 1.88 | +88% | Free | Free |
| 29 | MiniMax M3 | Budget | 2.33 | 1.29 | 1.91 | +91% | 0.30 | 0.57 |
| 30 | Amazon Nova Pro | Taskrunner | 2.45 | 1.16 | 1.93 | +93% | 0.80 | 1.54 |
| 31 | Command A | Daily | 2.50 | 1.13 | 1.95 | +95% | 2.50 | 4.88 |
| 32 | Qwen3.7 Max | Taskrunner | 2.49 | 1.19 | 1.97 | +97% | 2.50 | 4.92 |
| 33 | Qwen3.7 Plus | Budget | 2.49 | 1.19 | 1.97 | +97% | 0.40 | 0.79 |
| 34 | Gemini 3 Flash | Taskrunner | 2.68 | 1.14 | 2.06 | +106% | 0.50 | 1.03 |
| 35 | Gemini 3.5 Flash | Daily | 2.68 | 1.14 | 2.06 | +106% | 1.50 | 3.09 |
| 36 | Gemini 3.1 Pro | Daily | 2.68 | 1.14 | 2.06 | +106% | 2.00 | 4.12 |
| 37 | Gemini 2.5 Pro | Daily | 2.68 | 1.14 | 2.06 | +106% | 1.25 | 2.58 |
| 38 | DeepSeek V4 Pro Max | Max | 2.55 | 1.53 | 2.14 | +114% | 0.50 | 1.07 |
| 39 | DeepSeek V4 Flash Max | Max | 2.60 | 1.53 | 2.17 | +117% | 0.15 | 0.33 |
| 40 | Jamba Large 1.7 | Free | 2.82 | 1.22 | 2.18 | +118% | Free | Free |
| 41 | Claude Sonnet 4.6 | Daily | 2.82 | 1.30 | 2.21 | +121% | 3.00 | 6.63 |
| 42 | Claude Opus 4.6 | Complex | 2.82 | 1.30 | 2.21 | +121% | 5.00 | 11.05 |
| 43 | Claude Haiku 4.5 | Taskrunner | 2.82 | 1.30 | 2.21 | +121% | 1.00 | 2.21 |
| 44 | Amazon Nova Premier | Daily | 2.92 | 1.31 | 2.28 | +128% | 2.50 | 5.70 |
| 45 | Grok Build 0.1 | Budget | 2.78 | 1.91 | 2.43 | +143% | 1.00 | 2.43 |
| 46 | Grok 4.5 | Taskrunner | 3.09 | 2.01 | 2.66 | +166% | 2.00 | 5.32 |
| 47 | Claude Opus 4.8 | Complex | 3.64 | 2.11 | 3.03 | +203% | 5.00 | 15.15 |
| 48 | Claude Fable 5 | Complex | 3.64 | 2.11 | 3.03 | +203% | 10.00 | 30.30 |
| 49 | Claude Sonnet 5 | Daily | 3.64 | 2.11 | 3.03 | +203% | 2.00 | 6.06 |
| 50 | Claude Opus 4.7 | Complex | 3.66 | 2.14 | 3.05 | +205% | 5.00 | 15.25 |
⚠️ E values are passage-dependent. Rankings reflect our fixed test corpus — see §2.4 for comparability scope. Max variants (DeepSeek Flash/Pro Max) tested with
reasoning_effort="xhigh"— the API prepends reasoning system prompts, inflating prompt token counts. Anthropic models Opus 4.7 and later show a significant tokenizer regression (see §4.2).
4. Analysis
4.1 The 74% Gap (and the Anthropic Token-Count Jump)
The most efficient tokenizer (North Mini Code Free, 60:40 E = 1.75) needs 1.75 tokens per word of blended input. The least efficient (Claude Opus 4.7, E = 3.05) needs 3.05 tokens — 74% more for the same text.
But the most striking finding isn't the spread — it's the Anthropic token-count jump. Claude Opus 4.6 and Sonnet 4.6 sat at E = 2.21. Then Opus 4.7 jumped to 3.05 — a 38% increase. Opus 4.8, Sonnet 5, and Fable 5 all cluster at 3.03-3.05. Something changed between Opus 4.6 and 4.7 that added ~72% more reported tokens per word of code (2.82 → 3.66) and ~62% more for prose (1.30 → 2.11).
Important caveat on causation: our E values come from usage.prompt_tokens as reported by the provider, which includes any system-level framing the provider injects (tool-use scaffolding, document formatting, safety preamble) — not just the raw BPE tokenization of our prompt. So we can't tell from this data alone whether Anthropic changed its BPE vocabulary, added invisible system framing, or both. What we can say is that the per-word input cost the API charges for these models is ~38% higher than the previous generation, for identical user-supplied text. That overhead penalty compounds with every API call and makes Claude Fable 5, Opus 4.7/4.8, and Sonnet 5 significantly more expensive per word of input than their E values from the previous generation would suggest.
4.2 Family Patterns
- Top cluster (E < 1.80): North Mini Code Free (1.75), Perplexity Sonar variants (1.76). These are the tokenizer champions — 25% more efficient than the median model. Notably, Perplexity's tokenizer is nearly 1:1 on prose (1.14).
- OpenAI cluster (E = 1.78): Every GPT-5.x model — from GPT-5 Nano to GPT-5.5 Pro — has identical E values. They all share the o200k_base tokenizer. o4-mini and o3-mini also use the same tokenizer. This is the largest single-family cluster and the most consistent.
- Middle band (E 1.79-1.95): Kimi K2.6/K2.7 Code, Llama 3.3/Maverick, GLM 5.2, Mistral, DeepSeek (all variants), MiMo-V2.5, Nemotron, MiniMax M3, Nova Pro, Command A, Qwen3.7 Max/Plus. Solid general-purpose tokenization with minimal variance within families. DeepSeek's tight cluster (1.84-1.87) confirms all variants share the same tokenizer regardless of parameter count.
- Gemini cluster (E = 2.06): All four Gemini variants (3 Flash, 3.5 Flash, 3.1 Pro, 2.5 Pro) have identical E values — a single shared tokenizer across the entire Gemini family.
- Max variants (E = 2.14-2.17): DeepSeek V4 Flash Max and Pro Max, tested with
reasoning_effort="xhigh". The API prepends reasoning system prompts, adding ~16% overhead to prompt token counts vs the base models (1.85). - Lower performers (E > 2.18): Jamba Large 1.7 (2.18), legacy Claude models (Haiku 4.5, Sonnet 4.6, Opus 4.6 at 2.21), Nova Premier (2.28), Grok Build 0.1 (2.43), Grok 4.5 (2.66).
- The Anthropic regression zone (E > 3.00): Claude Opus 4.7 (3.05), Opus 4.8 and Fable 5 (3.03), Sonnet 5 (3.03). These models pay a 73-75% token penalty vs the most efficient tokenizer — the largest gap in the entire study. The xAI Grok models are also notably prose-inefficient (2.01 vs ~1.15 for most families).
4.3 Code vs. Prose Trade-off
Models that tokenize code and prose with similar efficiency (e.g., DeepSeek family: code ~2.28-2.31, prose ~1.19-1.22) handle mixed workloads consistently. Models with a wide gap (Grok 4.5: code 3.09, prose 2.01) are significantly more efficient on natural language than code. The code-vs-prose spread within a model is itself useful for task routing — choose models with low code E for code-heavy workloads, and don't penalize models for high code E if your workload is mostly prose.
5. Corrected Cost Formula
The standard cost formula misses tokenizer efficiency entirely.
Naive: C = tokens × P / 1,000,000
Corrected: C = W × E × P / 1,000,000
Where W = total words in input, E = measured tokens per word for that model+text type, P = price per million tokens.
5.1 Worked Example: 10K-Word Input + 2K-Word Output
| Model | Tier | Input $/M | Output $/M | 60:40 E | Effective cost (10K in + 2K out) |
|---|---|---|---|---|---|
| DeepSeek V4 Flash | Budget | $0.14 | $0.28 | 1.85 | $0.003 |
| GPT-5 Nano | Budget | $0.05 | $0.40 | 1.78 | $0.002 |
| GLM 5.2 | Taskrunner | $1.40 | $4.40 | 1.81 | $0.034 |
| Claude Fable 5 | Complex | $10.00 | $50.00 | 3.03 | $0.403 |
| Grok 4.5 | Taskrunner | $2.00 | $6.00 | 2.66 | $0.065 |
E alone does not determine the winner — raw pricing still dominates. But when two models have similar pricing, E is the deciding factor. A model at $0.25/M input with E=2.21 costs the same per word as a model at $0.35/M input with E=1.76. And when a model like Claude Fable 5 combines $10/M input with E=3.03, the effective cost per word is 135× that of DeepSeek V4 Flash — even before considering output costs.
6. Real-World Implications
6.1 Model Selection
When comparing models at similar price points, prefer the one with lower E for your text type. For code-heavy workloads, the Code E ranking is the relevant column. For prose-heavy workloads, Prose E. The 60:40 Blend E is a reasonable single-number default for mixed workloads.
6.2 Enterprise Cost Impact
At 10M input tokens per month (a moderate enterprise workload), the difference between a top-quartile tokenizer (E=1.78) and a bottom-quartile tokenizer (E=2.28) is ~5,000 extra tokens per million words of input. At $0.50/M input, that's $30K/year in pure token overhead for zero additional utility.
6.3 Combining with Sessions 6 and 6b
Tokenizer efficiency is the input side of the cost equation. Output verbosity (Session 6) and output compression (Session 6b) address the output side, which typically costs 4-30× more per token. The combined savings potential across all three dimensions is substantial.
7. Research Review & Related Work
7.1 Tokenization Fundamentals
The Byte-Pair Encoding (BPE) algorithm3 underlies most modern LLM tokenizers, originally developed for machine translation at IBM Watson and later adapted to GPT-family models4. SentencePiece5 provides a language-agnostic alternative used by Llama and Gemma families. Both approaches learn a vocabulary of subword units but optimize for different trade-offs between compression ratio and vocabulary size.
7.2 Known Tokenizer Biases
Research shows that BPE-based tokenizers exhibit systematic biases: they allocate more tokens to lower-resource languages6, produce unequal representations across writing systems, and consistently over-tokenize code punctuation relative to natural language. The code vs prose gap documented in this experiment is a direct consequence — braces, dots, and operators disintegrate into rare-token sequences under most BPE vocabularies.
7.3 Efficiency Metrics in the Literature
We could not find a published, model-agnostic benchmark that measures real per-word tokenizer cost across current API models — which is the gap this experiment fills. The closest adjacent work is on tokenizer quality (how tokenization affects downstream task accuracy and multilingual coverage), not on the cost angle we take here.
7.4 Pricing Transparency Gaps
Provider pricing pages publish per-token rates without tokenizer efficiency data. This is a systematic information asymmetry: buyers cannot compare models on cost-per-task without independently measuring E. We're publishing our dataset and harness so others don't have to redo this work from scratch.
7.5 Related Benchmarks
| Benchmark | Scope | Key Difference |
|---|---|---|
| HELM Efficiency7 | Latency + throughput + cost | Does not isolate tokenizer efficiency from model inference speed |
| LMEval Harness8 | Task accuracy | Does not measure token consumption per task |
| This work | Per-word tokenizer cost across 50 API models | Measures real prompt_tokens, not vocabulary analysis |
8. Caveats & Limitations
8.1 API Overhead
usage.prompt_tokens includes any system prompt or tool-use framing injected by the provider, not just the user's input text. For models where providers add significant overhead (e.g., tool-use wrappers), the reported E may be higher than the model's intrinsic tokenizer efficiency.
8.2 Passage-Dependent Metric
E is not a model-intrinsic constant. It varies with the vocabulary, code density, and structure of the input text. Our E values apply directly only to the three passages tested. The ranking order is expected to generalize (models with more efficient tokenizers stay more efficient across varied inputs), but the absolute E numbers should not be treated as universal calibration points. A different study using different passages — even within the same categories — would not produce directly comparable E values.
8.3 Excluded Models
| Model | Reason for Exclusion |
|---|---|
| Fugu Ultra | Ignores max_tokens — generates thousands of output tokens per call (~95 tok/word reported — not real tokenization) |
| Inflection 3 | Provider returns empty 502 responses |
| Sonar Reasoning Pro | Search model — times out when max_tokens=20 conflicts with reasoning pipeline |
| Sonar Deep Research | Search model — same timeout issue |
| DeepSeek V4 Flash Free / Big Pickle | Zen-only (no API key available) |
Resolved exclusions: o4-mini was previously excluded (OpenAI Responses API), but re-testing with
max_tokens ≥ 50on OpenRouter's chat completions endpoint returned validusage.prompt_tokens. Qwen 3.7 Max and Plus were also resolved — OpenRouter content guardrails no longer block them.
8.4 Other Limitations
- Input-only: Measures only prompt tokenization. Output tokenization is a separate variable measured in Session 6.
- Single-shot: Each model tested once per text sample — no variance or confidence intervals.
- English-only: All three passages in English. Tokenization patterns for non-English text differ substantially.
Next Up
Input efficiency is half the picture. Output tokens cost 4-30× more per token than input, and models differ wildly in how many words they generate for the same prompt. Session 6 tests all 50 model variants across 16 task types to measure output verbosity, thinking token overhead, and constraint adherence. Combined S5+S6 total experiment cost: ~$2.62.
Continue to: The 16 Challenges →
Takeaway
Token prices are meaningless without token counts. A model with $0.50/M input and E=1.76 is cheaper per word than one with $0.35/M input and E=2.66. When comparing models, always ask: "How many tokens does your tokenizer need for my kind of text?"
Try the Cost-per-Word Calculator →
Sources & further reading
All data in this post is original measurement by Clock Lobster Labs. The full CSV, harness, and methodology are open in the repo linked at the bottom of this page. The references below are the foundational sources we relied on, not a literature review of tokenizer-efficiency studies (we couldn't find one — which is why we ran this).
1. Unicode Standard Annex #29, "Unicode Text Segmentation." The word-counting standard used to compute E. unicode.org/reports/tr29/
2. OpenRouter API Documentation, "Usage Object." Source of all prompt_tokens counts in this dataset. openrouter.ai/docs/api-reference/usage
3. Sennrich, R., Haddow, B., & Birch, A. (2016). "Neural Machine Translation of Rare Words with Subword Units." ACL 2016. The paper that introduced BPE for NLP — the tokenization algorithm most of these models use. aclanthology.org/P16-1162/
4. OpenAI (2023). "GPT-4 Technical Report." arxiv.org/abs/2303.08774
5. Kudo, T. & Richardson, J. (2018). "SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing." EMNLP 2018. arxiv.org/abs/1808.06226
6. Rust, P., et al. (2021). "How Good is Your Tokenizer? On the Monolingual Performance of Multilingual Language Models." ACL 2021. aclanthology.org/2021.acl-long.185/
7. Stanford CRFM. "Holistic Evaluation of Language Models (HELM)." A reference framework for evaluating model cost/quality trade-offs. crfm.stanford.edu/helm
8. EleutherAI. "Language Model Evaluation Harness." github.com/EleutherAI/lm-evaluation-harness
9. Clock Lobster Labs. "LLM Cost Comparison" — the open dataset and harness behind this post. github.com/ClockLobsterLabs/LLM-Cost-Comparison
Raw data, methodology, and full CSV: github.com/ClockLobsterLabs/LLM-Cost-Comparison