Course contentsShow
← AI Engineering
Lesson 117 of 1,8863. API-First AI EngineeringFree lesson

Understanding API Pricing Models

Learn how LLM providers price API calls: per-token, per-request, and subscription models with their trade-offs.

Understanding API Pricing Models

What you'll learn: How LLM API providers charge you money — and which pricing model fits your use case.

The Three Main Pricing Models

When you call an LLM API, you're not paying a flat fee. Providers use different pricing structures, and understanding them helps you predict costs and choose the right service.

Per-Token Pricing

This is the most common model (OpenAI, Anthropic, Google). You pay based on tokens processed — both input (your prompt) and output (the model's response). Think of it like paying for electricity: the more you use, the more you pay.

  • Trade-off: Predictable per-request cost, but scales linearly with usage. A long conversation costs more than a short one.
  • Best for: Variable workloads where request sizes differ dramatically.

Per-Request Pricing

Some providers charge a flat rate per API call, regardless of token count. It's like buying stamps — one price per message, no matter how long your letter is.

  • Trade-off: Simple budgeting, but wasteful if you send short prompts and expensive if the provider sets the price assuming long requests.
  • Best for: Predictable, uniform request patterns.

Subscription Models

Pay a monthly fee for a quota of tokens or requests (common with Azure OpenAI Enterprise tiers). Like a gym membership — unlimited access within your tier.

  • Trade-off: Cost-effective at scale, but you pay even during low-usage periods. Risk of overages.
  • Best for: High-volume production applications with steady traffic.

Comparing Costs

The same task might cost differently across models. A per-token model with cheaper tokens could beat a per-request model if your prompts are short. Always calculate cost per task, not just cost per unit.

Key Takeaway: Per-token pricing scales with usage, per-request offers simplicity, and subscriptions favor high volume — choose based on your traffic patterns and budget predictability needs.