Skip to content
Tutorials

Tokens and Context Windows: How AI Models Count Text, Images and Audio

AIblogly Team October 12, 2026
Tokens and Context Windows: How AI Models Count Text, Images and Audio

Language models do not read words or characters. They read tokens - chunks of text that a model's tokenizer splits input into. Context windows, output limits and prices are all measured in tokens, so they are the unit behind most numbers on the models page.

What a token is

A tokenizer breaks text into pieces from a fixed vocabulary. Common words are usually a single token. Rarer words are split into several pieces, and spaces and punctuation are part of tokens too. Different model families use different tokenizers, so the same sentence can be a different number of tokens on different models.

Google's Gemini token documentation gives a rule of thumb for its models: a token is about 4 characters, and 100 tokens is about 60 to 80 English words. Other vendors publish similar approximations for their own tokenizers. Text in many other languages, and computer code, often uses more tokens for the same amount of meaning than English prose does.

Tokenizers change between model versions. When a vendor releases a new tokenizer, the same text can cost more or fewer tokens than before, which affects the bill even when the per-token price stays the same.

Images, audio and video are tokens too

Models that accept other media convert it into tokens as well. Google's documentation gives the rates for Gemini:

InputToken cost
Image up to 384 x 384 pixels258 tokens
Larger imagesplit into 768 x 768 tiles, 258 tokens each
Video263 tokens per second
Audio32 tokens per second

At those rates, a one-minute audio clip is about 1,920 tokens and a one-minute video about 15,780. Other vendors use their own methods, and their documentation gives the formulas.

Most APIs also provide a way to count tokens before sending a request - in the Gemini API, a count_tokens method.

The context window

The context window is the maximum number of tokens a model can work with in one request. Everything counts against it: the system prompt, the conversation history, attached documents and images, and tool definitions. When a conversation outgrows the window, something has to be dropped or summarised.

Two separate limits are usually published:

  • Context window - the total the model can take in.
  • Maximum output - how many tokens it can generate in one response, usually much lower.

A larger window lets a model take in more at once. It does not guarantee the model uses all of it equally well; long-context benchmarks exist to measure how well models retrieve and use information spread across a long input. Results for these are on the benchmarks page.

How per-token pricing adds up

API prices are quoted per million tokens, with input and output priced separately. The cost of one request is:

(input tokens / 1,000,000 x input price) + (output tokens / 1,000,000 x output price)

A worked example with round, hypothetical prices of $2 per million input tokens and $10 per million output tokens: a request with 20,000 input tokens and 1,000 output tokens costs 0.02 x $2 + 0.001 x $10 = $0.04 + $0.01 = $0.05.

Two things follow from the formula. Long inputs repeated on every call - a large document, a long conversation history - dominate cost for many applications, which is why vendors offer cheaper rates for cached input. And reasoning models generate thinking tokens before their answer; vendors typically bill those as output tokens.

Real prices for each model, with input and output side by side, are on its model page and on the comparison pages.

Related

Related Guides

Enjoyed this? Get more in your inbox.

Up to ten of the week's AI news stories, by email once a week.