Skip to content
← All concepts
Concept

Token

The unit of text an LLM processes — roughly 4 characters or 0.75 words for English.

How text becomes tokens, cost and context usage

Step 1 of 5

Raw text

The model never sees characters or words directly. 'Retrieval Augmented Generation' starts as a plain string.

Count with the right tokeniser; word counts are only a rough guide.

Simple explanation

LLMs don't read characters or words — they read tokens. A token is a chunk of text (often a word or part of a word). 'Hello world' is 2 tokens. You pay per token.

Engineering explanation

Tokens are produced by a tokeniser (e.g., tiktoken for OpenAI, Claude's tokeniser). English averages ~4 chars/token. Cost = (input_tokens × input_price) + (output_tokens × output_price). Context window is measured in tokens. Count tokens with the provider's tokeniser (for example tiktoken for OpenAI models) before calling the API to predict cost and avoid overflow.

Example

'Retrieval Augmented Generation' is roughly 4 to 5 tokens, depending on the tokeniser. A 1000-word article ≈ 1300 tokens.

When to use it

Always — tokens are the unit of LLM cost, context and latency.

Common misconception

Tokens are NOT words. 'tokenization' is often split into two tokens ('token' + 'ization'), depending on the tokeniser. Always count with the correct tokeniser, not by word count.