Open Source, Subscription, and Usage-Based Billing Architecture for LLM Services
This article explains how LLM service providers combine open-weight models, tiered membership subscriptions, and pay-as-you-go API billing into a single monetization strategy. It covers versioned governance of model capabilities, the linked design of revenue tiers, an entitlement-centered subscription implementation with dual quota cycles and lifecycle state machines, three-layer metering/pricing/settlement for usage-based APIs, and multi-tenant architecture with layered rate limiting and observability. It also outlines the operational capabilities needed to scale from a single product to a platform. The goal is to give developers practical design patterns for building multi-tenant quotas, usage metering, and cost control into their own LLM applications or into externally packaged model services.
Open Source, Subscription, and Usage-Based Billing Architecture for LLM Services
1. Introduction: From Opening Up Capability to Measuring Value
Over the past few years, the LLM service market has developed along two parallel tracks.
First, the continuous opening up of model capabilities. Leading vendors keep pushing the reasoning capabilities of their flagship models and release part of their models to the developer community through open weights. Open and closed source coexisting has become the industry norm.
Second, the increasing refinement of business models. Vendors no longer rely on a single revenue source. Instead, they combine “free tier + tiered membership subscriptions + pay-as-you-go API billing” to cover different user segments—from individual trial users and high-frequency heavy users to enterprise integrations. At the same time, capital markets are paying growing attention to AI infrastructure and model service companies, which requires enterprises to make their revenue structure, cost structure, and compliance systems more transparent and auditable.
For developers, understanding the technical logic behind this model has direct engineering value:
- If you are building your own LLM application, you need to design multi-tenant quotas, usage metering, and cost control;
- If you are packaging model capabilities as an external service, you need a billing architecture that is practical and evolvable.
This article does not target any specific product. Instead, it abstracts the above models into several general technical problems and provides design ideas and implementation references for each. Note that all parameters and ratios mentioned here are illustrative values used to explain design methods; they do not represent the actual rules of any product.
2. From Open Source to Service: Versioned Governance of Model Capabilities
2.1 Capability Layering Between Open Source and Commercial Editions
The core value of open models lies in lowering the barrier to use: developers can deploy, fine-tune, and integrate them locally or in their own environments without worrying about data leaving their premises, and they can deeply customize around specific scenarios. For enterprises with data-sensitive needs, private deployment requirements, or a need for deep secondary development, open weights often fit better than API calls.
Correspondingly, commercial services usually add engineering safeguards for production environments on top of general capabilities. Common dimensions include:
- Model capability: stronger general performance in complex reasoning, long-text understanding, and generation;
- Service availability: service level agreements, failure recovery, and dedicated technical support;
- Security and compliance: content safety review, data encryption, and access auditing;
- Enterprise governance: fine-grained permissions, quota management, usage reports, and billing.
Therefore, when planning their model portfolios, vendors usually treat “open-source ecosystem” and “commercial service” as complementary rather than substitutes. Open source expands the developer base and collects feedback, while the commercial edition drives revenue at scale.
2.2 Version Naming and Lifecycle
Model capabilities iterate quickly. Without clear version governance, downstream integrators frequently encounter compatibility problems where “the interface stays the same but the behavior changes.” A common industry practice is to divide versions into three types:
- Major version: significant changes in capability architecture or behavior;
- Minor version: capability enhancements or new features;
- Patch version: bug fixes and adjustments to alignment and safety policies.
Around versioning, a service provider needs to establish at least the following mechanisms:
- Model registration and weight management: record a unique identifier, weight file location, parameter scale, and context length metadata for each model version, and ensure reliable loading and rollback from storage.
- Capability declaration and evaluation baselines: build an evaluation set covering general knowledge, reasoning, code, math, and other dimensions. Each version is regression-tested on a fixed baseline before release, and evaluation results are published with the version to help users choose.
- Interface compatibility and deprecation policy: keep a stable request/response structure for external APIs, and express capability upgrades through model names or optional parameters. After an old model enters its deprecation period, it should be announced in advance through official channels with a sufficient transition window.
- Canary releases: roll out a new version to a small fraction of traffic first, gradually increase it based on monitoring metrics, and quickly switch back to the old version once metrics go abnormal.
For applications that directly consume the API, it is recommended to pin the model version in the configuration and run regression tests with your own business samples before switching. Example:
# Application-side model config: pin the version for regression and rollbackmodel_config:chat:model: "chat-model" # identifier of a specific model version; evaluate before switchingtemperature: 0.3max_tokens: 2048summarization:model: "chat-model-lite" # for cost-sensitive scenarios like long-text summarization, use a lightweight modelmax_tokens: 1024fallback:enabled: true # automatically switch to a backup model when the primary model failsmodel: "chat-model-lite"
3. Business Model Analysis: How Open Source, Subscription, and Usage-Based Billing Work Together
3.1 Fundamental Differences Between Two Billing Models
Subscription and usage-based billing correspond to two very different cost structures:
- Subscription: users pay a fixed monthly fee for usage rights within an agreed scope. The vendor bears the risk of usage fluctuation but gains predictable recurring revenue.
- Usage-based billing: usage and cost are linearly linked. Users pay only for actual consumption, and the vendor’s revenue fluctuates in step with costs.
The cost of LLM inference is mainly driven by input length, output length, request frequency, and peak concurrency. Usage distributions vary greatly across users. A small number of heavy users may contribute most of the call volume, so pricing design must account for both “average cost” and “tail cost.”
3.2 Linked Design of the Revenue Structure
In practice, mature service systems usually design the three revenue streams as an interconnected whole rather than separate entry points:
- Free tier: acquisition and habit formation. It offers basic model capabilities and limited quotas, letting users experience the core value at the lowest cost.
- Subscription tier: cash flow and retention. It locks in high-frequency users with a monthly fee and achieves price differentiation through tier differences.
- API billing tier: monetization at scale and enterprise penetration. It settles by call volume and covers integration needs from small and medium developers to large enterprises.
There is usually a clear entitlement mapping between the three. For example, paid subscribers can often get a certain amount of API call quota within their plan, with overage billed by usage. This design improves the perceived value of the subscription while providing a channel for enterprise customers to migrate gradually.
An illustrative entitlement mapping:
| Service Tier | Target Users | Billing Method | Typical Entitlements |
|---|---|---|---|
| Free tier | Trial individual users | Free | Basic model, limited calls and context length |
| Basic subscription | Light but frequent individual users | Monthly fee (low tier) | Higher usage quota, standard response speed |
| Premium subscription | Heavy individual users and small teams | Monthly fee (mid/high tier) | Longer context, stronger model, higher concurrency, gifted API quota |
| Enterprise / API billing | Enterprises and developers | Subscription + usage-based | Elastic quota, dedicated rate limits, auditing and billing, service level guarantees |
3.3 Key Principles of Tier Design
Membership tiers are not simply combinations of price numbers. A sound design should follow these principles:
- Explainable entitlement differences: users should clearly understand “what the extra money buys.” Common dimensions include available models, context length, peak-time priority, concurrency, upload file capacity, and API quota.
- Avoid “hollow tiers”: if the difference between adjacent tiers cannot be perceived by most users, users will concentrate in one tier, unbalancing the revenue structure.
- Reserve room for upgrades: the tier system should support adding new entitlements later (such as multimodal capabilities or team collaboration), rather than being rebuilt each time.
4. Technical Implementation of Tiered Subscriptions: Entitlement Systems and Quota Cycles
4.1 An Entitlement-Centered Design
The engineering core of tiered subscriptions is to decouple “user identity” from “available capabilities.” The recommended approach is to introduce an independent Entitlement Service:
- User identity is managed by the authentication system;
- Subscription status is maintained by the order and payment system;
- The Entitlement Service uses “user/tenant + effective time” as the key and outputs a unified capability list downstream.
All business modules (chat, file parsing, API gateway) read only the conclusions of the Entitlement Service and do not each judge “whether a user is a member.” The benefits are that adding a new tier only changes configuration, not business code, and entitlements can take effect immediately and be revoked upon expiry.
4.2 Dual Quota Measurement: Cycle Quota and Real-Time Quota
A simple “monthly quota” is not enough to handle burst traffic, so practice typically adopts a two-layer model of cycle quota + real-time quota:
- Cycle quota: resets on a calendar-month basis to control total usage for cost accounting;
- Real-time quota: controls request rate and concurrency on a minute- or second-level sliding window to protect the backend inference cluster.
Combining the two prevents a single user from exhausting cluster resources while ensuring a good experience for normal users within the month. Example code:
function check_quota(user, request):plan = entitlement_service.get_plan(user)if plan is empty:plan = free_plan # fall back to free tier when not subscribedif realtime_counter.incr_and_ttl(user, window=60s) > plan.requests_per_minute:return rate_limited(message: "Too many requests, please try again later")if concurrency_counter.get(user) >= plan.max_concurrency:return queue_or_rate_limitif month_tokens_so_far + estimated_tokens_this_time > plan.monthly_token_quota:if plan.allows_overage_billing:record overage usage, continue executionelse:return quota_exceeded(message: "Monthly quota used up")return allow
4.3 Subscription Lifecycle State Machine
A subscription is not a static attribute but a stateful object. A robust state machine should contain at least the following transitions:
[No subscription] --payment success--> [Active] --expired without renewal--> [Grace period][Grace period] --renew within grace--> [Active][Grace period] --grace ends--> [Downgrade to free tier][Active] --user cancel--> [Expiring] --expires--> [Grace period]
A few engineering details that are easily overlooked:
- Grace period: after a delayed payment callback or a user-initiated cancellation, retain a certain data access grace period to avoid a sudden interruption of experience;
- Idempotent payment callbacks: the same payment event may be delivered repeatedly, so entitlement activation must use the payment transaction ID as the idempotency key;
- Plan changes: upgrades take effect immediately, downgrades take effect in the next billing cycle, and users are notified of quota changes in advance;
- Data retention: after a downgrade, historical sessions, files, and other data should be kept downloadable for a period to prevent users from thinking their data is lost.
5. Metering, Pricing, and Settlement for Usage-Based Billing APIs
5.1 Three-Layer Separation: Metering, Pricing, Settlement
Usage-based billing looks like “just multiplying by a unit price,” but the real challenge is engineering it well. It is recommended to split the system into three layers:
- Metering layer: collects the actual usage of each call and produces tamper-proof usage events;
- Pricing layer: maintains price tables, discount rules, gifted quotas, and tiered strategies;
- Settlement layer: combines usage with pricing to generate bills, deduction records, and invoice data.
The three layers are decoupled through message queues and data pipelines, so upgrading any layer does not affect the others. This is also the prerequisite for building an auditable billing system.
5.2 Usage Collection: Unified Instrumentation at the Gateway Layer
Usage collection should be as close to the inference service as possible, but be unified at the API gateway to ensure consistent measurement. Typical collected fields include:
- request ID, tenant ID, timestamp;
- model name and version;
- input token count, output token count;
- whether the cache was hit, whether multimodal input was used;
- request latency, whether it failed, and error code.
Whether failed requests are billed needs to be clearly defined by the product side and documented. For example, failures caused by server-side errors are not billed, while failures caused by user parameter errors can be handled as agreed.
5.3 Idempotency, Deduplication, and Delayed Reporting
In distributed environments, usage events may be delivered repeatedly or arrive late. The settlement system must have:
- Idempotent consumption: use “request ID + tenant ID” as the unique key so that duplicate events are settled only once;
- Late-arrival window: set a compensation settlement window for late-arriving data, for example completing reconciliation corrections at T+1 day;
- Tamper resistance: usage events are append-only after being written, and corrections are recorded as new events, preserving a complete audit trail.
Example code:
function on_usage_event(event):key = event.request_id + ":" + event.tenant_idif dedup_table.exists(key):return # idempotent: ignore duplicate eventdedup_table.set(key, TTL=7 days)plan = entitlement_service.get_plan(event.tenant)price = pricing_service.lookup(plan, event.model, event.timestamp) # price versioned by effective timebillable_tokens = event.input_tokens + event.output_tokens * output_multiplierif event.cache_hit:billable_tokens = billable_tokens * cache_discountif plan.includes_gifted_quota and gifted_quota.remaining > 0:deduct gifted_quotaremaining part goes to the usage-based billelse:add to usage_based_bill(event.tenant, billable_tokens * price.unit_price)write audit_log(event)
5.4 Bill Generation and Usage Transparency
What enterprise customers care about most is often not whether the price is high or low, but “whether the bill can be reconciled.” Therefore, usage dashboards and bill details are essential capabilities for an API product:
- Real-time dashboard: display call volume, token consumption, and cost trends by hour/day;
- Detailed bills: can be broken down by model, API key, and tag dimensions;
- Budget alerts: notifications via messaging when approaching thresholds, to avoid unexpected overspending;
- Usage export: support exporting detailed data for enterprises to integrate into their own cost accounting systems.
6. Multi-Tenant Architecture and Stability Assurance
6.1 Two Granularities of Tenant Isolation
- Logical isolation: shares the inference cluster and partitions resources via tenant IDs, quotas, and priority queues. Low cost, suitable for long-tail users.
- Physical isolation: provides enterprises with independent inference instances or dedicated resource pools. Higher cost but stronger controllability, suitable for customers with high requirements for data security and stability.
Most platforms adopt a hybrid model of “primarily logical isolation, supplemented by physical isolation,” and offer a physical isolation option through enterprise subscriptions or dedicated plans.
6.2 Layered Rate Limiting and Overload Protection
Rate limiting is not a single-point configuration but a layered defense system:
- Access layer: rate limiting based on IP, user, and API key to resist abnormal traffic;
- Gateway layer: concurrency and quota limits based on subscription tiers;
- Inference layer: dynamic batching (Continuous Batching) and queue length limits to prevent cluster avalanche;
- Degradation strategy: prioritize paying users during peak times, and put free users in a queue or degrade them to a lightweight model.
6.3 Observability
Complete observability should cover three levels:
- Metrics: QPS, P95/P99 latency, time-to-first-token, token throughput, error rate, GPU utilization;
- Logs: structured request logs including tenant, model, latency, and usage;
- Tracing: call-chain tracing across gateway, inference, and storage to quickly locate performance bottlenecks.
7. From Technical Capability to Scaled Operations
Technical architecture solves “whether it can be used,” while the operations system solves “whether it can be sustained.” For LLM service companies planning to move from a single product toward a platform, or even toward the public capital markets, the following capabilities are all indispensable:
- Explainable revenue structure: revenue sources such as subscriptions, API, and enterprise customization are clearly separable;
- Attributable cost structure: unit token cost, inference resource cost, and storage and bandwidth cost can be accounted for by business line;
- Complete compliance system: data security, content security, and personal information protection meet regulatory requirements;
- Commit-able service levels: external SLAs are consistent with internal monitoring metrics, without exaggerating capabilities.
Taking common practices of cloud service platforms such as Baidu AI Cloud as an example, by using object storage to hold model weights and training data, message queues to asynchronously decouple billing events, container platforms to support elastic scaling of inference services, and log and monitoring/alerting services to ensure observability, enterprises can build a complete technical foundation of “model service + billing + operations” in a relatively short time.
8. Conclusion
The competition in LLM services is, on the surface, a contest of model capabilities, but at the bottom it is a comprehensive contest of engineering systems and business design. Open source expands the ecosystem, subscription locks in retention, and usage-based billing handles demand at scale—only when the three work together can a healthy revenue structure be built.
For developers, mastering this set of general methods—entitlement modeling, usage metering, billing settlement, and multi-tenant rate limiting—can significantly reduce trial-and-error costs whether building your own application or designing an external service, allowing technical investment to more quickly translate into sustainable business value.
