How to estimate LLM token costs.

A five-minute method that gets you within the right order of magnitude.

  1. Count input tokens. A rough rule for English is about 4 characters per token. Paste a real prompt into the calculator to estimate it.
  2. Count output tokens. Measure a few real responses. Reasoning models also bill hidden thinking tokens as output.
  3. Multiply by volume. Cost = (input tokens × input price + output tokens × output price) × requests ÷ 1,000,000.
  4. Subtract caching. Repeated prefixes (system prompts, documents) can bill at the cached rate.
  5. Check the fine print. Long prompts can trigger higher rates: OpenAI above 272K tokens, Google and xAI above 200K on several models, Claude Haiku 5.5 above 100K.

Note that tokenizers differ: Anthropic says Claude 4.7 and later produce about 30% more tokens for the same text than earlier Claude models.

All prices from official provider pages, checked Oct 20, 2026. See sources.