How to calculate LLM API cost
Separate input and output token costs, calculate one request, then multiply by your expected request volume. Keep provider-specific pricing as an input because it changes.
The core formula
For example, suppose a workload averages 2,000 input tokens and 500 output tokens. If the published rates you are evaluating are $1 per million input tokens and $5 per million output tokens, the estimated request cost is $0.0045.
Project a monthly budget
At 10,000 requests per month in the example above, the simple projection is $45. That is a planning number, not a guarantee of your final invoice.
What can make the real bill different?
Providers can offer different prices for cached input, batch processing, or other meter types. A request may also include multiple model calls, tool calls, or multimodal inputs. Treat the simple formula as the base layer and add explicit line items for anything else your provider bills.
Build three scenarios
A useful planning habit is to create low, expected, and high cases. Change token counts, request volume, and pricing assumptions independently. The point is to identify the variable that has the biggest effect on spend so you know where optimization work matters.
Use the calculator
Our LLM API Cost Calculator keeps rates editable, which prevents the site from baking a stale price list into the core math.
FAQ
Can I use one blended price per million tokens?
You can, but it hides the input/output mix. For decision-making, separate rates are more informative.
Does API price equal total AI system cost?
No. Total system cost can include hosting, vector storage, databases, observability, networking, and human review. API token cost is one layer.