Events: Recording customer activity
Everything starts with events—timestamped records of customer activity sent to Orb’s ingestion API.Why immutability matters: Traditional billing systems increment counters as events arrive. Once incremented, the original context is lost. Orb stores raw events, so you can always re-query with different logic, backfill late data, or audit any charge down to the specific events that generated it.
Metrics: Defining what to measure
A metric (also called a billable metric) is a query that transforms raw events into a billable quantity. Metrics define what you’re measuring, separate from how you’re pricing it.
A single event stream can power multiple metrics. The same API call event might contribute to:
- Total API calls (COUNT)
- Total tokens (SUM of
tokensproperty) - Calls by model (COUNT, grouped by
modelproperty)
Prices: Configuring rates
A price defines how a metric quantity translates to a charge. Orb supports multiple pricing models:
Prices also specify:
- Cadence: Monthly, quarterly, annual, or one-time
- Timing: In-advance (charge at period start) or in-arrears (charge at period end)
- Currency: The billing currency or a custom pricing unit
Metric + Price separation: The same metric can have different prices for different customers. A “tokens consumed” metric might be $0.01/token for self-serve customers and $0.005/token for enterprise contracts—same underlying measurement, different commercial terms.
Plans: Packaging prices together
A plan bundles prices into a product offering. Plans are templates that define the standard pricing for a customer segment. A plan might include:- A monthly platform fee (unit price, in-advance)
- API call charges (tiered price, in-arrears)
- Storage fees (unit price based on GB-hours, in-arrears)
- An annual commitment minimum
Subscriptions: Connecting customers to plans
A subscription represents a customer’s ongoing relationship with a plan. It specifies:- Which customer
- Which plan (or plan version)
- Start date and optional end date
- Any customer-specific overrides (custom rates, additional discounts, negotiated minimums)
Overrides without complexity: When an enterprise customer negotiates a 20% discount, you don’t create a custom plan. Apply the discount as an override on their subscription. They’re still on the standard plan—with customer-specific terms layered on top.
Invoices: The output
An invoice is the billing document generated for a subscription’s billing period. Orb calculates invoices by querying:- Events matching the customer and billing period
- Metrics defined on the subscription’s prices
- Prices with their rates, tiers, and adjustments
- Subscription terms including overrides and discounts
What makes this different
Traditional billing systems aggregate at ingestion time. Events increment counters; counters determine charges. This is efficient but inflexible—once aggregated, the raw data is gone. Orb’s query-based approach preserves raw events and calculates at billing time:
This architectural difference is why Orb can safely backdate changes, simulate pricing scenarios, and maintain complete audit trails—capabilities that are difficult or impossible in counter-based systems.
Next steps
Core concepts
Detailed reference for Events, Metrics, Plans, Subscriptions, and Invoices
Quickstart guide
Build your first usage-based billing workflow in 30 minutes
Query-based billing
Deep dive into immutable events and deterministic queries
Diff-based engine
How safe backdating and migrations work