LLMs and tokens · ai-003

Why is AI priced in tokens?

AI services charge by the number of pieces, called tokens, that your text is split into.

At a glance

AI language models do not read text letter by letter. They read it in pieces called tokens, and they write their answers one token at a time. So AI services charge by the token: the number of tokens in your question and in the answer, each multiplied by a per-token price. Common words tend to be a single token, while rare words are split into several smaller ones. To keep costs down, send only the text the model needs and tell it how long the answer should be.

Text becomes numbered tokens

Before a model sees your question, a tokenizer splits the text into tokens and replaces each one with its ID number in the model’s vocabulary. The model works with those numbers. When it answers, it produces one token at a time, and each new token is converted back into text.

The request "Summarize the meeting notes in three lines" split into eight example tokens, each with an example ID number. Below, a bill: question tokens times the input price plus answer tokens times the output price. (Example split, IDs, and pricing structure)

A token can be a whole word, part of a word, or a punctuation mark, and each model splits text in its own way. The same sentence can come out as a different number of tokens in different models.

How tokens are chosen

Nobody writes the list of tokens by hand. It is learned from a large body of text by grouping letters that often appear together. A 2015 paper (Sennrich et al., published at ACL 2016) proposed representing rare and unseen words as sequences of subword units: pieces smaller than a word. The method works like this. Start with each single character as its own piece. Across all the words in the text, find the pair of pieces that most often appear side by side, and merge them into one new piece. Repeat many times. Common words gradually become a single large piece, while rare words remain several small ones. The method is known as byte pair encoding (BPE).

Starting from single letters in the words low, lower, and lowest, the pair that appears most often is merged step by step: l + o becomes lo, lo + w becomes low, then low + e becomes lowe, a piece that is not a word on its own. (Example)

Because the pieces come from frequency rather than meaning, they do not always line up with words or syllables, and a word can be split in the middle.

Reading a price list

The bill is the number of tokens times the price per token. Two details matter:

  • Price lists usually give separate prices for input tokens (your question and any documents you attach) and output tokens (the answer). For example, Anthropic’s price list for Claude Sonnet 5.5 shows 2 US dollars per million input tokens and 10 dollars per million output tokens (checked 2026-11-28; prices can change). At those prices, one answer token costs five times as much as one question token.
  • A token’s length does not affect its price. A long, common word that fits in one token costs the same as a short token. What you pay for is the count.

Different languages, different counts

A 2023 study (Petrov et al., NeurIPS 2023) found that the same text translated into different languages can produce very different token counts, up to 15 times as many in some cases. The authors point out that speakers of languages that need more tokens pay more for the same content, wait longer for it to be processed, and can fit less text into the model at once. The size of the gap depends on the model. If a service shows you token counts, you can compare the same content in two languages yourself.

Remember

  1. Use a smaller model for simple jobs; the price per token differs between models.
  2. Send only the parts of a long document that the task needs.
  3. Tell the model how long the answer should be (“in three lines”); answer tokens usually cost more.

Next question

If the answer is built one token at a time, how does the model choose each next token? The next lesson in this layer, Why does AI state falsehoods so confidently?, takes up that question and explains why the result can be a plausible-sounding falsehood.

Sources

Stay in the loop

Get new posts by email, plus launch news when it's ready. No spam.