LLM Inference Cost and Quota Governance in Practice
This article examines why generative AI products often see rapid user growth alongside slow revenue growth, and breaks down the four layers of online inference cost: compute, GPU memory, scheduling, and operations. It introduces a unit economics model, explains why unlimited free tiers need governance, and presents a three-tier quota structure with priority scheduling, structural cost-reduction techniques such as prefix caching, semantic caching, batching, model routing, output length limits, and elastic scaling. It also covers the observability metrics and capacity planning needed to keep inference spending sustainable while preserving user experience.
1. The Problem: User Growth and Compute Spending Do Not Move Together
A pattern keeps recurring as generative AI products spread quickly: the user curve climbs steeply while the revenue curve stays flat. Take a leading product by user volume as an example. Public data shows its monthly active users have reached the hundreds of millions, with year-over-year growth above 100%. Yet when you convert its daily compute consumption using publicly available API prices, it can reach tens of millions of yuan per day, while average daily revenue is under a million yuan and comes mostly from derivative businesses unrelated to the core inference capability.
This comparison reveals a structural fact: the marginal cost of a large model does not approach zero. The expansion dividend of traditional internet products comes from “build once, copy infinitely,” but every generative inference request genuinely consumes compute, so cost grows linearly or even super-linearly with call volume. As a result, the scale advantage created by a free strategy can become a heavy burden from a financial standpoint. The “quota” discussed in this article is the direct engineering-level projection of that contradiction.
2. What Inference Cost Is Made Of: Where the Money Goes
Before governing cost, you need to see its structure. Spending on a single online inference can be roughly split into four layers:
- Compute layer: the decode phase is a memory-access-intensive workload that repeatedly reads weights and the growing context cache, so GPU memory bandwidth often becomes the bottleneck before compute does.
- GPU memory layer: the context cache grows linearly with sequence length and concurrency, which directly determines the concurrency ceiling a single card can support.
- Scheduling layer: traffic peaks and troughs cause idle resources or queuing; without enough elasticity, you either waste capacity or time out.
- Operations layer: logging, monitoring and alerting, content safety review, canary releases, and failure fallback all create ongoing overhead.
The most critical engineering metric is cost per request, roughly expressed as:
Cost per request ≈ (hourly cost per card × number of cards × duration) / effective output tokens
This formula says two things: increasing effective output and cutting wasted recomputation is the main path to lower cost, while simply pushing down unit price has a limited ceiling.
3. Unit Economics: Do the Math Before Talking About Growth
Teams should build a minimal viable unit economics table that aligns revenue and cost at the same granularity:
Unit gross margin = daily revenue per active user - daily inference cost per active userDaily inference cost per active user = daily requests × average input tokens × input price+ daily requests × average output tokens × output price- discount from cache hits
With this table, product decisions have a basis: which features can be free during a subsidy period, which must count toward a paid allowance, and which should be retired outright. A practical approach is to rank internally with “high-value scenarios first” and direct limited compute to the paths that contribute most to retention and conversion.
4. Why Free Allowances Need Governance
Unlimited free allowances trigger three typical problems. First, distorted demand: automation scripts and bulk scraping mix into real traffic and squeeze the experience of normal users. Second, unpredictable cost: finance cannot build a budget and capacity planning loses its anchor. Third, missing fairness: heavy and light users pay the same price, which suppresses willingness to pay over time.
So a quota is not about “keeping users out”; it is a resource pricing mechanism that trades a predictable boundary for service sustainability. In engineering terms, it should be implemented as a configurable, observable, and rollback-capable policy rather than a hard-coded check.
5. Tiered Quotas and Priority Scheduling
A three-tier quota structure is recommended: an anonymous trial tier with a very low daily allowance for trying the service; a free registered tier with a medium daily allowance plus rate limits; and a paid tier with a high allowance and higher priority. Quotas are counted over a sliding window, paired with a token bucket to control instantaneous rate:
class Quota:def __init__(self, daily_limit, rate_per_min):self.daily_limit = daily_limitself.bucket = TokenBucket(rate_per_min)def allow(self, user_id, now):used = counter.get(user_id, window="1d")if used >= self.daily_limit:return Decision(False, reason="daily_exhausted")if not self.bucket.take():return Decision(False, reason="rate_limited")counter.incr(user_id, window="1d")return Decision(True, reason="ok")
On the scheduling side, introduce a priority queue: paid requests are dequeued first, while low-priority requests enter a queue during peaks and get an estimated wait time instead of failing outright. This holds the cost ceiling while preserving experience elasticity.
6. Structural Cost-Reduction Techniques
- Prefix cache reuse: persist the context cache of stable prefixes such as system prompts and knowledge base snippets; the hit portion is not billed, which can significantly cut spending in long-prompt scenarios.
- Semantic caching: return historical results for high-frequency similar questions, with a similarity threshold and invalidation policy to avoid stale answers.
- Batching and off-peak scheduling: merge offline tasks into batches and run them during troughs to improve resource utilization.
- Tiered model routing: send intent recognition and format conversion to smaller models, and escalate to larger models only for complex reasoning.
- Output length constraints: explicitly cap maximum generation length and optimize prompts to reduce wasted output.
- Elastic scaling: automatically scale container platform instances based on queue length and latency metrics, forming a closed loop with logging services and monitoring alerts.
7. Observability and Capacity Governance
No measurement, no governance. At minimum, collect six metric categories: request volume, input and output token distribution, cache hit rate, queue time, cost per request, and quota trigger rate, and drill down by scenario and user tier. For capacity planning, estimate card count with “peak concurrency × GPU memory per request ÷ concurrency a single card can support,” and reserve headroom for bursts. Baidu AI Cloud offers a fairly complete combination of general capabilities across container platforms, object storage, logging services, and monitoring alerts, which can serve as a reference shape for building the closed loop above.
8. Balancing Experience and Monetization
Before a quota policy goes live, settle three things: the fallback path when an allowance is exhausted (switch to a smaller model, shorten output, or go asynchronous), transparent allowance display with recovery time, and an exemption whitelist for high-value scenarios. Use canary releases and evaluate on three metrics: retention, paid conversion, and complaint rate; roll back as soon as experience metrics deteriorate. Operating quotas as a product feature rather than a technical limitation clearly improves user acceptance.
9. Conclusion
The scale of free users is not the problem; scale without cost constraints is. Break inference cost down to request granularity, build a unit economics model, and then combine tiered quotas, cache reuse, batching, and elastic scheduling to find a sustainable balance between growth and spending. For development teams, real competitiveness lies not in how large a free allowance you offer, but in whether every unit of compute is spent on requests that create value.
