Skip to main content
Each meter uses one aggregation type to collapse all usage events in a billing period into a single billable number.

SUM

Adds all event values together. When to use: Counting discrete actions — API calls, messages sent, tasks executed, tokens generated.
Events: 100, 250, 50, 600
SUM = 1,000
SDK tracking:
{
  "meter_token": "...",
  "customer_external_id": "cust_123",
  "quantity": 100
}

MAX

Takes the highest single value observed during the period. When to use: Peak capacity measurements — max concurrent connections, peak storage used at any point, highest queue depth.
Events: 15, 42, 7, 38, 55, 12
MAX = 55
SDK tracking:
{
  "meter_token": "...",
  "customer_external_id": "cust_123",
  "quantity": 55
}

UNIQUE_COUNT

Counts the number of distinct values of a specified property. When to use: Monthly active users, unique API consumers, distinct items processed, unique devices.
Events (user_id property): user_a, user_b, user_a, user_c, user_b
UNIQUE_COUNT = 3 (user_a, user_b, user_c)
For UNIQUE_COUNT meters, the SDK endpoint reads user_id from the event metadata. Make sure to include it:
{
  "meter_token": "...",
  "customer_external_id": "cust_123",
  "quantity": 1,
  "metadata": {
    "user_id": "end_user_456"
  }
}

LAST

Takes the most recent event value received during the period. When to use: Snapshot-based billing — current storage GB, current number of active seats, current record count.
Events (with timestamps):
  10:00 → 50 GB
  14:00 → 75 GB
  18:00 → 60 GB
LAST = 60 GB
SDK tracking (send current state periodically):
{
  "meter_token": "...",
  "customer_external_id": "cust_123",
  "quantity": 60,
  "timestamp": "2025-01-15T18:00:00Z"
}

Choosing the Right Aggregation

Use CaseRecommended Type
API call billingSUM
Data transferredSUM
AI token usageSUM
Monthly active usersUNIQUE_COUNT
Storage billing (current)LAST
Seat-based billing (peak)MAX
Concurrent connection peakMAX
Messages processedSUM
Inference requestsSUM