AI Calculator Pro

LLM Pricing Explained: How AI API Costs Actually Work

Large language models are billed by the token, but the details — input vs output rates, caching, batch discounts and hidden reasoning tokens — decide whether your bill is small or shocking. This guide explains how LLM pricing actually works and how to estimate your own cost.

Tokens are the unit of billing

Providers charge per token, not per word or request. A token is roughly ¾ of a word for English prose, but code, JSON and non-English text tokenize very differently. Because everything is priced per token, an accurate token count is the foundation of every cost estimate — guessing from character or word counts is where most budgets go wrong.

Input and output are priced differently

Almost every model charges more for output (generated) tokens than for input (prompt) tokens — often several times more. That means the length of the model's answer usually matters more than the length of your prompt. Workloads that generate long content are output-bound; chatbots that resend history are input-bound. Knowing which you are tells you which lever to pull.

Caching and batch discounts

If you send the same large context repeatedly — a system prompt, a knowledge block, code files — prompt caching bills that repeated portion at a fraction of the normal input rate. For offline, latency-tolerant work, batch APIs typically halve the token price in exchange for delayed results. Both can dramatically cut real-world bills.

Hidden costs: reasoning tokens and context

Reasoning models generate large amounts of internal 'thinking' that is billed as output, so their real per-task cost far exceeds the visible answer. And a big context window is only free if you don't fill it — you pay for every token you send, so stuffing a 200k window is a large input bill on every call.

Calculators for this topic

Worked examples

Frequently asked questions

How do I estimate my LLM bill?+

Count input and output tokens per request, apply the model's per-token rates, and multiply by your request volume — exactly what our LLM API cost calculator does.

Why is output more expensive than input?+

Generating tokens is more compute-intensive than reading them, so providers price output higher — often several times the input rate.