What are tokens used for?
A language model does not read words the way we do: it splits text into tokens, fragments that can be a whole word, part of a word or a punctuation mark. It works on these units and generates its answer one token at a time.
The token is also the technical and economic unit of measurement of generative AI: most APIs bill input tokens and generated tokens separately, and a model’s context window is expressed in tokens.
How text is split into tokens
Each model has its own way of splitting text (its tokenizer), so the same text does not give the same token count from one model to another.
- 1 Step 1 The input text Your prompt, any attached documents and the conversation history are sent to the model.
- 2 Step 2 Splitting The tokenizer breaks the text into frequent fragments: common words stay whole, rare words are split.
- 3 Step 3 Conversion Each token is given a numerical ID, which the model turns into a vector in order to process it.
- 4 Step 4 Generation The model produces its answer one token at a time, until the text ends or the set limit is reached.
Why tokens matter in business
- Budgeting Estimate the cost of a project from the volume of requests and the average number of tokens per exchange.
- Performance Short, focused prompts generally reduce response time and the bill.
- Long documents Check that a contract or report fits in the context window; if not, split it or use RAG.
- Multilingual For the same content, a text in French or Spanish often uses slightly more tokens than in English.
Input or output tokens?
| Input tokens | Output tokens | |
|---|---|---|
| What they count | Prompt, documents and history sent to the model | Text generated by the model |
| Price | Generally the cheaper of the two | Generally more expensive per token |
| How to reduce them | Send only the useful context | Ask for concise answers in a precise format |
| Limit | The model’s context window | A maximum output length specific to each model |
Some providers also charge a reduced rate for parts of a prompt reused from one request to the next (caching).
Frequently asked questions
-
It depends on the model and the language. In English, a token averages roughly four characters; the same content in French or Spanish usually needs slightly more tokens. Providers offer tools for exact counts.
-
Yes, for multimodal models: an image is converted into tokens according to its size and resolution, which counts towards the context window and the cost.
-
By sending only the useful context, summarising long histories, choosing a model suited to each task and monitoring usage by use case.
