LLM API Pricing: Your True Monthly Bill
In this article
LLM API pricing is rarely just the per-token rate on a vendor's page; your true monthly bill is shaped by input and output token volumes, caching, batch discounts, and the hidden costs of testing, retries, and rate-limit overprovisioning. This field guide walks through the real cost drivers so you can estimate your actual spend before the invoice arrives.
in tokens_per_month | Input tokens per month | millions | 10 | 0 in out_ratio | Output/input token ratio | - | 0.3 | 0 in price_in | Input price per 1M tokens | USD | 3 | 0 in price_out | Output price per 1M tokens | USD | 15 | 0 out total_cost | Estimated monthly cost | USD | (tokens_per_month * price_in) + (tokens_per_month * out_ratio * price_out) | 2 out total_tokens | Total tokens processed | millions | tokens_per_month * (1 + out_ratio) | 2
Formula
The basic monthly cost is the sum of input and output token costs:
Total cost = (Input tokens × Input price per token) + (Output tokens × Output price per token)
Where:
- Input tokens – the number of tokens you send to the model (prompt, context, instructions).
- Output tokens – the number of tokens the model returns (completions, answers).
- Input price per token – the vendor's rate for processing your input, usually quoted per 1M tokens.
- Output price per token – the vendor's rate for generating output, usually higher than input.
Worked Example
Using the calculator defaults: you send 10 million input tokens per month, the output/input ratio is 0.3 (so 3 million output tokens), input costs $3 per 1M tokens, and output costs $15 per 1M tokens.
- Input cost: 10 × $3 = $30
- Output cost: 3 × $15 = $45
- Total: $30 + $45 = $75 per month
The calculator shows $75.00, matching the manual calculation.
Why Your Bill Is Higher Than the Token Math
The above formula is the foundation, but real bills include several multipliers:
- Context caching – if you repeatedly send the same system prompt or documents, some vendors offer cheaper cached input tokens, but if you don't enable caching, you pay full price every time.
- Batch processing – asynchronous batch APIs are often 50% cheaper, but you must design your application to handle delayed responses.
- Retries and failures – network issues or rate limits cause you to resend requests, doubling token usage.
- Overprovisioning – to avoid rate limits, developers often request more tokens than needed, paying for unused capacity.
- Output token overage – models sometimes generate more tokens than expected, especially with long-form tasks.
How to Estimate Your Token Volume
Before you can estimate cost, you need to know your token usage. Here’s a practical method:
- Measure a sample – track tokens for a few hundred real requests using the vendor's usage endpoint or logging.
- Calculate averages – average input tokens per request and average output tokens per request.
- Multiply by volume – multiply by your expected monthly request count.
- Add overhead – add 10-20% for retries, testing, and prompt drift.
For example, if each request uses 2,000 input tokens and 600 output tokens, and you have 500,000 requests per month, that's 1 billion input tokens and 300 million output tokens. At $3/$15 per 1M, that's $3,000 + $4,500 = $7,500.
Comparing Pricing Models Across Providers
Different providers structure pricing in ways that can dramatically change your bill:
- Pay-as-you-go – simple per-token pricing, but costs scale linearly.
- Provisioned throughput – you reserve a fixed capacity for a monthly fee, which can be cheaper for steady, high-volume workloads.
- Batch discounts – lower rates for non-urgent tasks, but you must wait for results.
- Free tiers – limited monthly tokens, useful for prototyping but not production.
When comparing, always calculate cost per 1M tokens for your specific mix of input and output, not just the headline rate. A provider with higher input price but lower output price may be cheaper for your use case.
Common Mistakes That Inflate Your Bill
- Ignoring tokenization – a word isn't always one token; code and special characters can double token counts.
- Not using caching – if your prompts are static, enable caching to cut input costs by up to 90%.
- Overly long system prompts – every token in the prompt is charged on every request, so trimming unnecessary instructions saves money.
- Setting max_tokens too high – you pay for generated tokens even if the model stops early, but some vendors only charge for actual output; know your provider's policy.
- Forgetting about fine-tuning – fine-tuned models often have higher per-token rates than base models.
How to Reduce Your Monthly Bill
Practical cost-saving strategies that don't require changing providers:
- Use smaller models – for simple tasks, a smaller model may be 10x cheaper and fast enough.
- Implement caching – cache responses for identical queries to avoid reprocessing.
- Batch non-urgent requests – use batch APIs for bulk processing.
- Compress prompts – shorten instructions, remove redundant context, and use token-efficient formatting.
- Monitor usage – set up alerts for unusual spikes.
Frequently Asked Questions
Why do output tokens cost more than input tokens?
Generating text is computationally heavier than reading it, because the model must predict each token sequentially, whereas input processing can be parallelized. Providers price accordingly to reflect the higher GPU usage.
How do I know how many tokens my prompt uses?
Most providers offer a tokenizer tool or API endpoint that counts tokens for a given text. You can also estimate by dividing the number of characters by 4, as a rough average for English text.
What is context caching and how does it save money?
Context caching stores a prefix of your prompt (like a system message) so that repeated requests with the same prefix don't need to be reprocessed. The cached portion is charged at a lower rate, often up to 90% cheaper than standard input.
Can I negotiate pricing for high volume?
Yes, many providers offer volume discounts or custom enterprise contracts if you commit to a certain monthly spend. It's worth contacting sales for workloads exceeding tens of millions of tokens per month.
Are there hidden fees beyond token costs?
Some providers charge for data storage of fine-tuning datasets, or for dedicated compute instances. Always read the pricing page for additional fees like per-request charges or minimum commitments.
How accurate is the calculator for my specific use case?
The calculator gives a baseline estimate using your token volume and prices. Your actual bill may vary due to caching, batch discounts, retries, and whether the provider charges for cached tokens. Use it as a starting point, then refine with real usage data.