Chinese Open-Source LLM Costs: Estimation, Accessibility, and Ecosystem Impact

    This article provides a practical framework for understanding and estimating the real cost of open-source LLM inference, including input and output tokens, cache hits, batch calls, and retries. It explains the engineering factors behind lower prices, such as MoE, KV cache management, continuous batching, speculative decoding, and domestic chip adaptation, while noting their limits. It then discusses scenarios that become viable, the value of open source beyond free access, and a tool-calling agent example built on OpenAI-compatible APIs. A pre-launch checklist and risk notes help teams compare models on a consistent basis and turn lower costs into sustainable production capabilities.

    1. Why Cost Was the First Barrier to AI Deployment

    Many teams get good results during prototyping, but then see the inference bill and are forced to cut features, reduce call frequency, or pause the entire project. Inference cost directly determines whether a feature can run continuously. For small and mid-sized teams, tens of thousands of CNY per month in model costs often means the project cannot be approved.

    Recently, pricing for Chinese open-source LLMs has dropped noticeably. Vendors publish different unit prices and adjust them frequently, so this article does not cite specific prices. Readers should use the selected vendor’s current price list and calculate costs based on their own business volume.

    2. How to Calculate the Real Cost of a Single Call

    Many people only look at the price per million tokens and ignore the structure of actual spending. The cost of a call usually includes the following:

    • Input tokens: prompts, conversation history, and retrieved document chunks. In long-context scenarios, this is often the largest part.
    • Output tokens: the model-generated answer. Most vendors charge a higher unit price for output than for input.
    • Cache hits: if a repeated prefix hits the cache, some vendors offer a lower unit price.
    • Batch calls: some vendors offer discounts when offline tasks use batch APIs.
    • Failed retries: repeated calls caused by timeouts or format errors are also billed.

    The script below estimates monthly inference cost. The unit prices are examples and must be replaced with the actual prices from the selected vendor before running.

    1. # Monthly inference cost estimate (example unit prices; replace with current price list)
    2. monthly_tokens = 50_000_000 # Total tokens per month
    3. input_ratio = 0.8 # Input share
    4. output_ratio = 0.2 # Output share
    5. input_price_per_m = 1.0 # Input price, CNY per million tokens (example)
    6. output_price_per_m = 2.0 # Output price, CNY per million tokens (example)
    7. retry_rate = 0.05 # Extra calls caused by retries
    8. effective_tokens = monthly_tokens * (1 + retry_rate)
    9. cost = (effective_tokens * input_ratio / 1e6) * input_price_per_m \
    10. + (effective_tokens * output_ratio / 1e6) * output_price_per_m
    11. print(f"Estimated monthly model cost: about {cost:.2f} CNY")

    In addition to model fees, teams also need to estimate the following costs: development and integration labor, hardware and operations for servers or private deployment, data storage and compliance auditing, and human review time. Only by adding these items together can a team obtain the true total cost of ownership (TCO).

    Teams should build a comparison table with the same scope, and fill in the same fields for every candidate model:

    Item Model A Model B Overseas closed-source reference
    Model version and release date
    Input price (CNY per 1M tokens)
    Output price (CNY per 1M tokens)
    Cache-hit price
    Batch discount conditions
    Maximum context length
    Data storage region
    Price source and query date

    A same-scope comparison requires the model version, billing region, and billing rules to be consistent. Different vendors vary significantly in metering units and discount methods, so directly comparing unit prices can easily lead to wrong conclusions.

    3. Technical Reasons Behind Low Prices and Their Boundaries

    Price reductions are not only driven by subsidies. In most cases, they are supported by engineering. The following technologies are common reasons, but their specific effects should be checked against vendor technical reports.

    • Mixture-of-Experts (MoE) architecture: only part of the parameters are activated during inference, so the computation per inference is lower than that of a dense model of the same scale.
    • KV cache management: attention caches are reused efficiently to reduce repeated computation. Long conversations and long-document scenarios benefit most.
    • Continuous batching: the server dynamically combines multiple requests to improve GPU utilization.
    • Speculative decoding: a small model predicts candidate tokens, and the large model verifies them in batches, which can reduce generation latency.
    • Domestic compute adaptation: some models have completed inference adaptation validation on domestic chip platforms. This indicates that they can run on that platform, but it does not mean all models and all sizes have been adapted, nor does it mean the training stage is equally mature. Teams should check the vendor’s specific announcements.

    These technologies reduce unit cost, but they do not eliminate cost. Long context increases input volume, complex agents increase the number of calls, and high concurrency brings rate-limiting issues. Teams should consider both quality and cost when designing features.

    4. Accessibility Effects: Scenarios That Become Feasible

    With lower costs, features that were once affordable only to large internet companies become accessible to small and mid-sized businesses and individual developers. Typical scenarios include the following:

    • Long-document processing: contract review, research report analysis, and codebase understanding can include relatively complete material in a single request, reducing the engineering work of chunking and retrieval.
    • Digitalization in traditional industries: internal systems in manufacturing, healthcare, legal, and education can integrate models for Q&A, summarization, and form filling. These scenarios often have high data compliance requirements and need separate evaluation.
    • Learning and prototyping: students and independent developers can run experiments at lower cost and validate whether an idea is worth pursuing.

    Accessibility does not mean there are no risks. The performance of low-cost models in complex reasoning, domain knowledge, and stability still needs to be evaluated against specific business requirements.

    5. The Value of Open Source Is Control, Not Just Free Access

    The core value of open-source models includes the following:

    • Private deployment: data can remain on the enterprise intranet, which helps meet compliance requirements in finance, government, and other industries.
    • Reproducibility and auditability: if the vendor publishes technical reports, training methods, and evaluation results, teams can verify them independently.
    • Customization: fine-tuning or quantization on proprietary data can adapt the model to specific business needs.
    • Rich ecosystem tools: inference frameworks, quantization tools, and fine-tuning tools are continuously maintained by the community.

    Before selecting a model, teams must check the license. Questions to confirm include: the license type, whether commercial use is allowed, whether there are limits on user scale or revenue, how weights are obtained, and whether attribution is required. These terms vary by model and cannot be generalized from the experience of a single model.

    6. From Chat to Execution: Agent Example

    The focus of current model capabilities is shifting from answering questions to executing tasks. A model can decide which tool to call, in what order, and what to do next based on the returned result. This requires stable tool-calling capability, strict structured output, and the ability to plan tasks in a long context.

    The following example uses an OpenAI-compatible interface. Many Chinese model vendors provide such interfaces. In actual use, you need to modify the address, model name, and parameters according to the vendor documentation. The example includes authentication, timeouts, a tool allowlist, argument parsing, and a maximum step limit.

    1. import json
    2. import os
    3. from openai import APIError, APITimeoutError, OpenAI
    4. # Read secrets and endpoint from environment variables; do not hard-code them
    5. client = OpenAI(
    6. api_key=os.environ["LLM_API_KEY"],
    7. base_url=os.environ["LLM_BASE_URL"], # OpenAI-compatible endpoint provided by the vendor
    8. timeout=30, # Timeout per request (seconds)
    9. )
    10. MODEL = os.environ["LLM_MODEL"] # Model name follows the vendor documentation
    11. MAX_STEPS = 5 # Maximum tool-call rounds to prevent infinite loops
    12. tools = [
    13. {
    14. "type": "function",
    15. "function": {
    16. "name": "query_order",
    17. "description": "Query order status by order ID; read-only operation",
    18. "parameters": {
    19. "type": "object",
    20. "properties": {
    21. "order_id": {"type": "string", "description": "Order ID"}
    22. },
    23. "required": ["order_id"],
    24. "additionalProperties": False,
    25. },
    26. },
    27. },
    28. {
    29. "type": "function",
    30. "function": {
    31. "name": "create_ticket",
    32. "description": "Create an after-sales ticket for a user; only one ticket per order",
    33. "parameters": {
    34. "type": "object",
    35. "properties": {
    36. "user_id": {"type": "string"},
    37. "order_id": {"type": "string"},
    38. },
    39. "required": ["user_id", "order_id"],
    40. "additionalProperties": False,
    41. },
    42. },
    43. },
    44. ]
    45. def query_order(order_id: str) -> dict:
    46. # Replace with a real business API. Query APIs should be read-only.
    47. return {"order_id": order_id, "status": "delivered", "user_id": "u_1001"}
    48. def create_ticket(user_id: str, order_id: str) -> dict:
    49. # Replace with a real ticket API. Use an idempotency key to prevent duplicate tickets
    50. # when the model calls the tool repeatedly.
    51. return {"ticket_id": f"T-{order_id}", "status": "created"}
    52. # Tool allowlist: only functions registered here can be executed
    53. TOOL_IMPL = {"query_order": query_order, "create_ticket": create_ticket}
    54. def run_agent(user_text: str) -> str:
    55. messages = [{"role": "user", "content": user_text}]
    56. for _ in range(MAX_STEPS):
    57. try:
    58. resp = client.chat.completions.create(
    59. model=MODEL, messages=messages, tools=tools
    60. )
    61. except (APITimeoutError, APIError) as e:
    62. return f"Model call failed; please hand off to a human. Error: {e}"
    63. msg = resp.choices[0].message
    64. if not msg.tool_calls:
    65. return msg.content or ""
    66. messages.append(msg)
    67. for call in msg.tool_calls:
    68. fn = TOOL_IMPL.get(call.function.name)
    69. if fn is None:
    70. result = {"error": f"Unregistered tool: {call.function.name}"}
    71. else:
    72. try:
    73. args = json.loads(call.function.arguments)
    74. # In production, validate arguments with JSON Schema before execution
    75. result = fn(**args)
    76. except (json.JSONDecodeError, TypeError) as e:
    77. result = {"error": f"Argument error: {e}"}
    78. messages.append({
    79. "role": "tool",
    80. "tool_call_id": call.id,
    81. "content": json.dumps(result, ensure_ascii=False),
    82. })
    83. return "Maximum tool-call rounds exceeded; please hand off to a human."
    84. if __name__ == "__main__":
    85. print(run_agent("Check order 12345 for me, and create a ticket if there is a problem."))

    There are several points to note in this code. First, the example has not been tested against a specific vendor, so it should be run in a test environment before first use. Second, write operations such as create_ticket should ideally include human confirmation in production, or set limits on amount, frequency, and other factors. Third, tool permissions should be minimized, and the model should only access business-necessary interfaces. Fourth, argument validation should use a complete JSON Schema; the example only performs basic checks.

    7. Pre-Launch Checklist

    Before model selection and launch, teams can confirm the following items one by one:

    Check item What to confirm
    Task type Is it Q&A, summarization, classification, or multi-step tool calling?
    Context length What is the typical input token volume, and does the longest input exceed the model limit?
    Tool-call stability On real samples, what are the JSON format error rate and argument error rate?
    Private deployment cost Are hardware, operations, electricity, and scaling costs within budget?
    Compliance requirements Is data allowed to leave the region, and are local storage and audit logs required?
    License Is commercial use allowed, and are there usage-scale or revenue limits?
    Service level Do availability, rate limits, and response latency meet business needs?
    Failure handling Are timeout, retry, and human handoff processes designed?

    8. Risk Notes

    When adopting low-cost models, teams should pay attention to the following risks:

    • Price volatility: vendors may adjust unit prices, discount rules, and free quotas, so cost models need regular review.
    • Rate limiting and availability: peak periods may cause queuing or rate limiting, and critical businesses need fallback plans.
    • Data and privacy: when calling public cloud APIs, input content may pass through overseas nodes or third-party services, so the vendor’s data processing terms should be checked.
    • Licensing and compliance: open-source licenses and terms of service may restrict how the model is used, and legal teams should participate in review.
    • Output quality: models may produce factual errors in professional domains, and important conclusions require human review.

    Conclusion

    Lower LLM inference costs give more teams the opportunity to put AI features into production. Lower cost is only the first step. Teams still need to compare models using same-scope data, clarify license and compliance boundaries, design tool-call permissions and failure handling, and continuously track price and quality changes. Doing this work solidly is what turns low-cost models into product capabilities that can run sustainably.