Skip to content

Command Palette

Search for a command to run...

← All concepts
Concept

Token

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

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. Always count tokens with tiktoken before calling the API to predict cost and avoid overflow.

Example

'Retrieval Augmented Generation' = 4 tokens. 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 3 tokens (token + ization split). Always count with the correct tokeniser, not by word count.