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.| Metric type | Use case | Example |
|---|---|---|
| COUNT | Count events matching filters | API calls, transactions |
| SUM | Sum a numeric property | Tokens consumed, bytes transferred |
| MAX | Peak value during the period | Concurrent users, storage high-water mark |
| COUNT(DISTINCT) | Unique values | Monthly active users, unique sessions |
- 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:| Model | How it works | Example |
|---|---|---|
| Unit | Fixed amount per unit | $0.01 per API call |
| Tiered | Rate changes at volume thresholds | First 1,000 calls free, then $0.005 each |
| Package | Charge per bundle of units | $10 per 1,000 tokens (4 units used = 1,000 billed) |
| Bulk | Volume determines rate for all units | Under 10K: $0.02/unit; 10K+: $0.01/unit for all |
- 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:| Scenario | Traditional system | Orb |
|---|---|---|
| Late-arriving events | Lost or requires re-ingestion | Automatically included in next calculation |
| Pricing change | Requires migration scripts | Apply new prices, recalculate |
| Metric redefinition | Impossible without re-ingestion | Query historical events with new logic |
| Audit a charge | Limited counter history | Trace to specific events |
| Backdate a contract | Manual adjustments | Atomic recalculation with correct effective dates |