Core Concepts
A billable metric is a measurable unit. It doesn’t have a price — that comes later when you create plans. It can also be used independently of billing, purely for metering and entitlement enforcement. Each metric belongs to exactly one product and specifies:- Name — What customers see (e.g., “Input Tokens”, “GPU Hours”)
- Unit — How it’s measured (e.g., “tokens”, “hours”, “GB”)
- Aggregation — How to combine usage values over a period
How Metrics Work
Billable metrics track variable consumption through events. Perfect for:- LLM tokens processed
- Compute hours consumed
- Data transferred
- Queries executed
For fixed charges like platform fees, subscriptions, or setup costs, use Fees instead of billable metrics.
Aggregation Types
Specify how raw event values are combined when calculating usage:| Aggregation | Description |
|---|---|
sum | Total of all values in the period |
count | Number of events, regardless of value |
avg | Mean of all values |
min | Smallest value recorded |
max | Largest value recorded |
unique_count | Count of distinct values (e.g., unique user IDs) |
latest | Most recent value (useful for gauge-style metrics) |
Meter Configuration
To receive meter events, a billable metric needs three additional fields that define how it reads from the event stream:eventType
The type value your events carry. Only events with a matching type field contribute to this metric.
valueProperty
A JSONPath expression pointing to the numeric value inside the event data payload. Required for all aggregations except count.
| Path | Extracts |
|---|---|
$.tokens | Top-level tokens field |
$.usage.inputTokens | Nested field via dot notation |
groupBy
A map of dimension names to JSONPath expressions. Allows slicing usage by properties like model, region, or tier.
Multiple billable metrics can share the same
eventType. Each extracts a different valueProperty from the same events. This lets you track input and output tokens separately while sending a single event per inference.Real-World Examples
LLM Service Separate input and output for different pricing:- Metric: “Input Tokens” —
eventType: "ai.inference",valueProperty: "$.inputTokens", aggregation:sum - Metric: “Output Tokens” —
eventType: "ai.inference",valueProperty: "$.outputTokens", aggregation:sum - Metric: “Fine-tuning Hours” —
eventType: "training.job",valueProperty: "$.durationHours", aggregation:sum
- Metric: “Storage” —
eventType: "storage.usage",valueProperty: "$.gbHours", aggregation:sum - Metric: “Compute” —
eventType: "compute.usage",valueProperty: "$.vcpuHours", aggregation:sum - Metric: “Queries” —
eventType: "query.executed", aggregation:count
- Metric: “Minutes Processed” —
eventType: "video.transcode",valueProperty: "$.durationMinutes", aggregation:sum - Metric: “Bandwidth” —
eventType: "video.delivery",valueProperty: "$.transferGB", aggregation:sum
Reporting Usage
Once metrics are defined, report usage by sending meter events. See Meter Events for the full ingestion guide, including multi-dimensional metering and idempotency.Next Steps
After defining metrics:- Send meter events to start recording usage
- Create plans to group your offerings
- Set prices for each metric