tokenguardrail_
Blog

How LLM API Pricing Actually Works (Tokens, Explained)

July 28, 2026 · 7 min read

A plain-English breakdown of how LLM API pricing works: what a token is, why input and output are billed differently, and how to turn a rate card into a real cost estimate.

Every AI provider prices the same way, and it looks deceptively simple: a few dollars per million tokens. But how LLM API pricing works in practice trips up almost every team, because the unit you're billed on - the token - doesn't map to anything you naturally think in. This is the mental model that makes the bill predictable.

What a token actually is

A token is a chunk of text, roughly 4 characters or three-quarters of a word in English. "Cost control" is about 3 tokens; a paragraph is a couple hundred. Providers bill per token because that's the unit the model processes - not per request, not per word, not per character.

Input and output are priced separately

This is the part that surprises people. You pay for two things on every call:

  • Input tokens - everything you send: the system prompt, the conversation history, retrieved documents, tool definitions.
  • Output tokens - everything the model generates back.

Output tokens usually cost 3-5x more per token than input. That single fact drives a lot of cost strategy: a chatty model that pads its answers is expensive in a way that isn't obvious from a single per-million headline number. We cover the asymmetry in depth in token usage limits.

Turning a rate card into a real estimate

To estimate the cost of one call, price the two sides separately and add them:

// Rates are per 1M tokens - divide by 1,000,000 per token.
const cost =
  (inputTokens  / 1_000_000) * inputPricePerM +
  (outputTokens / 1_000_000) * outputPricePerM;

// Example: 4,000 in + 800 out at $3 / $15 per 1M
// = (4000/1e6)*3 + (800/1e6)*15
// = $0.012 + $0.012 = $0.024 per call

Multiply by calls per user, per day, and you have a monthly figure. The trap is that input tokens grow every turn in a conversation - see why agent costs compound - so a per-call estimate understates a multi-turn feature badly.

The hidden multipliers on your bill

  • Conversation history. Each turn resends the whole transcript as input. Turn 10 pays for turns 1-9 again.
  • Model choice. The top tier can cost 10-20x the cheapest one for the same task - compare them in Claude model cost.
  • Caching and batch discounts. Cached input and async batch jobs bill at a fraction of standard rates - money left on the table if you ignore them. See prompt caching savings.

Once you can read a rate card in tokens and separate input from output, the invoice stops being a mystery. The next step is enforcing a number on it - the LLM cost control guide covers the controls that keep the estimate from becoming a surprise.

// get started

Stop finding out from the invoice.

// keep reading