Skip to content
Glossary · LLM costs

Token (LLM)

Definition

The unit an AI language model reads and writes, and the unit most LLM APIs bill by.

Last updated

What it is.

A language model does not read words or letters. A tokenizer first splits text into tokens, which are often parts of words, whole short words, punctuation or spaces. Images and audio are also turned into tokens when a model accepts them.

Each model family has its own tokenizer, so the same text can be a different number of tokens on different models. APIs usually price input tokens and output tokens separately, per million tokens, and output is often the dearer of the two.

Why it matters

Tokens are the meter on every LLM bill and the unit of the context window. Knowing roughly how many tokens a feature uses per call, split into input, cached input and output, is the starting point for any cost estimate.

Watch out

Common mistakes.

  1. 01

    Estimating cost from word counts. Count tokens with the model's own tokenizer.

  2. 02

    Ignoring the token mix. Two features with the same total can cost very different amounts if one is output-heavy.

  3. 03

    Forgetting hidden tokens: system prompts, tool definitions, retrieved documents and reasoning output all count.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab