LLM Token Cost: A Practical Guide to Calculating the Real Cost of AI Models

    A practical guide to understanding the true cost of LLM tokens beyond advertised per-million prices. Learn how billing models, subscription plans, caching discounts, and retry rates affect your actual spend, and how to build a cost model based on effective cost per completed task.

    1. The Misread “Cheap”: Low Unit Price Does Not Mean Low Cost

    In model selection discussions, the most common reference point is the official price per million tokens. A flagship model from a certain category typically costs only 30% to 60% of a leading international model, while lightweight versions can drop below 3% of a mid-tier model. Looking at the price sheet alone, the conclusion seems clear: domestic models are cheap.

    However, this conclusion assumes a specific condition: that you pay as you go, and your usage matches the billing metrics exactly. In reality, most developers and teams do not use models this way. Therefore, discussing cost requires first defining the “cost metric.”

    2. Four Metrics: One Model, Four Different Bills

    1. API Pay-As-You-Go Metric: Unit price multiplied by actual tokens consumed. This is the most direct and easiest to compare.
    2. Subscription Plan Metric: Fixed monthly fee divided by the estimated total tokens available in the plan, yielding a “converted unit price.”
    3. Cache Discount Metric: Input tokens that hit the cache are usually billed at a significant discount. The higher the hit rate, the lower the effective average price.
    4. Task Completion Metric: Total cost to complete a business task equals the cost per call multiplied by the number of retries.

    Interestingly, these four metrics can produce completely opposite rankings. Based on public benchmark data, a subscription plan costing approximately 1,360 RMB per month is estimated to allow up to 10.9 billion tokens per month, converting to roughly 12.5 RMB per 100 million tokens. Meanwhile, several domestic plans convert to approximately 101, 50.2, 25.1, 95.4, 17.5, and 6.4 RMB per 100 million tokens. In other words, except for the lowest tier, most domestic plans actually cost more in real usage than subscription-based products.

    3. Why Subscriptions Can Be “Inverted”

    The reason is not technical, but rather commercial structure and user behavior:

    • Funding and Subsidy Capacity: Leading vendors can use capital to subsidize heavy developers, treating subscriptions as a customer acquisition tool.
    • Credit Accumulation Assumption: Vendors bet that most users will not exhaust their quota. Actual consumption is often less than 10% of the limit, and the unused portion becomes gross margin.
    • Strategic Divergence: Domestic vendors face greater pressure on compute procurement and cost recovery, so they prefer low-priced APIs to compete for enterprise call volume. International vendors use low-priced subscriptions to capture the mindshare of consumers and developers.
    • Cache Amplification Effect: Measured cache ratios can exceed 90%, reaching 97% under high-load scenarios, directly driving effective input costs extremely low.

    4. A Reusable Cost Estimation Method

    Do not compare unit prices; compare the “cost per effective task.” Model it using the following steps:

    1. def effective_cost(base_price, cache_ratio, cache_discount,
    2. hit_rate, retries, tokens_per_task):
    3. # Input side: cached portion receives a discount
    4. input_cost = base_price * ((1 - cache_ratio) +
    5. cache_ratio * cache_discount)
    6. # Hit rate determines the actual discount magnitude
    7. input_cost *= (1 - hit_rate) + hit_rate * cache_discount
    8. # Output side is usually not discounted, calculated at 1.0
    9. total = (input_cost + base_price) * tokens_per_task
    10. return total * retries # Retry count is the hidden primary cost driver

    The key variable is retries. In a unified financial report analysis task, 20 models were tested 60 times. 9 models achieved 100% accuracy, 6 of which were domestic models. A lightweight model costs only about 0.25 RMB per task, less than 3% of the most expensive model. However, when facing high-difficulty tasks like complex code refactoring or long-latency bugs, low-price models often require repeated trial and error, and the total cost may end up higher.

    5. Engineering Practice Recommendations

    • Tiered Routing: Route simple tasks to lightweight models and escalate complex tasks, using rules or a small model for preliminary classification.
    • Caching and Batching: Place stable prefixes (system prompts, long documents) at the front to reuse cache, combined with message queues for peak shaving.
    • Observability: Use logging services and monitoring alerts to record tokens per task, cache hit rate, and retry counts, forming a cost dashboard.
    • Quality Gates: Incorporate accuracy into the cost model to avoid “saving on unit price but losing on total cost.”
    • Elastic Resources: Use container platforms to host inference gateways and object storage to archive call details for retrospective auditing.

    6. Conclusion

    The token unit price is just the entry ticket. Real cost is determined jointly by the billing metric, cache hit rate, and task success rate. Establishing an accounting system centered on “effective task cost,” and building an observable, routable, and auditable cost governance pipeline using general cloud product capabilities on platforms like Baidu AI Cloud, is the correct path to cost control.