Multi-Model API Pricing and LLM Cost Calculation Guide

    Comparing large language model APIs by token unit price alone often leads to inaccurate budgets. This guide breaks down the real components of LLM API costs—including input and output tokens, prompt caching, peak/off-peak pricing, and batch discounts—and summarizes the public pricing structures of four representative service types. It also provides a unified cost formula, scenario-based selection strategies for online Q&A, batch document processing, and multi-turn assistants, plus practical advice on per-request cost monitoring to keep spending predictable.

    1. Why You Shouldn’t Compare Only the “Price per Million Tokens”

    When integrating a large language model API, the most common mistake is comparing only input prices or focusing on a model’s lowest advertised rate. In practice, total cost is determined by several components working together:

    1. Input token cost: This includes the user’s question, system prompts, conversation history, retrieved context, and tool-calling payloads.
    2. Output token cost: Generated answers, structured data, code, and intermediate reasoning output—usually billed at a higher rate than input.
    3. Cache-related costs: Some providers bill cache-hit input separately and may also charge for cache writes or storage.
    4. Time-based price differences: Some models distinguish between peak and off-peak rates based on request completion time.
    5. Batch discounts: Asynchronous or batch jobs may receive discounts, but these typically cannot be combined with other offers.
    6. Hidden costs from context length: Even when each user turn is short, long-running conversations or retrieval-augmented applications may continuously carry large amounts of historical context.

    Therefore, a sound comparison is not a simple ranking of unit prices. You need a unified cost model that accounts for traffic patterns, cache hit rates, output length, and call timing.

    2. Public Pricing Overview for Four Types of Model Services

    All prices below are expressed as CNY per million tokens. To avoid conflating different services’ naming, this article refers to them as Service A, B, C, and D.

    2.1 Service A: Input Caching Combined with Time-of-Day Pricing

    Service A bills differently for peak and off-peak periods. Off-peak prices are roughly half of peak prices, and cache-hit input is significantly cheaper than regular input.

    Model Tier Off-Peak Cache Hit Off-Peak Regular Input Off-Peak Output Peak Cache Hit Peak Regular Input Peak Output
    Lightweight 0.02 1.00 4.00 0.04 2.00 8.00
    High-Capability 0.15 4.50 13.50 0.30 9.00 27.00

    The billing rules can be summarized as follows:

    • Certain morning and afternoon windows on weekdays count as peak hours;
    • Nights, weekends, and public holidays count as off-peak;
    • The billing period is determined by the request completion time, not the submission time;
    • If a request spans peak and off-peak windows, you cannot determine the rate simply by the start time;
    • Scheduled batch jobs should run during off-peak windows whenever possible.

    This pricing structure suits latency-insensitive tasks that can run outside working hours—document archiving, offline classification, batch summarization, and data cleaning.

    2.2 Service B: Cache Hits and Cache Storage Billed Separately

    Service B offers lightweight, balanced, and high-capability tiers, with the following regular input, output, and cache-hit prices:

    Model Tier Regular Input Output Cache Hit Cache Storage
    Lightweight 0.80 2.70 0.16 0.017 / million tokens / hour
    Balanced 3.00 15.00 0.60 0.017 / million tokens / hour
    High-Capability 6.00 30.00 1.20 0.017 / million tokens / hour

    Note carefully that a cache-hit price does not mean caching is free. The actual cost includes at least two parts:

    • Read charges on cache-hit requests;
    • Storage charges for keeping cached content alive.

    If your system reuses the same prompt repeatedly within a short window, caching usually lowers input cost. If cached objects sit untouched for a long time, storage fees may offset part of the savings. A caching strategy should therefore consider not just the hit discount, but also cache lifetime, hit rate, and reuse frequency.

    2.3 Service C: Batch Discounts Cannot Stack with Context Caching

    Service C has two main price tiers—high-capability and general-purpose:

    Model Tier Input Output Billing Notes
    High-Capability 12.00 36.00 Single-request input capped at roughly one million tokens; batch discount available
    General-Purpose 2.40 9.60 Applies to non-thinking-mode calls

    The key rule here is not the unit price itself but the mutual exclusivity of discounts: the batch discount and the context caching discount cannot be applied at the same time.

    When designing offline workloads, you must therefore calculate both options:

    • Option 1: Use batch pricing without the context caching discount;
    • Option 2: Keep context caching and forgo the batch discount.

    If a workload repeatedly sends large identical system prompts, context caching may win. If requests vary widely with little shared prefix, the batch discount usually delivers more direct savings. Never assume “batch has a discount” automatically means “batch is cheaper.”

    2.4 Service D: High Output Prices and Noticeable Cache Write Fees

    Service D offers standard, high-speed, and general-purpose tiers:

    Model Tier Regular Input Output Cache Hit Cache Write
    Standard 13.00 68.00 1.30 5 min: 13.00; 1 hour: 26.00
    High-Speed 26.00 136.00 1.30 5 min: 26.00; 1 hour: 52.00
    General-Purpose 20.00 100.00 2.00 5 min: 20.00; 1 hour: 40.00

    Output prices here are significantly higher, so this type of service fits scenarios that demand top answer quality, complex task handling, or fast response—and is a poor fit for indiscriminately handling large volumes of simple text generation.

    Cache writes also come with different retention periods: the longer the retention, the higher the write price. For bursty traffic patterns, short-retention caching is preferable; long-retention caching only pays off when the same context is reused continuously over a longer period.

    Batch pricing is roughly 60% of the standard rate, but the decision should still factor in output volume, cache hit rates, and task deadlines.

    3. A Unified Cost Formula

    To avoid misjudgments caused by different vendors’ billing schemes, use this generic formula:

    1. Total cost =
    2. input_tokens ÷ 1,000,000 × input unit price
    3. + output_tokens ÷ 1,000,000 × output unit price
    4. + cache_hit_tokens ÷ 1,000,000 × cache hit unit price
    5. + cache_write_tokens ÷ 1,000,000 × cache write unit price
    6. + cache_storage_volume × storage unit price × retention hours

    If a service has peak, off-peak, or batch pricing, first determine the actual billing mode, then plug the corresponding unit prices into the formula.

    For example, a request with 100k input tokens and 20k output tokens costs, under regular input mode:

    1. 0.1 × input unit price + 0.02 × output unit price

    If 80k of those tokens hit the cache, split it as:

    1. 0.02 × regular input unit price
    2. + 0.08 × cache hit unit price
    3. + 0.02 × output unit price

    This split matters because cache hits only affect the repeated input portion—they do not reduce output cost.

    4. Selection Strategies by Business Scenario

    4.1 Online Q&A

    Online Q&A demands low latency and cannot rely entirely on nights or weekends. Prioritize comparing peak-hour prices and pay attention to output length control.

    Recommendations:

    • Enable context caching for fixed system prompts;
    • Cap conversation history length;
    • Route simple questions to lightweight tiers;
    • Set up escalation routing for complex questions instead of sending everything to the high-capability tier;
    • Enforce maximum output limits on overly long answers.

    4.2 Batch Document Processing

    Summarization, classification, tag generation, and content moderation typically don’t need real-time responses, making them good candidates for batch or off-peak execution.

    Measure these three costs first:

    1. Real-time calls during peak hours;
    2. Real-time calls during off-peak hours;
    3. Calls with the batch discount.

    If the workload contains large amounts of identical templates, you must also compare the context caching option. For highly repetitive tasks, the input cost reduction from caching can exceed the batch discount.

    4.3 Multi-Turn Assistants

    In multi-turn conversations, the dominant cost is often not the user’s latest question but the ever-growing history. Possible optimizations include:

    • Retain only the most recent turns;
    • Compress older content into summaries;
    • Place stable persona settings and business rules in a cacheable prefix;
    • Inject retrieval results on demand instead of sending all materials every turn;
    • Structurally compress tool-call results.

    Keep in mind that cache hits depend on a stable context prefix. If you insert changing content before the fixed prompt on every request, everything after it may fail to hit the cache.

    5. The Most Commonly Overlooked Factors in Budget Estimation

    5.1 Output Length Is Frequently Underestimated

    Many systems estimate budgets based on user input volume alone, but output is usually priced higher. In code generation, long-document analysis, and complex reasoning, output tokens can quickly exceed input.

    5.2 Failed Requests and Retries Are Billed Repeatedly

    Network timeouts, rate limiting, or client retries can cause the same task to be submitted multiple times. Production systems should use unique request IDs, retry limits, and idempotency controls to avoid duplicate generation.

    5.3 Caches Don’t Last Forever

    Caches may have expiration times, storage fees, or hit conditions. Evaluate benefits using the real hit rate—not a theoretical 100%.

    5.4 Peak/Off-Peak Boundaries Are Tricky

    For services billed by completion time, a long request that crosses a boundary may fall into a different price bracket. Scheduled jobs should reserve enough execution time rather than relying on submission time alone.

    5.5 Discounts May Be Mutually Exclusive

    Batch, caching, tiered pricing, and promotional discounts don’t necessarily stack. Before launch, write all billing conditions into a decision table and validate actual bills with small-scale requests.

    6. Build Per-Request Cost Monitoring

    Record the following fields at the application layer:

    1. request_id
    2. model_tier
    3. input_tokens
    4. output_tokens
    5. cached_tokens
    6. cache_write_tokens
    7. execution_mode
    8. peak_or_offpeak
    9. retry_count
    10. estimated_cost

    Then aggregate daily or per business line:

    • Average input tokens;
    • Average output tokens;
    • Cache hit rate;
    • Average cost per request;
    • Extra cost caused by retries;
    • Cost share by model tier;
    • Ratio of peak vs. off-peak calls.

    When actual bills deviate from budget, you can quickly determine whether the cause is input growth, longer outputs, cache misses, increased retries, or shifted call timing.

    7. Conclusion

    Comparing multi-model API costs is fundamentally a combined accounting of input, output, caching, timing, and task patterns. A low input unit price does not guarantee the lowest total cost, and a high-capability model is not right for every task. A more reliable approach:

    1. First, measure the real input/output token distribution;
    2. Separate online requests from offline jobs;
    3. Evaluate caching benefits based on repeated context;
    4. Compare the actual effect of batch discounts versus cache discounts;
    5. Include peak/off-peak timing, retries, and cache storage in the budget;
    6. Continuously calibrate the estimation model through monitoring.

    Only by converting a public price list into a per-request cost for your specific workload does model selection become truly actionable—allowing the system to strike a stable balance among quality, latency, and budget.