OpsVis.ai
Use CasesProductPricingIntegrationsGovernmentContact
OpsVis.ai
Sign InSign Up

Cost per token

Cost per token is the price paid (or charged) per unit of text processed by a large language model, typically expressed in dollars per million tokens and split between separate input (prompt) and output (completion) rates.

How cost per token is calculated

Cost per token is derived by dividing a vendor's published price for a batch of tokens (usually quoted per 1,000 or per 1,000,000 tokens) by that batch size, then multiplying by the number of tokens actually consumed in a request. A token is roughly three to four characters of English text, so the same sentence can tokenize to a different count depending on the model's tokenizer.

Because almost every commercial LLM API prices input and output separately, cost per token is really two rates, not one: an input (prompt) rate and an output (completion) rate. An accurate cost calculation has to apply each rate to its own token count rather than averaging the two.

Why input and output tokens are priced differently

Output tokens are almost always priced higher than input tokens — commonly three to five times higher — because generating each output token requires a full forward pass through the model, while input tokens can be processed in parallel during prompt encoding. A pricing model or invoice that ignores this asymmetry will systematically misstate cost for any workload with a large completion relative to its prompt.

Worked example

Take a request billed at $3 per 1,000,000 input tokens and $15 per 1,000,000 output tokens, with a prompt of 2,000 tokens and a completion of 500 tokens.

Cost of a single request

  1. Input cost = 2,000 tokens × ($3 ÷ 1,000,000) = $0.0060
  2. Output cost = 500 tokens × ($15 ÷ 1,000,000) = $0.0075
  3. Total cost per request = $0.0060 + $0.0075 = $0.0135

Related terms

  • Cost per inference
  • Token-based pricing
  • Usage-based billing
  • Blended cost vs. list price

Built by OpsVis.ai. The source code is available on GitHub.