Skip to the workspace
Pebellslearn by building
Tokens, Context and Sampling  ›  Lesson

Tokens — How Models Read and Bill

Tokens 12 minLanguage models read, limit and charge for text in tokens, small pieces of words, so every length and cost estimate starts by converting to tokens.

ai engineer / Tokens — How Models Read and Bill

Explore each scene at your own pace.

01 · The rule

The rule

Tokens — How Models Read and Bill

The Pedal Point owner sees the first monthly bill for the assistant and asks, "Why is it priced per token? What even is a token?" It is the right question. Every limit you will hit and every cost you will pay is counted in tokens, so this is the unit to think in.

The rule

Models read, limit and bill in tokens, not words or characters.

Before a model sees your text, a tokenizer chops it into tokens: common pieces of text, each mapped to a number. Frequent words are often one token. Rare words split into several pieces:

"Your order has shipped"   →  Your | order | has | shipped
"Trekkaroo saddle"         →  Tre | kk | aroo | saddle

(The exact split depends on the model's tokenizer; this one is illustrative.)

Three things follow:

  • Length. A model's limit on how much it can read and write is set in tokens.
  • Cost. Hosted models usually charge per token, often at different rates for input tokens (what you send) and output tokens (what it writes).
  • Speed. Output is produced one token at a time, so long answers take longer.

A common rule of thumb for English prose: one token is about four characters, or three-quarters of a word. So 100 words is roughly 130 tokens. Treat it as an estimate. Code, numbers, unusual names, and many languages other than English can take noticeably more tokens for the same meaning. When precision matters, run the model's own tokenizer and count.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.