Reducing LLM Application Costs: Routing, Model Tiering, and Semantic Caching

    After an LLM application goes live, many teams find that bills grow faster than user numbers. This article examines the main sources of token cost and three common cost-reduction strategies: multi-model routing, tiered model selection, and semantic caching. It covers applicability, trade-offs, and operational risks, and highlights what teams should measure and enforce in a gateway before treating cost savings as durable.

    After an LLM application goes live, many teams find that their bills grow faster than their user base. The problem is usually not the model itself, but how requests are sent, which model receives them, and how many times the same request is sent. This article starts from the sources of cost, explains the practices and boundaries of three common strategies, and discusses accounting considerations and gateway implementation for developers working on production deployments.

    1. Why Token Costs Remain High

    LLM calls are billed by the number of input and output tokens. The cost of a single request is mainly determined by three factors.

    1. Prompts and history are too long. The system prompt plus the full conversation history is billed again on every turn. The longer the multi-turn conversation, the more expensive each input becomes. An overly long context can also cause the model to miss key information, which reduces answer quality.
    2. Every request goes to the flagship model. Tasks such as casual chat, intent recognition, and text classification can usually be handled by lightweight models. Sending all of them to a flagship model can create a unit-price gap of several times to tens of times; the exact multiple should be checked against the vendor’s price list.
    3. Duplicate requests are billed repeatedly. The same question may be asked by different users, or by the same user multiple times. If the model is called every time, the team pays multiple times for the same answer.

    2. Three Cost-Reduction Strategies and How to Choose

    2.1 Multi-Model Routing: Send Simple Tasks to Lightweight Models

    The approach is to place a gateway between the application and the models, and select a model based on request complexity. The decision can use rules such as text length, keywords, or whether the input contains code; it can also use a small classification model.

    This strategy applies when the distribution of request types is clear and the quality of lightweight models on those request types has already been validated. Routing errors directly affect answer quality, so the system must be tested with an evaluation set before launch, not evaluated only by average cost.

    The main risk is that complex questions are misclassified to a lightweight model, degrading the user experience. A common mitigation is to define escalation rules: if the lightweight model’s output confidence is below a threshold, or if the user follows up, the request is automatically escalated to the flagship model. Escalation adds cost, so teams should track the escalation rate and include it in cost accounting.

    2.2 Tiered Pricing and Model Selection: Leverage Platform Price Differences

    Unit prices can vary widely across cloud platforms and model versions. Some platforms may offer promotional or trial pricing for common lightweight models, and such offers can sometimes significantly reduce the cost per call.

    These offers are usually limited by time, quota, and eligible models, and their terms may change. Before selecting a model, teams should check the official price list and offer terms, and should not treat temporary discounts as long-term cost assumptions. Final cost figures should be based on actual load-test bills.

    2.3 Semantic Caching: Reuse Answers for Similar Questions

    When a request arrives, the input is first converted into a vector, and historical questions are retrieved from a vector database. If the similarity exceeds a threshold, the cached answer is returned directly without calling the model.

    This strategy is suitable for scenarios such as customer support Q&A and knowledge base retrieval, where questions are concentrated and answers are stable, so the hit rate is relatively high. Open-ended creative requests usually have a low hit rate and are not suitable for caching.

    When using semantic caching, teams need to address the following risks:

    • False hits. The vectors for “refund a purchase” and “cancel a ticket” may be close, but their handling processes are completely different. The threshold must be calibrated with an evaluation set, and critical business processes involving funds or compliance can add manual rules.
    • Privacy. The cache stores user input, so data must be redacted before writing, and no-write rules must be set for content containing personal information.
    • Invalidation. After prices, policies, or knowledge base content change, old answers must expire. The cache should have a time-to-live (TTL), and when the knowledge base is updated, the cache should be invalidated by version.
    • Tenant isolation. When multiple customers share a cache, the retrieval scope must be isolated by tenant to prevent one tenant from accessing another tenant’s cached answers.