New here? Start this series at Day 1: Model choice is rarely your first production problem
- Day 1: Model choice is rarely your first production problem
- Day 2: LLMs generate one token at a time, so design for it
- Day 3: Tokenization quietly sets your cost, limits and reliability
- Day 4: More context can make an AI system worse
- Day 5: Vague prompts become vague systems
- Day 6: Temperature is a product decision, not a writing style
Tokenisation is the most boring topic in this series and it will show up on your invoice.
Models do not read characters or words. They read tokens, chunks of text carved up by a scheme optimised for the training data, which means English prose is efficient and almost everything else is not.
The efficiency gap
The same meaning can come out at wildly different token counts:
Plain English is roughly four characters per token. Code is worse, because indentation, symbols, and camelCase identifiers fragment aggressively. JSON adds its own overhead, because every brace, quote, and repeated key is paid for on every record. Many non-English languages are dramatically worse; the same sentence can cost two or three times more in one language than another, which quietly makes your product more expensive for some users than others.
Then there are the inputs nobody tests: a PDF extraction full of stray whitespace, a table flattened into repeated delimiters, a log file, a base64 blob that slipped into a document. Your demo prompt exercised none of this.
Two failures with one cause
The first is the bill. Costs modelled on sample prompts and encountered on real inputs. The gap is usually a multiple, not a percentage, and it appears at the worst moment, when usage grows.
The second, and sharper, is silent truncation. A long input exceeds the context limit (the most tokens a model accepts in one request), something upstream trims it, and the model answers confidently from the fraction that survived. There is no error or warning, just an answer that is missing the part of the document that mattered, and no signal distinguishing it from a good answer.
Neither is fixed by better prompting. Both need measurement, budgets, and normalisation before the expensive call.
What to do
Measure token usage on your worst realistic input, not a clean example: the biggest PDF, the messiest table, the longest conversation, the non-English case. That number is your real per-request budget.
Then normalise noisy text before it hits the model. Stripping duplicated whitespace and boilerplate from extracted documents is unglamorous and routinely cuts token counts by a meaningful fraction. Check a sample of the cleaned text before turning it on everywhere, since indentation carries meaning in code such as Python and a table can lose the layout that made it readable.
And make it visible: log token cost per request and put it on a dashboard from day one. Design conversations get concrete very quickly once everyone can see what a feature costs.
Decide what happens at the limit
Count tokens before the call. When an input is over budget, reject it with a clear message, split it into parts, or summarise it first, and log which you did. Each has a cost (a frustrated user, more calls, a lost detail), and each beats a silent trim, because it leaves a trace you can find later.
Terms in this piece
About this explainer
- Format
- Explainer
- Level
- Intro
- Read
- 2 min read
- Published
- May 23, 2026
- Disciplines
Short mental models: one idea, why it matters, what to do about it.
More on these topics
Article · · 3 min read
The first AI skill is knowing when to leave the model out
Many model calls in production could be a simple rule. How to tell when a problem needs a model and when it does not.
Article · · 1 min read
What an AI gateway actually costs to run
The operational bill for one gateway in front of a dozen tool servers, including the costs nobody budgets for.
Explainer · · 2 min read
Your AI feature has unit economics whether you measured them or not
Cost and latency belong to the workflow, not the model call. Budget them before rollout, not after the invoice.
Discussion