Tokens (and Why They Cost Money)
Tokens are the small text chunks an AI processes โ and usually what you pay for.
What is a token?
A token is a piece of text โ often a word, part of a word, or a punctuation mark. "Cat" might be one token; "unbelievable" might get split into two or three pieces. An LLM doesn't read and write in letters, it reads and writes in tokens.
Rule of thumb
In English, roughly 4 characters equal about one token. A word is often 1-2 tokens. A normal paragraph quickly adds up to 100+ tokens.
Why does that cost money?
Most AI providers charge per token โ separately for "input" (what you send in) and "output" (what the AI writes back). More context, longer prompts, and longer answers all mean more tokens, which means higher cost. That's why it pays off to keep prompts focused instead of dumping huge files in unnecessarily.
A practical consequence
If you work with a coding agent that reads whole files, that consumes tokens. Just throwing a 10,000-line file at it can be slow and expensive โ sharing only the relevant part is usually smarter.
EXAMPLE
The sentence 'I love programming!' is roughly 5 tokens (I | love | program | ming | !).
QUICK QUIZ
What do most AI APIs base their pricing on?
SOURCES
- Wikipedia: Lexical analysis (tokenization) โ en.wikipedia.org
- Anthropic docs: Token counting โ docs.anthropic.com
- OpenAI Cookbook: How to count tokens with tiktoken โ cookbook.openai.com