Comparing LLM API Prices Across Channels: A Practical Cost Accounting Guide
The same model can be priced very differently across official, cloud-hosted, and reseller APIs. This guide shows how to normalize quotes, turn list prices into effective unit costs and total cost of ownership, and then use routing, caching, and a gateway to cut the real bill.
1. Introduction: One Model, Many Prices
When a team adds a large language model to a product, the first choice is often “whichever API is easiest to call.” Cost reviews then reveal a less obvious fact: the same model can be several times more expensive on one channel than on another. The official channel is not always the most expensive, and a third-party channel is not always the cheapest.
Channels generally fall into three groups:
- Direct access from the model vendor
- A cloud provider’s model service, usually hosted by that provider with unified billing, networking, and compliance controls
- An aggregation platform that resells several vendors’ models behind one API
More channels make intuition less reliable. A model with the same name may be a different version, served from a different region, or billed under different rules. Choosing by gut feel is an easy way to pick the wrong option.
This article replaces the single question “which list price is lowest?” with a three-step analysis:
- Normalize the basis of comparison so quotes that cannot be compared become comparable.
- Convert list prices into an effective unit price, then put total cost of ownership on the ledger.
- Use fine-grained routing and caching in the application architecture so model choice serves the real bill.
Prices in the tables below are illustrative only. They demonstrate the method and do not represent any platform’s actual rates.
2. Where Price Gaps Come From: Five Dimensions
2.1 Reseller markup
A reseller does not simply copy a vendor price. It maintains adapters for multiple vendors, a billing system, and an account system, and it may add paid services. Those costs show up in the unit price. A reseller quote can be higher than direct vendor access, or lower because of volume purchasing or regional pricing. Do not assume that a relay is always a bit more expensive, or that a third party is always cheaper.
2.2 Currency and region
The same model may be listed in different currencies on different regional sites, and those listings can map to different resource regions and pricing policies. A USD list price, once converted, can land almost exactly on the local-currency list price. Comparing the raw numbers then treats an exchange-rate difference as a channel advantage. Rates move, so conversions should use a fixed benchmark rate and a stated conversion date, both recorded in the report.
2.3 Incomplete billing dimensions
A pricing page usually shows only input and output prices. The invoice often includes more:
- A cache-hit price
- Long-context tiered pricing, where the unit price rises after input exceeds a length threshold
- Discounted prices for batch or asynchronous jobs
- Free quotas and volume discounts
Comparing only the two headline numbers compares only part of the bill.
2.4 Version mismatch
Versions of the same model can differ sharply in capability, price, and context length. Lightweight, coding-specialized, and flagship variants should not be treated as interchangeable. If a channel lists only the previous generation, mark the current version as “not listed.” Do not fill the gap with a neighboring version. A version mismatch is more dangerous than a slightly higher price: it invalidates load-test results, quality evaluations, and cost estimates together.
2.5 Price freshness
Model prices change often. A channel that is cheap today may not be cheap next month. Every comparison needs a collection date and a data source. The conclusion has an expiry date and should not be cited as a lasting fact.
3. Step 1: Use One Basis of Comparison
3.1 Define a standard request
Comparison starts with a standard request. Fix at least these four items:
- Model name and exact version
- Input and output token counts for one request, taken from real traffic percentiles such as P50 or P90
- Exchange-rate benchmark and conversion date
- Whether the billing unit is unified, for example “per million tokens”
With a standard request, each channel’s price sits on the same ruler.
3.2 Why the input/output mix matters
For token-priced models, the output unit price is often several times the input unit price. The real cost of one request is therefore sensitive to the input/output mix. A 30% input / 70% output mix is common in long-context understanding and code generation: the long input still drives a large share of cost, but the expensive output tokens dominate the weighted price.
The weighted unit price is:
P_weighted = w_in × P_in + w_out × P_out
Here w_in and w_out are the shares of input and output tokens. Apply the same weights and currency to every channel, then substitute each channel’s raw unit prices.
3.3 The mix can reverse the ranking
Consider two candidate channels (illustrative figures):
| Candidate | Input price | Output price |
|---|---|---|
| A | 2.0 CNY / million tokens | 6.0 CNY / million tokens |
| B | 1.0 CNY / million tokens | 8.0 CNY / million tokens |
- At 30% input / 70% output, A costs 4.80 and B costs 5.90, so A is cheaper.
- At 95% input / 5% output, A costs 2.20 and B costs 1.35, so the ranking flips and B is cheaper.
Before comparing channels, measure the real mix from application logs. If logs are not available yet, calculate both a worst case (a high output share) and a typical case, and check whether the conclusion holds.
4. Step 2: Turn List Prices into an Effective Unit Price
4.1 From weighted price to cost per request
Substitute real request sizes to convert unit prices into a cost per request, then estimate a monthly bill from daily volume:
cost per request = (in_tokens × P_in + out_tokens × P_out) / 1,000,000monthly cost ≈ cost per request × daily requests × 30
4.2 The real discount from caching
Mainstream model services generally support context caching, also called prompt caching. While processing input, the service computes an internal representation of the context. If later requests share the same prefix—system instructions, tool descriptions, project rules, or a fixed document—the service can reuse that work and bill cache-hit input tokens well below the standard input price.
The savings depend on how much of the input is cacheable:
cacheable share = stable prefix length / total input length
A 2,000-token system prompt on a 4,000-token input can hit the cache for at most half of the input. If the prompt and retrieved context change on every request, caching does almost nothing. Treat cache hit rate as a tunable parameter and use it for sensitivity analysis.
4.3 Illustrative comparison
The table below uses illustrative prices in CNY per million tokens. Channel A’s CNY prices and channel B’s USD prices match exactly after the example exchange rate. “×N” means that channel’s weighted price divided by channel A’s.
| Channel | Input | Output | Cache-hit | Weighted price | Multiple |
|---|---|---|---|---|---|
| A (vendor direct) | ¥1.0 | ¥6.0 | ¥0.2 | ¥4.50 | 1.00× |
| B (USD list, example rate 7.2) | $0.14 (≈¥1.0) | $0.83 (≈¥6.0) | $0.028 (≈¥0.2) | ¥4.50 | 1.00× |
| C (aggregator reseller) | ¥0.8 | ¥4.8 | not published | ¥3.60 | 0.80× |
| D (hosted reseller) | ¥3.6 | ¥24.0 | ¥0.8 | ¥17.88 | 3.97× |
Notes: multiple = channel weighted price ÷ channel A weighted price. The example rate is 1 USD ≈ 7.2 CNY.
Suppose candidate E publishes only an input price of ¥0.35 per million tokens and no cache-hit price. On input price alone, E looks 65% cheaper than A. Even if E’s output price merely matches A, its weighted price is ¥5.25, about 17% higher than A. With output at 70% of tokens, a cheap input price cannot offset a high output price.
A safer sequence is sensitivity analysis first, then a decision to enable a channel. The sample below does not depend on any specific platform API:
# Illustrative multi-channel weighted cost comparison.# All prices are examples, in CNY per million tokens.RATES = {"in": 1.0, "out": 6.0, "cache": 0.2} # unit prices after a shared FX baselineWEIGHT_IN = 0.30 # input token shareWEIGHT_OUT = 0.70 # output token share# Quotes: input / output / cache are prices per million tokens; None means unpublishedOFFERS = {"A": {"input": 1.0, "output": 6.0, "cache": 0.2},"C": {"input": 0.8, "output": 4.8, "cache": None},"D": {"input": 3.6, "output": 24.0, "cache": 0.8},"E": {"input": 0.35, "output": None, "cache": None},}# Size of one standard requestIN_TOKENS, OUT_TOKENS, MILLION = 4000, 2000, 1_000_000CACHEABLE_RATIO = 0.5 # stable prefix length / total input lengthALREADY_CACHED_RATIO = 0.2 # share of the prefix already cached server-sidedef request_cost(offer, hit_rate=0.0):"""Return cost of one request in CNY.If the output price is missing, treat the offer as not comparable."""if offer["output"] is None:return Nonehit_tokens = IN_TOKENS * CACHEABLE_RATIO * hit_ratemiss_tokens = IN_TOKENS - hit_tokenscache_price = offer["cache"] if offer["cache"] is not None else RATES["cache"]return (miss_tokens * offer["input"] + hit_tokens * cache_price+ OUT_TOKENS * offer["output"]) / MILLIONbase = request_cost(OFFERS["A"])for name, offer in OFFERS.items():cost = request_cost(offer, hit_rate=ALREADY_CACHED_RATIO)if cost is None:print(f"{name}: required field missing; excluded from comparison")continueprint(f"{name}: {cost:.6f} CNY per request, {cost / base:.2f}x vs channel A")print("--- Sensitivity: how cache hit rate changes the ranking ---")for rate in (0.0, 0.3, 0.6, 0.9):ranked = sorted((request_cost(o, rate), k)for k, o in OFFERS.items()if request_cost(o, rate) is not None)print(f"hit rate {rate:.0%}: " + " < ".join(f"{k}({c:.4f})" for c, k in ranked))
Three points in this code matter:
- Missing output price: do not substitute a neighboring version. Mark the offer as not comparable.
- Unpublished cache-hit price: the script falls back to the baseline cache price, which is a conservative estimate.
- Sensitivity analysis: the ranking can change with hit rate. Below some hit rate, a “cheap” channel may no longer win.
For large spend, also check tiered pricing, batch discounts, and promotional credits. Those change the effective unit price and belong in the comparison.
5. Step 3: Account for the Total, Not the Unit Price
The effective unit price is only the first page of the ledger. Several hidden costs are easy to skip.
1. Amplification from failed retries.
Timeouts, rate limits, and content-moderation blocks raise cost linearly with retries if every failure is simply retried. A cost multiplier captures that:
C_actual ≈ C_single × (1 + failure rate × average retries)
A 3% failure rate with one retry on average raises cost by about 3%.
2. Context inflation.
Long-context models make it tempting to stop trimming retrieved text and chat history. Doubling input tokens doubles that part of the bill.
3. Migration cost.
Channels differ in invocation style, streaming format, and tool-calling conventions. If application code is coupled to one channel, switching or adding a fallback becomes a large rewrite.
4. Reliability and compliance cost.
Availability targets, data residency, and audit requirements decide which channels can even be candidates. Filter those constraints before comparing prices, not after.
Folding these in, total cost of ownership can be sketched as:
TCO ≈ call cost + retry cost + operations cost + migration cost + compliance cost
The goal is not the channel with the lowest unit price. It is the combination with the lowest total. That combination may be one channel, or a primary-plus-fallback architecture.
6. After the Comparison: Lower Unit Cost at the Source
Choosing the right channel helps. Sustained bill reduction usually comes from how the model is called. The six practices below can be applied before channel selection.
6.1 Tiered model routing
Not every request needs the flagship model. Rules or a small model can handle part of the traffic, with the large model reserved for hard cases:
# Illustrative routing by task complexitydef route(task):if task.rule_resolvable:return rule_engine # rules or templates; zero token costif task.estimated_difficulty == "low":return light_model # smaller modelreturn flagship_model # flagship as the fallback
Pair the policy with offline evaluation so quality loss stays acceptable. Track a downgrade rate so drift in the policy is visible.
6.2 Structured prompts that cache well
Put stable content—system instructions, tool descriptions, project rules—at the front of the prompt, and put what changes each request—user input, retrieval results—at the end. The server can reuse the prefix, and a small edit does not invalidate the whole prefix.
6.3 Context control
Rolling-summarize chat history, rerank and truncate retrieval results, and deduplicate file content that is read repeatedly. Context length is a direct multiplier on cost.
6.4 Output control
Set an explicit maximum output length, prefer structured output, and cut explanatory text that the caller does not use. Output tokens are priced in the open.
6.5 Batch and asynchronous jobs
Offline work such as bulk summarization, offline labeling, and log analysis can often use a lower asynchronous or batch rate when the channel offers one. Latency is higher, so this belongs on non-real-time paths.
6.6 An abstraction layer and observability
Put a single model gateway between the application and the channels. Centralize auth, retries, timeouts, rate limits, and usage accounting:
# Illustrative unified gatewayclass ModelGateway:def __init__(self, routes, retry=2, timeout=30):self.routes = routes # primary and fallback channels by task typeself.retry = retryself.timeout = timeoutdef complete(self, req):for channel in self.routes[req.task_type]:try:resp = channel.call(req, timeout=self.timeout)# Shared usage event for cost accounting and budget alertslog_usage(req.tenant_id, req.model, resp.usage)return respexcept (TimeoutError, RateLimitError):continue # fail over on timeout or rate limitraise RuntimeError("all channels failed")
The abstraction does three things:
- Channel changes are configuration changes, not application rewrites.
- Usage is collected once, so cost can be attributed to a product, tenant, or project.
- A primary outage fails over to a backup, spreading availability risk across suppliers.
Write usage to a logging service and alert on it, then account cost by product line and set budget thresholds. Failover can change answer style or quality, so critical paths need a quality regression check.
7. A Price-Comparison Report Template
Turn the method into a reusable template. After a price change, update the data:
- Conclusion first: recommended channel mix, expected monthly cost, and the change versus the current setup.
- Basis of comparison: model version, input and output token counts, weights, exchange rate, collection date, and data sources.
- Comparison table: input, output, and cache prices, weighted unit price, cost per request, and notes on missing fields.
- Sensitivity analysis: how cache hit rate, failure rate, and daily volume move the conclusion.
- Hidden costs: migration, operations, compliance, and retries.
- Architecture savings: expected savings from routing, caching, and context control.
- Review plan: the next comparison date and triggers such as an official price change, a new model version, or a shift in traffic.
8. Closing
“Direct vendor access is not always the most expensive, and a third party is not always the cheapest” is not a contradiction. Price gaps come from currency, region, version, cache policy, and reseller structure. Only a shared basis of comparison shows the real gap.
The method reduces to three rules:
- Compute the effective unit price first, then total cost of ownership.
- Mark missing fields as not comparable rather than substituting a neighboring version.
- Treat selection as ongoing engineering: an abstraction layer and usage telemetry keep switching cost low.
Cloud providers may offer hosted model services alongside specialist model vendors. Where a provider such as Baidu AI Cloud is relevant to the deployment, confirm capabilities and billing rules in the official documentation rather than assuming they match another region. Turn this method into an internal script or dashboard and rerun it after every price change, so “value for money” rests on reproducible data rather than a one-time impression.
