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

Short mental models: one idea, why it matters, what to do about it.