Skip to content

AI LLM Gateway Billing Options ​

Use Case: Using the platform as an enterprise-internal AI LLM gateway, providing unified access to self-hosted model inference instances (private inference) and external AI channels (OpenAI / Zhipu / Tongyi and other providers), with differentiated cost calculation and allocation schemes for different departments (workspaces / projects).

This guide is intended for customers/users and explains the platform's metering and billing capabilities and recommended implementation configurations.


1. Overview ​

The platform is a complete AI Model Gateway + Metering and Billing system that natively covers the three key requirements:

RequirementPlatform CapabilityReadiness
Access and billing for self-hosted model inference instancesToken Governance (private inference billing: source_type=system, model billing strategy)✅ Implemented
External AI channel integration and billingAPI Channel Billing (channel cost: source_type=custom, channel cost strategy)✅ Implemented
Cost calculation across departmentsWorkspace / Namespace billing and allocation✅ Implemented

Core design: For each LLM call, the platform simultaneously answers two questions:

  1. How much did the user spend (payable amount): billed to their department / individual account based on the model alias invoked by the user.
  2. How much did the platform pay (channel cost): records the platform's procurement cost based on the actual external channel matched, used for reconciliation with providers.

The two pricing chains are independently configured and coexist in the same call log entry, without interfering with each other.


2. Billing System Overview ​

2.1 Dual Billing Dimensions ​

DimensionMeaningAudienceFrontend Entry
Payable AmountCost of one LLM invocation for the userEnd users / department heads / financeToken Governance pages
Channel CostActual procurement cost paid by the platform to external channelsPlatform administrators / operations / channel reconciliationAPI Channel pages

Typical relationships:

  • For self-hosted inference: Both dimensions may be identical (platform-operated, no procurement cost), charged per the same model billing strategy.
  • For external channels: Payable = channel cost × profit margin (typical resale), or payable = 0 (internal free team), but costs still need to be tracked.
  • The same virtual model can use multi-channel canary routing (A/B / fallback); the user unit price remains stable while the actual channel cost may vary per call.

2.2 Billing Pipeline ​

User Request → Higress AI Gateway → (matches AiRoute) → Self-hosted Inference Instance or External AI Channel
                                                              │
                                                              ▼
                                  ClickHouse Call Log (one row per request, recording token/latency/identity)
                                                              │
                                                              ▼ ⏰ Scheduled task backfill
                                  Calculates two prices: Payable Amount (by model alias) + Channel Cost (by upstream model)
                                                              │
                                                              ▼
                                  PostgreSQL Billing Strategy Rules (billings table, pricing by level/model/channel)

Costs are not calculated in real time: requests first land in logs, and a scheduled task batch-backfills prices (default interval of a few minutes, can be triggered manually). Failed calls (HTTP ≥ 400) are not billed.

Token Governance overview: KPI cards and trends

API Channel overview: cost KPI and top rankings


3. Billing Strategy Configuration ​

3.1 Four Types of Billing Strategies ​

StrategyLocationBilling TargetUnit
Model Billing Strategy/admin/billing/governance/strategyLLM calls (Token / count / duration / characters)¥/1M Token, ¥/call, ¥/1k seconds, ¥/1k characters
Channel Cost Strategy/admin/billing/channel/strategyExternal API channel procurement costSame as above (multi-currency CNY / USD)
Physical Resource Billing Strategy/admin/billing/strategyCPU / memory / GPU memory¥/core, ¥/GiB (per billing cycle)
Machine Resource Billing Strategy/admin/billing/machine/strategyPhysical machine CPU / memory / GPU memory / GPU compute¥/core, ¥/GiB

3.2 Model Billing Strategy (Token Governance — User Payable) ​

Each model can be configured with the following pricing tiers:

TierDescriptionUnit
Input (prompt)Input tokens in the user request¥/1M Token (required)
Output (completion)Output tokens generated by the model¥/1M Token
Cache Hit (cached read)Tokens matching the context cache¥/1M Token
Cache Write 5 MinutesAnthropic-style short TTL cache write¥/1M Token
Cache Write 1 HourAnthropic-style long TTL cache write¥/1M Token

In addition to token-based pricing, non-text billing units are also supported:

UnitApplicable ScenarioDescription
Per CallImage generation / video generation, etc.Fixed price per invocation; supports tiered pricing tables (e.g., by resolution 512×512 / 1024×1792, by duration, by quality tier)
Per 1k SecondsASR speech recognitionBilled by audio duration
Per 1k CharactersTTS speech synthesisBilled by text character count

Supports multimodal metering: images by count/resolution tier, audio by seconds, text by token/character.

New model billing rule drawer: five pricing tiers and non-text units

3.3 Channel Cost Strategy (API Channel — Platform Reconciliation) ​

Configuration ItemDescription
Pricing Dimension(Channel, upstream model name); supports * wildcard for "channel base price"
Price Mode"Specific Model" (exact model pricing) or "Channel Base Price" (uniform price for all models on the channel)
CurrencyCNY (default) or USD; exchange rate snapshot locked
UnitSame as model billing strategy (Token five-tier / per call / per 1k seconds / per 1k characters)

New channel cost rule drawer: channel, currency, and price mode


4. Differentiated Billing Across Departments (Workspace / Namespace) ​

4.1 Billing Strategy Scope ​

Billing strategies support multi-level scope overrides, from platform-wide defaults to workspace-level overrides:

LevelMeaningDescription
systemPlatform default priceBaseline price effective across the entire platform
workspaceWorkspace override priceCustom pricing for a specific department/tenant, overrides the platform default
inferencePrivate inference exclusive priceDedicated pricing for self-hosted NovaInference inference services
api_channelChannel cost rulePricing for external channel procurement costs

4.2 Price Hit Priority (5 Levels + Wildcard) ​

1. Channel + Workspace + Model          ← Most specific
2. Channel + Workspace + "*"
3. Channel + Model
4. Channel + "*"                        ← Channel base price
5. Workspace + Model                    ← Department exclusive price
6. Platform + Model                     ← Platform default price
7. Fallback

Conclusion: You can configure different billing strategies for different departments (workspaces). For example: R&D department pays ¥0.8/1M Token for internal allocation, marketing department pays ¥2/1M Token, independently; departments without custom configuration automatically inherit the platform default price.

4.3 Cost Allocation Dimensions ​

DimensionDescription
WorkspaceDepartment-level cost summary (billing strategies are configured at this level)
Project / NamespaceProject-level cost drill-down (billing reports support aggregation by namespace)
User (creator)Individual-level costs
Model × UserCombined analysis by model and user

Physical resource billing records (BillRecord) support four-level drill-down: system → workspace → namespace → creator; model token billing records support multi-level aggregation: system → workspace → model → user → API Key.

Users and workspaces: consumption ranking aggregated by department


5. Cost Query and Reports ​

5.1 Token Governance (User Perspective) ​

PageCapabilities
Token Governance OverviewTotal requests / total tokens / payable amount / error rate / average latency KPIs
Call RecordsPer-call detail (with five pricing tier breakdown)
Consumer AnalysisAggregated by user / workspace; payable amount ranking
Key AnalysisUsage, quota, and rate limiting by API Key
Model RankingToken consumption and cost by model

Model call record detail: trace and billing breakdown

5.2 API Channels (Platform Perspective) ​

PageCapabilities
Channel OverviewChannel cost KPIs, per-channel cost trends
Channel AnalysisCost aggregated by channel (AiProvider)
Upstream ModelsAggregated by (channel, upstream model)
Channel QualityLatency / error rate monitoring
Channel CallsCall records with source_type=custom forced

Upstream model cost Top 10 and aggregation table

Channel analysis: cross-channel comparison and threshold coloring

5.3 Physical Resource Cost (Billing Management) ​

  • Three-level drill-down: node cost / GPU card type cost / per-card cost
  • Cost pie charts, trend line charts, distribution charts, Top 5 ranking
  • Call log CSV export (up to 10,000 rows per export), resource cost detail export

5.4 End-User Self-Service ​

  • My Usage (/admin/model-x/my-usage): Personal usage overview / trends / top models / recent calls
  • My Calls (/admin/model-x/my-calls): Personal call records
  • End-user view automatically hides administrative dimensions such as channels, upstream models, and routing

My Usage: personal KPIs, trends, and consumption ranking


6.1 Onboarding Steps for New Scenarios ​

  1. Connect self-hosted inference: Deploy model inference instances (NovaInference) → system automatically registers as a "system channel".
  2. Connect external channels: Configure API channels (AiProvider — OpenAI / Anthropic / Zhipu protocol) → configure routing (AiRoute) and model mapping.
  3. Set prices:
    • system level: Configure platform-wide default model billing strategy (external charging).
    • workspace level: Configure department-exclusive pricing (differentiated charging).
    • api_channel level: Configure channel cost strategy (procurement cost, multi-currency).
  4. Create accounts: Create workspaces + projects for departments, assign API Keys.
  5. Review reports: Operations use channel analysis for reconciliation; departments use consumer analysis for allocation; individuals use My Usage for self-service queries.
Business ScenarioRecommended Configuration
Internal general-purpose self-hosted modelssystem level model billing strategy, five-tier token pricing
External LLM resaleapi_channel channel cost strategy + system/workspace payable strategy (margin = markup)
Cross-department differential pricingPer-department workspace level model billing strategy (overrides platform default)
Image / video generation servicesper_call per invocation + tiered pricing table (resolution / quality)
ASR speech servicesper_1k_seconds per 1k seconds
TTS speech servicesper_1k_chars per 1k characters

7. Current Limitations and Notes ​

CapabilityStatusNotes
GPU / CPU / memory metering and billing✅Supported, per core / GiB / billing cycle
Storage (disk / PVC) metering and billing❌ Not yet supportedPhysical resource billing dimensions do not include standalone storage; planned as an extension
Budget alerts / quota enforcement⏳ PlannedQuota configuration and usage queries are currently supported; budget-triggered actions are planned for a future phase
Multi-currency⚠️ PartialChannel cost side supports CNY / USD; payable side defaults to CNY
Billing strategy version management✅Each strategy supports viewing historical versions (revision) for audit trail

8. Summary ​

The platform is ready with AI Model Gateway + Dual-Dimension Metering and Billing capabilities and can directly support the integrated requirements of "self-hosted inference + external channel integration + department-level cost allocation":

  • Internal: Self-hosted inference is transparently billed by token/count, with department-level allocation by workspace/namespace.
  • External: External channels are reconciled at actual cost, with clear resale margin visibility.
  • Management: Multi-level strategy scopes + five-layer price priority + version auditing provide flexible configuration and auditable accounting.

For detailed configuration steps, pricing examples, or custom reports, see Billing > Token Governance and Billing > API Channels, or contact the platform administrator.

Generated from Rise AI Platform release-2606.v2.2.x