The formula
monthly cost =
(input tokens ÷ 1,000,000 × input price)
+
(output tokens ÷ 1,000,000 × output price)
Providers usually quote input and output separately in USD per one million tokens. Preserve that separation: output often has a different unit price, and the input side may have cache or context-tier rules.
Worked example
Assume 10M input tokens and 2M output tokens per month on DeepSeek V4 Flash. Its published cache-miss input price is $0.14/M and output price is $0.28/M.
input = 10 × $0.14 = $1.40
output = 2 × $0.28 = $0.56
total = $1.96 / month
Estimate volume from requests
For a new application, start with request counts rather than an arbitrary monthly token figure:
monthly input tokens =
active users
× requests per user per month
× average input tokens per request
Calculate output the same way with average generated tokens. Measure a small prototype run as soon as possible; estimates based on actual payloads are more useful than generic “tokens per page” rules.
Correct for cache hits
If a provider bills cached input at a separate price, split input into cache hits and cache misses.
input cost =
cache-miss tokens × cache-miss price
+
cache-hit tokens × cache-hit price
At a measured 50% hit rate, 10M input tokens on DeepSeek V4 Flash would cost approximately:
5 × $0.14 = $0.700
5 × $0.0028 = $0.014
input total = $0.714
Do not assume a 50% cache rate because prompts look similar. Prefix changes, tool definitions, timestamps, and message ordering can prevent a hit.
Check context tiers per request
Some Alibaba Cloud models use tiered pricing based on the number of input tokens in a single request. A request crossing 256K can move all tokens in that request into a higher price tier. Apply the tier to each request distribution, not to the monthly total.
Add operational overhead
The clean formula is only the start. Add expected cost for:
- retries after timeouts, rate limits, or failed tool calls;
- fallback calls to a more expensive model;
- evaluation, staging, and internal testing traffic;
- background summarization or embedding jobs;
- growth between the planning date and the invoice date.
Use three scenarios
| Scenario | Volume assumption | Use |
|---|---|---|
| Low | Measured pilot volume | Minimum expected bill |
| Base | Expected users and requests | Operating budget |
| High | Base case + retries + growth | Spend alert and funding limit |
For an early product, a 20% buffer over the base estimate is a reasonable starting rule. Replace it with your actual variance after the first billing cycle.
Run your own numbers
The LLM Price Scout calculator applies the base formula to every model in the verified index. Use it for the shortlist, then add cache behavior, context tiers, retries, and your operational buffer in a spreadsheet or budget alert.
Calculate Compare the verified model index →