LLM API Cost Calculator

What a month of calls actually costs, including the parts people forget.

in out
in out
%
% cheaper
—

The formulas

Output tokens usually dominate

Output is priced several times higher than input because generation costs far more compute than reading. A chatbot with a 1,500-token prompt and a 500-token answer looks input-heavy, but at typical rates of 3 dollars per million input and 15 per million output, the input costs 0.0045 dollars per call while the output costs 0.0075 — the answer is more expensive than the question despite being a third the size. Optimisation efforts aimed only at shortening prompts miss the larger line item. Capping max_tokens is often the single cheapest change available.

Where production costs actually come from

Prompt caching changes the maths

Most major providers discount repeated prompt prefixes heavily — often 50% to 90% — when the same prefix is sent within a short window. That makes the structure of your prompt a cost decision, not just a quality one: put the stable part (system instructions, few-shot examples, reference material) first and the variable part (the user's actual question) last, so the stable prefix can be reused across requests. Done well, caching cuts input cost dramatically on high-volume workloads. Done badly — variable content at the front — you pay full price every time.

Comparing models fairly

The cheaper model is not always cheaper per task. A model that costs five times more per token but needs one attempt instead of three retries can win outright, and a weaker model that requires more post-processing shifts cost elsewhere. Measure cost per successful outcome, not cost per token. Consider also whether the cheaper model handles your longest prompts — a small context window forces chunking, which adds complexity and may erase the saving. Use the token counter to size real prompts, and the context window calculator to check they fit.

Reading the numbers

Prices change frequently and vary by provider, region and committed-use discounts, so treat the rates you enter as the source of truth rather than any default shown here. Volume commitments and batch APIs typically offer substantial discounts for work that does not need to be synchronous — if half your traffic is offline processing, batch pricing can halve that portion of the bill at no quality cost.