instibrain
instibrain  /  guides  /  ai basics  /  lesson 1
lesson 1 of 8 · ai basics

Tokens and the context window.

A token is the unit a model reads, writes and charges for. The context window is how many of them fit in one call.

new words

Token
A piece of text the model reads as one unit, about three-quarters of a word. 1,000 tokens is about 750 words.
Tokenizer
The fixed table that cuts text into tokens. It is part of the model, so two models can cut the same sentence differently.
Context window
How many tokens fit in one call, prompt and answer together. Current Claude models hold 1,000,000.
Prompt caching
The provider keeps a beginning it has already read, so the next call that starts the same way pays a twentieth for it.

the lesson

Everything you send is cut into tokens first: your message, the pages Claude reads, the output of every command. Everything the model writes comes out as tokens too. An account that calls the model through its API pays per token, one price for the tokens it reads and a higher one for the tokens it writes. A brain keeps the window small: your AI reads who it is and what exists first, then one page at a time (progressive disclosure).

1,000 tokens is about 750 words, or two pages. A 300-page book is about 150,000 tokens, so the window of a current Claude model holds six such books. One answer is at most 128,000 tokens.

ModelReads, per millionWrites, per million
Opus 5.5$4$20
Sonnet 5.5$2$10
Haiku 5.5$0.10$0.50

These are Anthropic's list prices for its API. Haiku's hold for prompts up to 100,000 tokens. Haiku costs 40 times less than Opus, and every model writes at five times the price it reads.

A 10,000-token instruction file costs $0.04 to read on Opus 5.5. The next call that starts with the same file reads it from the cache at $0.20 per million: $0.002. Work that can wait a few hours goes to the Batch API at half price.

How a tokenizer learns its pieces, and why a number is cut into several: How a model works, lesson 2.

An example cut, one chip a token; the full stop would be one more. The real tokenizer cuts a long or rare word into pieces, so the count lands near the word count, not on it. The bars are to scale.

try it

Type this, paste a paragraph from one of your pages after it, and press Enter:

How many words is this paragraph, and about how many tokens? Say why the two differ.

you should see

  • Two numbers, the token count about a third above the word count. Claude estimates it; only the tokenizer knows the exact count.
  • A reason: a long or rare word is cut into several tokens, and each punctuation mark counts.