Tokens and context windows explained
Language models work with tokens, not words. What tokens are, what the context window limits and how both affect cost and answer quality.
A token is the unit in which a language model processes text. The context window sets how many tokens the model can take into account at once. Both terms show up in price lists, product descriptions and error messages, and they explain many quirks of AI services.
What is a token?
A model reads neither letters nor whole words but pieces of text. A token can be a short word, part of a word, a punctuation mark or a space with letters. Common words are often a single token; rare or long words are split into several. How text is split is decided by the provider, so the same text gives different token counts in different models.
As a rough rule, one token is about four characters in English. Many other languages need more tokens for the same content. The exact number comes from the provider's counting tool.
What is the context window?
The context window is the upper limit for everything the model sees in one pass: your instruction, earlier turns of the conversation, attached documents and the answer itself. When the limit is reached, nothing more fits. Applications then trim older parts of a conversation or reject the request.
Outside this window the model has no memory. What is not in the context is unknown to it for this request. If a chat seems "forgetful", it is often because early parts have dropped out. Even inside the window, not every position is used equally well; with very long inputs, details in the middle can be missed.
Why do tokens affect cost?
Many providers charge by processed tokens, separately for input and output. Long instructions, large documents and detailed answers therefore cost more. To reduce cost, cut unnecessary context, summarize older parts of a conversation or use a smaller model for simple tasks.
What if documents are too large?
If material does not fit, give the model only the relevant passages. That is what RAG does: for each question it searches out matching sections. Another option is to summarize long texts in stages. Be aware that outside content in the window can also carry hidden instructions, see prompt injection.
Frequently asked questions
How many words is one token?
It depends on language and model. On average a token is shorter than a word, and many non-English texts produce more tokens than English texts of the same length.
What happens when the context window is full?
Depending on the application, older content is trimmed or the request is rejected. The model cannot read beyond the window.
Is a bigger context window always better?
Not automatically. It allows more material but costs more, and with very long inputs details may be handled less reliably.
Where can I see my token usage?
Most providers show usage in billing or in their programming interface.
Let us talk about your project
Write to kontakt@phronox.de or use the contact form.
Request a project Book a consultation