Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder

AI builder glossary

Token

The chunk of text a model processes as a single unit, often a word fragment, which sets how much fits in a request and how much each call costs.

Models don't read characters or words; they read tokens. A tokenizer splits text into pieces from a fixed vocabulary: common words are often one token, rarer words, code, and non-English text break into several. Images, PDFs, and audio are converted into tokens too.

Tokens are the unit behind three numbers you will watch constantly. Input tokens (your instructions, history, and retrieved documents) and output tokens (what the model writes, including any thinking) are billed separately, with output usually costing several times more. The context window is measured in tokens. And generation speed is roughly tokens per second, so long outputs mean long waits.

The common mistake is estimating with rules of thumb or another vendor's tokenizer. Different model families tokenize differently, so the same prompt can be a noticeably different count on two providers. Use the provider's token-counting endpoint for estimates and the usage field on each response for the real numbers, and log both input and output tokens per feature from day one.

Tokens are also where most cost savings come from: trimming bloated prompts, capping output length, caching stable prefixes, and sending only the context a task needs.

Example

A team notices its ticket-summary feature costs more than expected. Logging usage per call shows the system prompt is small but each request includes the full 40-message thread, so they switch to sending only the latest messages plus a running summary.

Learn more in the course

Related terms

Go from definitions to doing

Learn to build AI-powered apps in 132 practical lessons.