LLM API Cost Comparison: Look Beyond Per-Token Pricing
LLM API costs depend on request timing, input-length tiers, output usage, and cache hits—not just headline token prices. This article presents a reusable cost formula, compares three illustrative pricing structures, and shows how peak-hour pricing affects a customer support workload.
Choosing an LLM API by its per-token price alone can produce a misleading cost estimate, even when the models offer similar capabilities. Actual bills depend on pricing schedules, input length, and cache hits as well as base rates.
Before comparing providers, answer three questions:
- When do most requests occur?
- Which input-length tier does a typical request fall into?
- How much input content is repeated across requests?
The framework below separates these pricing variables using illustrative model rates and a customer support example. All token volumes are workload assumptions, not measured data. The calculations compare billing mechanics only; they do not indicate generation quality or task completion rates.
1. Establish a Consistent Basis for Comparison
The three models use different billing structures, so the comparison needs a common set of assumptions:
- All three models are billed in thinking mode. Output tokens include both the final response and reasoning content. Check the official documentation to confirm whether thinking is enabled by default and whether reasoning tokens count toward billed output.
- All requests are synchronous. Uncached input is billed as fresh input. The calculations exclude discounts, batch APIs, and free credits.
- No additional tools are used. Web search, OCR, and other tool charges are excluded. Each task involves one request, with no retries or human labor costs included.
- All prices use relative units, not currency amounts. Model A’s off-peak input rate is set to 1 and its output rate to 2. Model B and Model C use illustrative pricing parameters. Replace these with official rates when estimating actual costs.
The daily cost formula is:
Daily cost = Requests per day × [Average input tokens × (Cache hit rate × Cache read rate+ (1 − Cache hit rate) × Fresh input rate)+ Average output tokens × Output rate]
When the cache hit rate is zero, this reduces to a basic input-and-output cost calculation. Input and output rates depend on the applicable time window and input-length tier. The cache read rate applies only to input tokens that hit the prefix cache.
2. Compare the Three Pricing Structures
Model A: Time-Based Pricing
The pricing schedule used here defines peak hours as 09:00–12:00 and 14:00–18:00 on weekdays, Beijing time (UTC+8). All other periods are off-peak.
The peak output rate is approximately twice the off-peak rate. This example assumes that the input rate stays the same during both periods; that assumption must be checked against the official pricing page.
Model A’s maximum context length and any surcharges for exceptionally long inputs also require separate verification.
Model B: Input-Length Tiers
Model B does not vary its rates by time of day. Instead, it uses the total input length of each request to determine the pricing tier:
- Up to 128K tokens: Lower-tier pricing applies.
- More than 128K and up to 256K tokens: Rates rise to approximately three times the lower-tier level.
The tier applies to the entire request. Once the input exceeds the threshold, the whole request is billed at the higher tier—not just the tokens above the threshold.
This comparison assumes that both input and output rates increase at the higher tier. That detail also needs verification in the official documentation.
Model C: Higher Base Rates with Prefix Caching
Model C has higher listed rates but supports prefix caching. Reading cached input costs substantially less than processing fresh input.
The illustrative rates are:
- Fresh input: 1.5
- Cache reads: 0.15
- Output: 3
The caching advantage matters only when a substantial share of the input is repeated.
Pricing Structure Summary
| Model | Main pricing mechanism | Details to verify |
|---|---|---|
| Model A | Time-based pricing; peak output rates are approximately double off-peak rates | Whether input rates change at peak times, context limits, long-input surcharges, and caching rules |
| Model B | No time-based variation; crossing 128K input tokens raises the pricing tier for the entire request | Whether both input and output rates increase, and applicable caching rules |
| Model C | Prefix caching substantially reduces the cost of cached input, while fresh input has a higher base rate | Applicable official rates and caching terms |
No input-length pricing step is identified for Model A in the rules described here, but its long-context pricing still needs confirmation.
3. Scenario One: Estimating Peak and Off-Peak Customer Support Costs
Customer support responses typically involve short inputs, moderate-length outputs, and high request volumes concentrated during working hours.
Assume the following daily workload:
- Requests: 10,000
- Average input: 800 tokens per request
- Average output: 350 tokens per request
- Peak-hour share: 70% of requests
Using Model A’s illustrative rates, the cost per request is:
Off-peak:
800 × 1 + 350 × 2 = 1,500
Peak:
800 × 1 + 350 × 4 = 2,200
With 70% of requests occurring during peak hours, the weighted average cost per request is:
0.7 × 2,200 + 0.3 × 1,500 = 1,990
All results are expressed in the relative pricing units defined above.
