Token

A token is the unit a language model reads and bills in: a common word, a word fragment, or a punctuation mark, roughly three to four characters of English on average.

Models do not read characters or words. They read tokens, which are the pieces a tokenizer cuts text into. Frequent words tend to be one token each; rare words, identifiers and non-Latin scripts are cut into several. getUserById is more tokens than it looks, and a paragraph of Japanese is more tokens than the same paragraph in English.

Everything is counted this way: your question, the files sent with it, the model's answer, and the entire conversation so far. That last part is what makes tokens the operative unit of cost in an agent session rather than a technical detail. History is re-sent on every turn, so a token added early is paid for many times.

A useful rule of thumb for English prose is around 750 words per thousand tokens. For source code, expect worse: identifiers, punctuation and indentation all cost.

All terms