Tokens
Tokens are the chunks of text a language model reads and writes - frequent words, parts of words, punctuation - and the unit in which prices, limits and the context window are measured.
Before a model sees any text, a tokenizer splits it into pieces from a fixed vocabulary, typically built by repeatedly merging frequent character pairs (byte-pair encoding). Common words become one token, rare words and names are split into several, so any text can be represented. In English a token is roughly three quarters of a word; other languages and code often need more tokens for the same content. Because the model works on tokens, not letters, tasks like counting characters can trip it up, and every API bill, output limit and context window is counted in them.
Key points
- Roughly 750 English words ≈ 1,000 tokens; other languages and code usually take more.
- Different model families use different tokenizers, so the same text has different token counts.
- Input and output tokens are priced separately; output tokens usually cost more.
- In an agent, every turn resends the whole history, so token usage grows with each step.
Learn it by building
Way of the Agent teaches AI agent engineering level by level - concepts like this one, then hands-on practice, XP, and the AI Chronicles.
Start learning free →