LESSON 06 / 215·2 min readFoundation

Tokens and token usage

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Token
A small piece of text processed by a model. It may be a whole word, part of a word, or punctuation.
Schema
A description of the fields and value types that data should contain. It helps check that an answer has the expected shape.
Agent
An application that uses a model to choose its next action within defined limits. It can use tools and continue through several steps.
More words from this lesson
Throughput
How much work a system can finish in a given amount of time.
Caching
Keeping a result so it can be reused instead of calculated or fetched again. Cached data needs expiry and access controls appropriate to its use.

Overview

  • Tokens are the small units of input and output processed by a model.
  • A token might be a word, part of a word, punctuation, or another encoded unit.
  • Token counts depend on the tokenizer, language, and content; characters and words are only rough estimates.

Why this matters

Providers limit context, measure throughput, and often bill using tokens. You must budget the request and response.

An everyday example

A delivery company charges by package units, not by the number of sentences written on the packages.

A technical example

A request contains 500 instruction tokens, 800 conversation tokens, and 2,000 retrieved tokens: approximately 3,300 input tokens before tool schemas and other overhead.

How it works

  1. Tokenize all model-visible content
  2. Add reserved output capacity
  3. Check the selected model's limits
  4. Call the model
  5. Record actual reported usage.

Architecture and flow

Instructions + history + tools + evidence → token budget → provider → usage ledger.

The insurance assistant example

A long policy PDF should be parsed and selectively retrieved instead of copied into every claim conversation.

When to use it

Measure tokens for every production model call, including background agents and retries.

When to avoid it

Do not treat token counts as a direct quality score or use an English word estimate as an exact multilingual limit.

Interview answer

“Tokens are the model's processing units. I budget all input content plus output capacity and track actual provider usage to control limits and cost.”

Benefits, trade-offs, and production considerations

  • Output tokens can be more expensive than input tokens; cached input and reasoning usage may have separate accounting.
  • Read the selected provider's usage fields.
  • Bound both steps and tokens for agents.
PAUSE & RECALL

Can you explain it without the notes?

Tokens and token usage

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Tokens are the small units of input and output processed by a model. A token might be a word, part of a word, punctuation, or another encoded unit. Token counts depend on the tokenizer, language, and content; characters and words are only rough estimates.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Context window and context construction

Adapted from 13_AI.MD · “Tokens and token usage”. Examples are study fragments; framework behavior can depend on your version.