Layer 1: Usage Events (The Atomic Unit)
Usage events form your system's foundation. These immutable, append-only records capture every billable action.
What makes a good usage event?
- Who: Customer identifier
- What: Metric name (requests, tokens, bytes)
- How much: Quantity consumed
- When: Precise timestamp
Here's the critical principle: If you can't replay it, you can't trust it.
Your event store must allow complete reconstruction of any invoice from raw events. This provides an unassailable audit trail for disputes or corrections.
Layer 2: Meters & Aggregation
Raw events need transformation into billable metrics. Meters handle this aggregation.
Modern metering engines transform usage into "metered features" customized to your business context. An AI voice translation service might track audio duration and language complexity, but bill based on minutes translated or conversations processed.
Common aggregation patterns include:
- COUNT: Total API calls per period
- SUM: Data transferred or tokens processed
- UNIQUE: Distinct users or resources
- MAX: Peak concurrent connections
- PERCENTILE: 95th percentile for SLA billing
Time windows matter. Many B2B services bill monthly, though requirements vary:
- Hourly aggregation for real-time dashboards
- Daily rollups for usage alerts
- Monthly totals for invoicing
- Annual views for enterprise contracts
Layer 3: Rating & Price Models
Your rating engine applies business logic to aggregated usage, transforming raw quantities into dollar amounts.
Common pricing models:
Flat Rate
- Simple: $0.001 per API call
- Easy to understand and forecast
- No volume incentives
Tiered Pricing
- First 10,000 calls: $0.001 each
- Next 90,000 calls: $0.0008 each
- Above 100,000: $0.0006 each
Volume Discounts
- All usage priced at tier reached
- Rewards high-volume customers
- Encourages usage growth
Credit-Based
- Pre-purchased credits consumed by usage
- Upfront revenue for providers
- Budget control for customers
Layer 4: Invoicing & Settlement
The final layer generates customer invoices and handles payment. Critical considerations include:
- Finalization Windows: How long to wait for late events
- Proration: Handling mid-period changes
- Corrections: Processing adjustments and disputes
- Revenue Recognition: Accounting compliance
Under ASC 606, revenue is recognized when the customer gains control of the promised goods or services. For usage-based models with a "stand-ready obligation"—the promise to be available on demand—revenue recognition often occurs as usage happens (Cloud Billing Market Size, Share | Growth Report 2035), though base access fees might be recognized straight-line over the period. The specific timing depends on contract terms, performance obligations, and your accounting policies.