If you spend any time around AI, you will keep bumping into the word “token.” The context window is measured in tokens. Pricing is per token. Bills go up when you use more of them. It is the basic unit everything in AI is counted in, and it is worth five minutes to understand.
What a token actually is #
A token is a chunk of text. Not quite a word, not quite a letter, but something in between. Before a language model can work with your text, it chops it into these chunks, because the model does not operate on raw letters or whole words, it operates on tokens.
As a rough rule, one token is about three-quarters of an English word, or roughly four characters. Common words are often a single token. Longer or rarer words get split into several. So “cat” might be one token, while “unbelievable” might be broken into “un,” “believ,” and “able.”
You do not need to predict the split exactly. The number to remember is the ratio: a page of text is very roughly 500 tokens, and 1,000 tokens is about 750 words.
Why everything is measured in tokens #
Tokens are the model’s native unit, so everything about working with a model is counted in them:
- The context window (how much the model can consider at once) is a token budget. A “200,000 token” window holds about 150,000 words of everything combined. This is the subject of its own article.
- Speed is often described in tokens per second, because the model generates one token at a time.
- Price is quoted per million tokens, split into input (what you send) and output (what the model generates), usually with output priced higher because generating is more expensive than reading.
Every interaction has a token count going in and a token count coming out, and those two numbers drive both the cost and whether it even fits.
Why your bill moves #
Once you know that input and output tokens are what you pay for, the cost of AI stops being mysterious:
- Long prompts cost more. If you paste a huge document in every request, you pay for all of those input tokens every time.
- Long answers cost more, and output usually costs several times what input does, so a model that rambles is expensive twice over.
- Conversation history adds up. In a chat, the whole history is usually re-sent on each turn, so a long conversation quietly grows the input token count with every message.
The practical lesson: if you are paying per token, trimming what you send and asking for concise output are the two biggest levers on cost.
Why code and other languages cost more #
Here is a detail that surprises people. The same amount of information does not always use the same number of tokens. Tokenizers are optimized for common English text, so:
- Code tends to use more tokens per character, because of all the symbols, indentation, and variable names the tokenizer was not optimized for.
- Non-English text, especially languages that do not use the Latin alphabet, often uses substantially more tokens for the same meaning.
So a prompt that looks the same length as an English one can cost noticeably more if it is dense code or another language. If you are budgeting, do not estimate from word count alone.
How to actually count them #
You do not have to guess. Most AI providers offer a token-counting tool or endpoint that tells you exactly how many tokens a given piece of text is for a given model (counts differ slightly between models). If cost or fitting inside the context window matters for what you are building, measure with the real counter rather than eyeballing it, and never reach for a generic word-count as a stand-in.
That is the whole concept. A token is a chunk of text, the model works in tokens, and so does your bill. Keep the ratio in your head, remember that output is the pricey side, and most of the economics of using AI becomes predictable. The next thing worth understanding is where all those tokens have to fit: the context window.