How to Choose a Cost-Effective LLM API: A Billing and Pricing Guide

    This guide explains why two LLM API channels with similar listed prices can produce very different bills. It breaks down billing items, cache-hit pricing, subscription payback thresholds, effective discounts, off-peak pricing, and common cost amplifiers such as reasoning output, repeated context, and multimodal inputs. It also includes scenario-based calculations, a procurement checklist, and engineering optimization practices to help teams reduce API costs.

    How to Choose a Cost-Effective LLM API: A Billing and Pricing Guide

    Introduction: Why similar list prices can lead to different bills

    When procuring LLM API access, developers often see the same model priced similarly across channels, yet monthly bills can differ significantly. The difference is usually not just about unit price. It often comes from three overlapping factors: vendor price coefficients, channel billing models, and application call patterns.

    A list price is only the starting point. The actual cost depends on:

    • How input, cache-hit reads, and output are billed;
    • Whether subscriptions, batch pricing, off-peak discounts, or limited-time promotions are used;
    • Whether the application repeatedly sends long context, generates large amounts of reasoning content, or uploads multimodal assets;
    • Whether LLM API prices, cost estimates, and billing methods across channels are directly comparable.

    All prices, discounts, and package amounts in this article are illustrative CNY list prices used only to demonstrate the calculation method. Before purchasing, confirm the latest billing details from the target channel, including taxes, exchange rates, invoicing, and settlement terms.

    1. Start with a consistent billing definition: what are you paying for in one request?

    1.1 Breakdown of billing items

    Most mainstream LLM APIs are billed by token. The cost of a single call can be broken down as follows:

    Billing item Billing method Engineering focus
    Uncached input tokens Metered by usage; usually the main input cost Redundant prompts and resending full conversation history
    Cache-hit reads Usually priced significantly lower than normal input Hit rate depends on how stable the prefix is
    Cache writes or storage Some channels may offer limited-time free periods Recalculate after the free period ends
    Output tokens Usually the highest unit price Output length, reasoning length, retry strategy
    Multimodal inputs Converted to tokens by resolution, duration, page count, etc. Resolution, sampled frame rate, document parsing volume

    A cache hit can be understood as follows: fixed prefixes such as system prompts, tool definitions, long documents, and knowledge-base snippets match the cached content exactly. When read, they are billed at a lower unit price. The estimation formula is:

    1. Cache hit rate = cached input tokens read ÷ total input tokens
    2. Total input tokens = uncached input tokens + cached input tokens read

    It is recommended to use a rolling 7-day bill to calculate a weighted hit rate and avoid misinterpretation caused by daily fluctuations.

    1.2 Check whether failed requests are billed

    Before purchasing, confirm whether failed requests are billed, especially for the following cases:

    • Generation failures, parameter errors, or rate-limit rejections: whether they are billed should be confirmed on the channel’s billing page;
    • Content moderation blocks: may be free, or may still charge input fees;
    • Request timeouts: may charge for the portion already generated;
    • Successful but truncated output: usually billed according to the actual output.

    If the billing page is unclear, test with small requests and retain request IDs, billing details, and logs to avoid disputes during month-end reconciliation.

    1.3 Four key cost variables

    1. Model tier: Within the same model family, lightweight, mid-tier, and flagship tiers may be priced in steps, and the difference between flagship and lightweight models can be substantial.
    2. Context length: The longer the context, the higher the input cost per request.
    3. Input-output ratio: Output unit price is usually several times the input price, so output-heavy applications are more sensitive.
    4. Cache hit rate: Whether fixed prefixes can reliably hit the cache directly affects input costs.

    1.4 Three commonly underestimated cost multipliers

    ① Reasoning content may be counted as output

    Some reasoning models return the full reasoning process, and some interfaces do not allow it to be disabled. Reasoning content is usually billed as output, so the actual output volume can be much larger than the final answer.

    Engineering recommendation: When estimating, reserve 2 to 3 times the answer length as output volume. For tasks such as classification, format conversion, and simple extraction, consider using a lightweight model, or choose models and parameters that allow control over reasoning length.

    ② Repeated context can amplify costs

    Whether multi-turn dialogue becomes expensive depends on how history is sent:

    • If each turn adds a fixed-length message and every turn includes all previous history, input volume grows approximately quadratically.
    • If a fixed document is resent in every turn but history is not accumulated, input volume grows linearly with the number of turns.

    Example: If each turn adds 10,000 tokens and the system resends all history each turn, the cumulative input over 10 turns is approximately:

    1. 10,000 × 10 × (10 + 1) ÷ 2 = 550,000 tokens

    If a 10,000-token fixed document is queried 10 times without accumulating history, the cumulative input is:

    1. 10,000 × 10 = 100,000 tokens

    Therefore, before optimizing, distinguish whether the workload is “accumulating history” or “repeatedly sending a fixed document.”

    1. def estimate_cumulative_input(new_tokens_per_round: int, rounds: int) -> int:
    2. """Estimate cumulative input when each round adds a fixed number of new tokens and includes all previous history."""
    3. return new_tokens_per_round * rounds * (rounds + 1) // 2
    4. def estimate_fixed_doc_input(doc_tokens: int, rounds: int) -> int:
    5. """Estimate cumulative input when a fixed document is resent every round without accumulating history."""
    6. return doc_tokens * rounds
    7. print(estimate_cumulative_input(10000, 10)) # 550000
    8. print(estimate_fixed_doc_input(10000, 10)) # 100000

    ③ Hidden cost amplification from multimodal inputs

    Images, videos, and files are usually converted into tokens:

    • Images are billed by resolution or scaling tier;
    • Videos are billed by sampled frames or duration;
    • Files are billed based on parsed text volume.

    Uploading a high-definition video may be equivalent to hundreds of thousands or even millions of input tokens. Multimodal applications must perform preprocessing in advance.

    1.5 A general cost model

    1. Monthly cost =
    2. uncached input total × input unit price
    3. + cached input total × cache-hit unit price
    4. + output total × output unit price
    5. + cache storage fees
    6. + other fees, such as failed-request retries and file parsing

    If a channel offers discounts, multiply the formula above by the effective discount. If the channel does not clearly state whether limited-time discounts, volume discounts, and subscription discounts can be combined, it is safer to assume only one discount applies when modeling.

    2. What billing methods should be compared when choosing a channel?

    The conclusion first: do not compare channels only by list price. Prioritize comparing whether billing definitions are consistent, whether discounts are sustainable, and whether the billing model fits the current call structure.

    Channel type Typical billing model Advantages Watch-outs
    Official model provider platform List price, phased discounts, volume discounts Fast model availability, transparent rules Discounts may be time-limited
    Cloud marketplace or cloud-hosted service List pricing included in cloud budget Unified settlement, shorter network path Usage-based discounts may be limited
    API aggregation platform Subscription, credits, off-peak offers Unified access to multiple models Rate limits, stability, data retention
    Foreign-currency-priced channel Foreign-currency list pricing Access to overseas models Exchange rate, settlement, cross-border compliance
    Batch or asynchronous inference Discounted standard pricing Low cost for offline workloads Cannot return results in real time
    Private or dedicated deployment Billed by compute resources or instances Data stays within the environment Total cost of ownership includes instance fees, operations, power, migration, etc.

    Common pricing comparison blind spots

    1. Discounts cannot be assumed to stack: Determine whether limited-time discounts, volume discounts, and subscription discounts belong to the same discount system by checking the billing page.
    2. Limited-time discounts may not have a committed end date: Do not assume the low price will last indefinitely.
    3. Billing definitions may differ: Confirm in advance whether cache storage is charged, whether reasoning content is counted as output, how multimodal inputs are converted to tokens, and whether failed requests are billed.
    4. Private deployment is not just about call price: Also consider instance fees, operations, power, data migration, and scaling costs.

    Common pricing mistakes

    • Only looking at input unit price and ignoring output unit price;
    • Ignoring reasoning content returned by reasoning models;
    • Resending full history in every turn of long conversations;
    • Assuming discounts can be stacked;
    • Using promotional prices for long-term budgeting.

    3. How to convert subscription pricing: payback line and effective discount

    3.1 Credit conversion rules

    Some channels use a “subscription plan + credit deduction” model. To avoid unit confusion, it is recommended to convert everything into “CNY-equivalent value.”

    Example baseline:

    1. Credit baseline: 0.004 CNY-equivalent per 1,000 tokens
    2. Price coefficient = list unit price of the billing item ÷ credit baseline

    Note: The example baseline is only used to demonstrate conversion. The actual value of credits should come from the channel’s redemption rules, consumption rules, or settlement description, and should not be treated as a fixed fact.

    Each billing item should have its own price coefficient. For example, input, cache-hit, and output should be calculated separately instead of summing all tokens and applying one coefficient.

    1. BASE_PER_1K = 0.004 # Example baseline: CNY per 1K tokens
    2. def coefficient(price_per_1k: float) -> float:
    3. return price_per_1k / BASE_PER_1K
    4. def estimate_credits(
    5. plain_in: int,
    6. cache_hit: int,
    7. out: int,
    8. in_coef: float,
    9. hit_coef: float,
    10. out_coef: float,
    11. ) -> float:
    12. return (
    13. plain_in / 1000 * in_coef
    14. + cache_hit / 1000 * hit_coef
    15. + out / 1000 * out_coef
    16. )

    3.2 Package tiers and payback line

    Assume a subscription plan has three tiers:

    Package tier (illustrative) Corresponding discount Payback line, monthly list-price cost
    CNY 2,999 About 30% off About CNY 4,284
    CNY 4,999 About 40% off About CNY 8,332
    CNY 9,999 About 50% off About CNY 19,998

    Payback line formula:

    1. Payback line = package price ÷ discount rate

    When the monthly list-price cost is below the payback line, the subscription plan is usually not more economical than paying list price. When it is above the payback line, the plan may have an advantage over list pricing.

    However, the payback line only tells you whether a subscription is better than list pricing. It does not tell you whether it is better than a limited-time 50% discount, a batch 50% discount, or an off-peak discount. If a lower effective price exists, you must continue comparing actual payments.

    3.3 How to calculate effective discount with overage billing

    Assume:

    • Package price is P;
    • Package discount rate is d;
    • The list-price quota covered by the package is T = P ÷ d;
    • Total monthly list-price cost is L.

    If the overage is billed at list price, then:

    1. Actual payment = package price + overage list-price cost
    2. Effective discount = (package price + overage list-price cost) ÷ total list-price cost

    Where:

    1. Overage list-price cost = total list-price cost − list-price quota covered by the package

    If the overage is still billed at the discounted price, use another formula:

    1. Actual payment = package price + discount rate × overage list-price cost
    2. Effective discount = (package price + discount rate × overage list-price cost) ÷ total list-price cost

    These two methods cannot be mixed. Before purchasing, confirm whether the overage is billed at list price or discounted price.

    3.4 Equivalent calculation for off-peak discounts

    If a channel bills off-peak usage at 0.3 times the original price, and the proportion of usage that can be shifted to off-peak is r, then:

    1. Effective discount = (1 − r) + 0.3 × r = 1 − 0.7r

    Off-peak scheduling is only worthwhile when the effective discount is lower than the discount of the comparison option. For example, if the currently available discount is 0.5, then:

    1. 1 − 0.7r < 0.5

    Solving gives:

    1. r > 71.4%

    In other words, off-peak discounts only become meaningful if at least about 71.4% of calls can tolerate latency.

    4. Cost estimates for five typical scenarios: which billing method is cheaper?

    4.1 Assumptions

    Example model: an open-source model supporting million-token context and multimodal inputs. Illustrative list prices are CNY 0.8 for input, CNY 0.23 for cache-hit, and CNY 2.8 for output, per million tokens.

    Pricing notes:

    • The above prices are illustrative CNY list prices;
    • They do not include taxes, exchange rates, or invoicing factors;
    • The amounts in the table are usage-based costs and include the cache-hit unit price;
    • They do not include additional fees such as cache storage, failed-request retries, or file parsing;
    • Usage units in the table are uniformly million tokens;
    • Actual purchases should be based on the channel’s latest billing details.

    Available billing options:

    • Channel A: usage-based list pricing;
    • Channel B: limited-time 50% off, i.e. CNY 0.4 / 0.115 / 1.4;
    • Channel C: subscription model; for comparison, the CNY 9,999 tier is used in the example;
    • Channel D: batch inference at 50% of standard pricing, suitable for tasks that can be processed offline.

    Calculation formula:

    1. Amount =
    2. uncached input million tokens × 0.8
    3. + cached input million tokens × 0.23
    4. + output million tokens × 2.8

    4.2 Calculation results

    Scenario Monthly input, million tokens Cache hits Monthly output, million tokens A: list price usage-based B: limited-time 50% off C: subscription example, CNY 9,999 tier D: batch 50% off Better choice
    ① Light trial 200 120 30 175.6 87.8 Not applicable 87.8 B or D
    ② Small-scale production 2,000 1,200 300 1,756 878 Not applicable 878 B or D
    ③ Output-intensive 5,000 3,000 6,000 19,090 9,545 9,999 9,545 B or D
    ④ Offline batch processing 15,000 9,000 2,000 12,470 6,235 9,999 6,235 D
    ⑤ Multimodal analysis 30,000 18,000 1,000 16,540 8,270 9,999 8,270 B or D

    Note: In scenarios ③, ④, and ⑤, the CNY 9,999 tier can cover the monthly list-price cost, but the actual payment is still higher than the 50% off or batch 50% off price. Therefore, do not assume that a subscription is always cheaper just because the package can cover the usage.

    4.3 Overage cost example: subscription is not better than 50% off or batch pricing in this example

    For scenarios ③, ④, and ⑤, calculate the CNY 2,999, CNY 4,999, and CNY 9,999 tiers respectively. Assume the overage is billed at list price.

    List-price quota covered by the package:

    1. CNY 2,999 tier: 2,999 ÷ 0.7 ≈ 4,284 CNY
    2. CNY 4,999 tier: 4,999 ÷ 0.6 ≈ 8,332 CNY
    3. CNY 9,999 tier: 9,999 ÷ 0.5 ≈ 19,998 CNY
    Scenario List-price cost Actual payment with CNY 2,999 tier Actual payment with CNY 4,999 tier Actual payment with CNY 9,999 tier Channel B / D 50% off Conclusion
    ③ Output-intensive 19,090 17,805 15,757 9,999 9,545 B or D is better
    ④ Offline batch processing 12,470 11,185 9,137 9,999 6,235 D is better
    ⑤ Multimodal analysis 16,540 15,255 13,207 9,999 8,270 B or D is better

    Scenario ③ calculation example:

    1. Actual payment with CNY 2,999 tier = 2,999 + (19,090 − 4,284) = 17,805 CNY
    2. Actual payment with CNY 4,999 tier = 4,999 + (19,090 − 8,332) = 15,757 CNY
    3. Actual payment with CNY 9,999 tier = 9,999 CNY
    4. Channel B / D 50% off = 9,545 CNY

    Scenario ④ calculation example:

    1. Actual payment with CNY 2,999 tier = 2,999 + (12,470 − 4,284) = 11,185 CNY
    2. Actual payment with CNY 4,999 tier = 4,999 + (12,470 − 8,332) = 9,137 CNY
    3. Actual payment with CNY 9,999 tier = 9,999 CNY
    4. Channel D batch 50% off = 6,235 CNY

    Scenario ⑤ calculation example:

    1. Actual payment with CNY 2,999 tier = 2,999 + (16,540 − 4,284) = 15,255 CNY
    2. Actual payment with CNY 4,999 tier = 4,999 + (16,540 − 8,332) = 13,207 CNY
    3. Actual payment with CNY 9,999 tier = 9,999 CNY
    4. Channel B / D 50% off = 8,270 CNY

    The conclusion is clear: under the example prices, even if the subscription tier covers all usage, it is not better than the 50% off price from Channel B or D.

    4.4 Interpretation of results

    ① Low-to-medium usage: discounts are more direct than subscriptions

    The list-price costs for scenarios ① and ② are CNY 175.6 and CNY 1,756 respectively, both below the payback line of approximately CNY 4,284 for the CNY 2,999 tier. In this case, the subscription plan is not applicable, and a limited-time 50% discount or batch 50% discount is more direct.

    ② Output-intensive workloads: output cost determines the value of discounts

    In scenario ③, the output cost is:

    1. 6,000 × 2.8 = 16,800 CNY

    This accounts for about 88% of the list-price cost of CNY 19,090. Output tokens account for about 54.5% of all tokens, but because the output unit price is the highest, output cost dominates.

    At the example tier, although the CNY 9,999 tier covers the usage, the actual payment is CNY 9,999, which is higher than the 50% off price of CNY 9,545. Therefore, the better choice for this scenario is B or D, not the subscription plan.

    ③ Offline batch processing: batch 50% off is better

    The list-price cost for scenario ④ is CNY 12,470. If the workload can be processed offline, Channel D’s batch 50% off price is CNY 6,235; the actual payment for the CNY 9,999 tier is CNY 9,999, still higher than the batch price. Therefore, offline batch processing should prioritize the batch 50% off option.

    If the workload cannot tolerate latency, do not rely on batch or off-peak discounts. Compare again among real-time 50% off channels.

    ④ High usage and long context: subscriptions are not necessarily better; check effective discounts

    The list-price cost for scenario ⑤ is CNY 16,540. The CNY 9,999 tier can cover the usage, but the actual payment is CNY 9,999, which is higher than the 50% off price of CNY 8,270 from Channel B or D.

    The cache hit rate for this scenario is:

    1. 18,000 ÷ 30,000 = 60%

    This shows that multimodal scenarios still have significant reuse potential for fixed prompts, asset templates, or historical prefixes. However, even with a non-low cache hit rate, channel discounts and call structure may still be more cost-effective than a subscription.

    4.5 Sensitivity analysis

    Impact of output length changes on scenario ③:

    • If output increases by 20%: monthly output rises to 7,200 million tokens, total cost is about CNY 22,450, and B or D is about CNY 11,225;
    • If output decreases by 20%: monthly output falls to 4,800 million tokens, total cost is about CNY 15,730, and B or D is about CNY 7,865.

    The longer the output, the more the value of discounted channels is amplified. The shorter the output, the more suitable cheaper or lightweight models may be.

    Cache hit rate drops by 10 percentage points:

    In scenario ③, cache hits fall from 3,000 million tokens to 2,500 million tokens, and uncached input increases to 2,500 million tokens. The total cost is about CNY 19,375, higher than the original CNY 19,090.

    Limited-time discount expires:

    If the limited-time 50% discount expires in scenario ②, the cost rises from CNY 878 back to CNY 1,756. Budgets should be stress-tested at list price rather than assuming promotional prices will persist.

    5. Checklist to verify before procurement

    A comparison table is only a starting point. Before placing an order, confirm the following item by item:

    1. Discount validity: When does the limited-time discount end? What price applies after it ends?
    2. Discount stacking rules: Can limited-time discounts, batch discounts, and subscription credits be combined?
    3. Billing definition: Is reasoning content counted as output? How are cache hits determined? Is cache storage charged?
    4. Multimodal token conversion: How are images, videos, and files converted into tokens?
    5. Failure and retry billing: Are timeouts, rate-limit rejections, and moderation blocks billed? Do they consume rate limits?
    6. Limits and scaling: What are the requests per minute, token rate, and concurrency limits? How long does quota expansion take?
    7. Usage observability: Are usage details, usage query APIs, and project-level cost allocation available?
    8. Settlement and financial terms: Are settlement cycles, exchange rates, invoices, taxes, suspension due to non-payment, and refund rules clear?
    9. Data and compliance: Is request data used for training? How long is it retained? Is data residency supported?
    10. Stability and migration cost: What are the SLA, historical availability, fallback mechanisms, and API differences?
    11. Private deployment TCO: If a dedicated deployment is used, also verify instance fees, operations, power, migration, and scaling costs.

    6. Reduce costs without changing channels: engineering-side optimization checklist

    Cost differences caused by channel choice are often measured in multiples. As usage grows, engineering-side optimization can continuously reduce bills.

    Engineering optimization checklist

    • Build a unified abstraction layer and routing: Hide API differences across channels, and route tasks to appropriate model tiers based on task type, cost, and latency.
    • Stabilize prefixes to improve cache hits: Place fixed content such as system prompts, tool definitions, and long documents at the beginning of the request.
    • Control context growth: Summarize or compress conversation history, and inject relevant snippets through retrieval.
    • Suppress invalid output: Set reasonable maximum output lengths, remove redundant instructions, and use backoff retries for failed requests.
    • Shift and batch workloads: Put non-real-time tasks into message queues and process them in off-peak windows or through batch inference.
    • Preprocess multimodal inputs: Standardize image scaling, reduce video sampling frame rates, and prioritize extracting document text.
    • Make costs observable: Build token accounting by business line and functional module, and set budget alerts.
    • Monitor cache hit rate: Use a 7-day weighted hit rate as the baseline. If it drops by 10 percentage points compared with the baseline for consecutive periods, trigger an investigation; if it drops by more than 5 percentage points for 2 consecutive days, send an alert.

    Cache invalidation troubleshooting table

    Common cause Symptom Fix
    Request prefix includes a timestamp The prefix differs on each request, making cache hits difficult Move the timestamp after the fixed prefix
    Request prefix includes a random ID Fixed content cannot hit the cache Move random fields to the end or remove them from the shared prefix
    Dynamic sorting parameters enter the prefix Sorting changes cause prefix changes Fix the order of system prompts, tool definitions, and knowledge-base snippets
    Templates change frequently Cache hit rate suddenly drops Freeze templates and warm the cache through a release process after changes
    Knowledge-base snippets are assembled dynamically Assembly order differs on each request Standardize snippet order and versioning

    7. Risk warnings and budget flexibility

    Main risks

    • Discount rollback: Build budgets at list price rather than discounted price, and stress-test discount expiry.
    • Subscription sunk cost: Prepaid subscriptions may not be recoverable if usage falls. Teams with volatile usage should start with small-scale trials.
    • Billing definition changes: When billing rules change, historical bills become less comparable. Retain usage snapshots.
    • Compliance risk: Before sending sensitive data through a third-party aggregation channel, confirm retention and cross-border policies.
    • Price regression: Low prices during product promotion are common. Long-term budgets should be based on sustainable pricing.

    Budget stress-test table

    Scenario Trigger condition Example action
    List price restored Limited-time discount ends Recalculate at list-price cost; for example, scenario ⑤ rises from CNY 8,270 to CNY 16,540
    Package quota exhausted Usage exceeds the subscription quota Recalculate according to overage rules; for example, the CNY 2,999 tier in scenario ⑤ has an overage at list price, resulting in CNY 15,255
    Off-peak discount expires Latency cannot be shifted or the off-peak price is removed Revert to standard discounts or list pricing, and re-evaluate the optimal channel

    A conservative budget can be estimated as:

    1. Budget ≈ list-price cost after discount expiry + unamortized package balance

    When the list-price cost falls below the new payback line, reassess whether to upgrade or renew the plan. More importantly, compare the actual subscription payment with limited-time discounts, batch discounts, and off-peak discounts.

    Conclusion

    Cost optimization for LLM APIs is essentially a joint optimization of billing definition, billing model, and call structure:

    1. Build a monthly cost model with a consistent billing definition;
    2. Use payback lines to determine whether subscriptions are worthwhile, and use effective discounts to determine whether off-peak scheduling is worth it;
    3. Choose billing methods based on scenario usage, and continuously optimize the call structure on the engineering side;
    4. Do not only look at whether a subscription covers the quota; also compare the actual payments of 50% off, batch, off-peak, and other alternatives.

    Prices will continue to change with market competition and product iteration, but the methodology for cost estimation and channel selection remains valuable over the long term. Building a reusable estimation process is more important than remembering a low price on a particular day.