Model Mechanics1 / 5 · Tokens are the meter

1 of 5 · Start here

Tokens are the meter

Before a language model can answer, it cuts your message into pieces called tokens. Providers count those pieces on the way in and again on the way out. Three short activities show the cut and what it does to cost.

Input
The tokens the model reads
Output
The tokens the model writes
Cost
Tokens × number of uses × rate

Start here · The whole machine

One answer takes many trips

Your message enters as text. The tokenizer cuts it into tokens, and the rest of the model works with those tokens. At the far end, the model picks one new token and adds it to the text.

Then the machine runs again to pick the next token, and again for the token after that. The input meter counts your message once. The output meter counts each new token that the model writes.

Watch · 30 s

Follow the tokens through the front of the machine. Watch the output counter go up by one on each trip.

0000002949134295316537188302461
Pass 1: all 5 prompt tokens go through
Type slugs: tokens, each with its IDCounters: tokens in and tokens outBack deck: the build line, which runs onceThe prompt "the model reads the text" becomes 5 tokens, and the model writes "one token at a time." in 6 passes. The input counter counts the prompt once. The output counter adds 1 for each new token. Pass 1 sends all 5 prompt tokens through the stack. Each later pass sends only the newest token, and the cache holds the rest. The IDs come from the site's teaching tokenizer. The scores and station sizes are illustrative.

Keep two ideasThe model receives tokens, not words. It makes one trip for every token that it adds to the answer.

Activity 1 · See the meter

Put a sentence through the tokenizer

A token can be a whole word, part of a word, a number, or a punctuation mark. Common text often fits into large pieces. Less familiar text often breaks into more pieces. More pieces mean more tokens on the bill.

Do this · 1 min

Pick a sample and look at the pieces. Then type your own sentence and watch the token count change.

the model reads the text and predicts the next token0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246010TOKENSthemodelreadsthetextandpredictsthenexttoken
  1. ␣the
  2. ␣model
  3. ␣reads
  4. ␣the
  5. ␣text
  6. ␣and
  7. ␣predicts
  8. ␣the
  9. ␣next
  10. ␣token

Most common words fit into one piece in this teaching tokenizer.

Words
10
Tokens
10
Extra pieces
0
Cost at the example rates1 use1,000 uses1 million uses
To send this text$5 per million tokens<$0.01$0.05$50.00
To write this much$25 per million tokens<$0.01$0.25$250

Lit slug: the newest tokenSlugs: one token each, in two tonesType case: the vocabulary, one compartment per pieceDashed slug: the vocabulary lacks this piece, but it is still one tokenThe tokenizer cuts the text into pieces. Each piece is one token, and each token is one slug. The stick holds up to 24 slugs. The window on its follower counts the rest. This page uses a small toy tokenizer that learned from English text. Costs use the site's example rates: $5 per million input tokens and $25 per million output tokens.

Activity 2 · Test your instinct

Which message costs more?

You do not need to guess an exact count. Pick the message that you think uses more tokens. The reveal shows both counts and the monthly cost if a service sends that message one million times.

Do this · 2 min

Read A and B, then pick the one that you think costs more. There are three rounds.

0000

Slug: one token. Pan A is on the left, pan B on the right.Pointer: the difference in tokensCounter: the tokens on the pan above itEvery slug weighs the same, so the pan with more tokens goes down. The counts come from this page's small teaching tokenizer, which learned from English text. Production tokenizers cut text differently. Cost assumes 1 million sends a month at $5 per million input tokens.

Activity 3 · Change the bill

Get the monthly bill below $55,000

A help-desk assistant handles 100,000 requests a day. Each request carries the same instructions, some background material, and an answer. The bill starts at $82,500 a month. Choose any two changes.

Do this · 2 min

Throw two levers. Watch which part of the bill shrinks, and check whether you reach the target.

Instructions
$22,500
Background
$30,000
Answers
$30,000
Total · target $55,000
$82,500

Choose two changes to reach the target.

Levers: each lever makes one changeCoins: each coin is $3,750 a monthColumn and ruler: the total bill and the $55,000 target bandA help-desk assistant handles 100,000 requests a day for 30 days. Input costs $5 per million tokens. Output costs $25 per million tokens. The request volume and the rates are examples. Real providers use their own rates.

Output tokens cost five times as much as input tokens at this example rate. That is why the shorter answer saves the most, although it removes the fewest tokens.

Next · The middle of the machine

What happens between the cut and the answer

Activity 1 ends where the model's work begins. Each token becomes a list of numbers. The transformer mixes information across the whole message. Then the model scores every possible next token and picks one. That one pick is one output token on the bill, and the machine goes around again.

To see these steps, read How a language model turns text into the next token. For a video introduction, watch 3Blue1Brown's Transformers, the tech behind LLMs and Attention in transformers.

About this page. The tokenizer here is a small teaching model trained on English text. Production tokenizers have much larger vocabularies and cut text differently. Every provider sets its own rates. The dollar figures use one example rate so that the activities stay easy to compare: $5 per million input tokens and $25 per million output tokens. Many providers also discount repeated text at the start of a prompt through prompt caching.