LLM API pricing changes frequently. Prices in this article are reference values from July 2026. Always check each provider’s official pricing page.

How Pricing Works

LLM APIs charge per token — input and output tokens priced separately, with output typically more expensive. Understanding the price structure matters more than memorizing numbers, which change almost monthly.

Easy-to-Miss Costs

Context length drives cost. A chatbot carrying 10 rounds of history bills all those tokens as input. Without truncation, input costs dominate.

Default max_tokens too high. Many APIs set generous defaults. Set explicit limits if you only need short responses.

Streaming costs the same. Streaming changes only the transport, not token consumption.

Saving Strategies

  1. Tiered routing: lightweight models for classification/extraction, strong models for final generation
  2. Cache common results
  3. Cap max_tokens to actual needs
  4. Audit usage weekly — anomalies usually come from one overlooked config change

Written July 2026. Pricing is high-frequency information — always reference official sources.