How LLM API Pricing Works

Tokens, input vs output, context windows — why the same task can cost 50× more on one model than another, explained simply.

HomeLearn › What Is a Token? (And Why You're Billed by It)

What Is a Token? (And Why You're Billed by It)

Every time you call an AI model, you are not billed by the word, the character, or the request. You are billed by the token. Understanding what a token actually is, is the single most useful thing you can learn before trying to control your API costs.

A token is a chunk of text, not a word

A token is the unit a language model reads and writes. It is usually a fragment of a word rather than a whole word. Common short words like the or and are a single token, but longer or rarer words get split into several pieces. For example, the word tokenization might be broken into token + ization, two tokens.

A widely used rough rule for English is that 1 token is about 4 characters, or roughly 0.75 words. That means 1,000 tokens is somewhere around 750 words, and a single page of text (about 500 words) is roughly 650-700 tokens. These are approximations, not guarantees, because the exact split depends on the model's tokenizer.

Spaces, punctuation, and line breaks all count too. Even the invisible structure of your prompt consumes tokens.

Why models use tokens instead of words

Language models do not understand letters or words directly. They convert text into numbers, and the token is the bridge. Each token maps to an entry in the model's vocabulary, and the model does all its math on those numbered pieces.

This design lets a model handle any language, code, emoji, or made-up word without a fixed dictionary of complete words. A rare technical term the model has never seen as a whole can still be represented as a sequence of familiar sub-pieces. The trade-off is that unusual text, code, or non-English languages often use more tokens per word than plain English prose.

Input tokens vs output tokens are priced differently

Almost every provider charges two separate rates: one for input tokens (everything you send, including your prompt, system instructions, and any conversation history) and one for output tokens (everything the model generates back). Output tokens are typically several times more expensive than input tokens.

Here is an illustrative example to show the mechanics (numbers invented for clarity, not real prices): if input costs $1 per million tokens and output costs $5 per million tokens, then a call sending 2,000 input tokens and receiving 500 output tokens would cost (2,000 / 1,000,000 x $1) + (500 / 1,000,000 x $5) = $0.002 + $0.0025 = $0.0045. Small per call, but multiply by hundreds of thousands of calls and it matters.

To see real per-model rates side by side, the model comparison and the /models pages list current input and output pricing for each provider so you are not guessing.

Conversation history is billed on every turn

The most common billing surprise is that chat models are stateless. The model does not remember your previous messages between calls. To keep context, your application resends the entire conversation history with every new turn.

That means a long chat gets more expensive with each message, because the growing transcript is re-sent as input tokens every single time. A 20-message conversation can quietly send tens of thousands of input tokens on its final turn. If your costs climb during long sessions, this is usually why. Prompt caching (covered in its own guide) is one way to blunt this.

How to estimate your bill before you build

You can get a workable estimate with three numbers: average input tokens per call, average output tokens per call, and how many calls you expect per day or month. Multiply each token count by its per-token rate and add them together.

  • Estimate token counts by taking a realistic sample prompt and response, then dividing the character count by 4, or use a tokenizer tool for accuracy.
  • Multiply by volume to get a daily or monthly figure.
  • Add a buffer of 20-30% for retries, longer-than-expected outputs, and growing chat history.

The LLM cost calculator does this math for you: plug in your token counts and call volume, pick a model, and it returns an estimated monthly cost so you can compare options before writing any code.

Practical ways to use fewer tokens

Once you think in tokens, savings become obvious. Trim system prompts that repeat the same instructions verbatim on every call. Summarize old conversation turns instead of resending them in full. Ask for concise output when you do not need long answers, since output tokens cost the most.

Choosing a smaller model for simple tasks is often the biggest lever of all, because the per-token price difference between a flagship and a lightweight model can be 10x or more. Match the model to the difficulty of the job rather than defaulting to the most powerful one.

Frequently asked questions

How many tokens is a typical sentence?

A short English sentence of 15-20 words is usually around 20-30 tokens. As a rule of thumb, expect roughly 0.75 words per token, so token count runs a bit higher than word count.

Do I pay for tokens in the model's response?

Yes. Output tokens are billed separately from input tokens and are usually the more expensive of the two, so longer responses cost noticeably more.

Why does non-English text cost more?

Most tokenizers are optimized for English, so other languages and code often split into more tokens per word. The same meaning can cost 1.5-2x more tokens in some languages.

Educational only — not financial advice.