Skip to content

Why does everyone talk about tokens? The invisible unit behind AI

Understand what tokens are, why they are not words and how they affect language-model inputs, outputs, context windows and API costs.

Why does everyone talk about tokens? The invisible unit behind AI
In this article

Reference guide — created November 22, 2026. The token concept remains useful, but tokenizers, context limits, billing rules and multimodal processing vary by model and version. Consult the current provider documentation before estimating usage.

TL;DR: A token is a unit processed by a model, not a word or a digital currency. A tokenizer segments text and maps those parts to numerical IDs. Tokens also measure input, output and available context, which is why they appear in model limits and API pricing. Different tokenizers may count the same text differently.

Advertisement Precivo

01 — The discovery: why not just count words?

You send a short question to an AI assistant. The interface reports “250 input tokens” and “90 output tokens.” Another article talks about models supporting thousands of tokens of context. A pricing page quotes a rate “per million tokens.”

AI seems to revolve around a unit nobody has explained. The basic idea is straightforward: a model does not consume human-readable words in the same way we do.

A tokenizer breaks text into units using a defined vocabulary and maps each unit to a numerical identifier, a token ID. The model turns these IDs into learned numerical representations and calculates how the sequence might continue.

Building blocks — a useful but imperfect analogy

Imagine building a sentence from interlocking pieces. Some pieces represent complete words, some frequent word parts, and others include punctuation or spaces. A tokenizer chooses from its particular set of pieces.

The analogy has limits. The pieces have no universal length, and different tokenizers can split the same sentence differently. The model manipulates IDs and representations; it does not consult a human dictionary for each piece.

See OpenAI’s token explanation and the Hugging Face tokenizer overview.

What happens to a question?

Consider “How much does delivery cost?”

  1. Text arrives from the user.
  2. Tokenization divides it into units according to a chosen tokenizer.
  3. IDs encode those units numerically.
  4. Model processing turns those IDs into learned representations and computes possible continuations.
  5. Generation: for typical autoregressive language models, the model selects the next token, extends the sequence and repeats. Decoding produces the visible text.

A model need not generate one whole word at a time. It may generate a fragment, which is one reason there is no fixed word-to-token ratio, especially across languages, code, numbers and emoji.

Why tokens appear on the bill

Many text-model APIs account separately for input tokens and output tokens. Input may include your prompt, instructions, history and tool responses. Output is generated text or other model outputs. Some platforms also distinguish cached input, reasoning tokens, tool use and non-text modalities.

For an API pricing text tokens per million, a simplified estimate is:

Approximate cost = (input tokens / 1,000,000 × input rate) + (output tokens / 1,000,000 × output rate).

Actual bills may account for caching, tools, images, audio and other features. Local token counts are estimates unless they exactly match the request representation and model encoding. OpenAI’s counting guide.

Tokens are not cryptocurrency, stored account credits or a direct measurement of CPU seconds. They are units of representation and, in many systems, resource accounting.

The context window

A context window is the model’s input-and-generation working budget, commonly measured in tokens. It can include instructions, documents, past messages and tool outputs, with space reserved for generated responses depending on the product.

Consider a coding agent reading files, logs and tool results over hours. These materials can consume context. When a limit is approached, an application might summarise, omit, retrieve or reorganise older information — or stop.

A bigger window is not a guarantee of perfect recall. Capacity and effective use of context are different questions. What the chat interface displays may also differ from what is sent in any one model call.

Images and audio

Non-text modalities may be represented using tokens or other model-specific units. Do not apply a text-based words-per-token shortcut to images or audio seconds. Providers define their own multimodal accounting rules.

02 — The Solo verdict

Our straight take: is it worth your time?

For a solo builder, tokens help answer how much information to send, what an API call may cost and when to retrieve just the relevant records.

Optimisation is not simply deleting words from every prompt. A prompt that becomes ambiguous can waste more time and money through poor results. Aim to avoid repeating huge documents unnecessarily while preserving the context needed for reliable output.

Advertisement Flokin

03 — The workbench: see text become pieces

  1. Open the visual tokenizer and enter “How much does delivery cost?”.
  2. Observe the token count and segmentation. Try “Order #412: $37.50” and a sentence with punctuation or accented characters.
  3. When the tool offers more than one encoding, compare them. Do not treat any one result as universal.
  4. Read the token counting explanation, then identify input, output and context limits in your own model service.

Optional coding exercise: install the official tiktoken package in a Python virtual environment and inspect a specific encoding:

import tiktoken

encoder = tiktoken.get_encoding("cl100k_base")
text = "How much does delivery cost?"
ids = encoder.encode(text)
print("IDs:", ids)
print("Count:", len(ids))
print("Reconstructed:", encoder.decode(ids))

The example uses one named encoding, not necessarily your chosen model’s tokenizer. Expect IDs, a count and a reconstructed sentence, not a universal token number.

Next: now that you know what the model receives, learn how Transformer architectures relate the pieces and generate useful outputs.

Sources: OpenAI — tokens, tokenizer, tiktoken, Hugging Face.

More in Tutorials

See all

Advertise

Solopreneurs, makers and creators who use AI and automation every day. Editorial and media formats for brands that bring real value to this reader.

Talk to us about formats

Every partnership goes through editorial approval. No misleading promises.

  1. Sponsored articles Useful content, in the Caminho Solo tone and standard.
  2. Banners and display Placements in strategic areas of the site.
  3. Commercial partnerships Series sponsorships, affiliate partnerships, and custom campaigns.
  4. Native content Guides, tutorials or comparisons featuring your product.

Get in touch

Let's talk

Have questions, suggestions, or want to collaborate? Fill out the form below and we'll get back to you soon.

Prefer email?

contato@caminhosolo.com.br

We respect your privacy. Your data will only be used to respond to your message.