Token

A token is the small unit of text, often a whole word or a piece of one, that a language model reads and writes and that AI providers bill by.

Language models do not read letters or words the way people do. Before any text reaches the model, a program called a tokenizer cuts it into pieces called tokens and swaps each piece for a number from a fixed vocabulary. A common word is often a single token. A rarer word gets split: Hugging Face's course uses the example of annoyingly becoming annoying and ly. The model only ever sees the numbers, and it answers in numbers that are turned back into text.

Many modern tokenizers, including those of OpenAI's GPT models, use a method called byte-pair encoding. It began as a data compression algorithm, first described by Philip Gage in 1994. In 2015 Rico Sennrich and colleagues adapted it for machine translation, so a system could handle rare and unknown words by building them from smaller pieces. Starting from single characters, the method repeatedly merges the pair of adjacent pieces that appears together most often, so frequent words end up whole and unusual ones are spelled out in fragments.

For a business, tokens matter because they are the meter. Providers price their services per token, count the tokens you send and the tokens the model writes back separately, and set the size of the context window in tokens. OpenAI's rule of thumb for English is that one token is about four characters, or about three quarters of a word, so 100 tokens come to roughly 75 words. Other languages can work out differently, so the same message can cost more in one language than another.

Tokens work like minutes on an old phone bill: the charge depends on length, not on how useful the call was. Each provider builds its own tokenizer, and OpenAI's documentation warns that token IDs depend on the encoding a model uses. So a document that counts as a given number of tokens with one provider can count differently with another. When you compare prices, compare the cost of a real task, not the price per token alone.

Common questions

How many words is 1,000 tokens?

For English text, about 750 words. OpenAI's rough guide is that 100 tokens come to about 75 words, and one token is about four characters. The ratio shifts with the language, the writing style and the tokenizer a given model uses, so treat it as an estimate for budgeting and use the provider's own counting tool when the exact figure matters.

Is a token the same as a word?

No. A token can be a whole word, part of a word, a single character or a piece of punctuation. Common words are usually one token, while long or unusual words are split into several. Spaces are often folded into the token that follows them. That is why token counts run higher than word counts for the same passage of English.

Why do AI companies charge by the token?

Tokens are the unit a model actually processes, so they track the work it does. A longer prompt means more tokens to read, and a longer answer means more tokens to write. Providers count input tokens and output tokens separately, and input they can reuse from an earlier request may be priced differently, so the mix of reading and writing in a task affects the bill.

What is a tokenizer?

A tokenizer is the program that turns text into tokens before it reaches a language model, and turns the model's output tokens back into text afterwards. It works from a fixed vocabulary learned from a large sample of text. Each model family has its own tokenizer, which is why the same sentence can produce a different token count on different models.

Finding more

Search for "byte-pair encoding tokenizer", "subword tokenization" or "how to count tokens" with a provider's name to see how a particular model splits text. The most reliable sources are model providers' own documentation and token counting tools, which reflect the tokenizer that model actually uses, along with free courses such as Hugging Face's. Treat third-party calculators that claim one count for every model with care, since each provider's tokenizer produces different numbers.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.