The Monetization APIs are in preview and subject to change. Features and endpoints documented here may be modified as we refine the service based on customer feedback.
Meters aggregate usage data from your API. They watch for specific event types, extract numeric values, and sum them over configurable time windows.
How Meters Work
A meter is configured with:
- Event type - Which events to process (e.g.,
api_request,completion) - Value property - JSONPath to extract the numeric value from event data
- Aggregation - How to combine values (typically
SUM)
When events are ingested, the meter matches events by type, extracts the specified value, and aggregates it per customer over time.
Common Examples
API Request Counting
Track the total number of API requests per customer:
Code
Each api_request event should include a count field (typically 1), as
shown below:
Code
Token Usage
Track LLM token consumption for AI applications:
Code
Report token usage after each completion:
Code
Data Transfer
Track bytes transferred:
Code
Creating a Meter
Code
API Reference
For complete API operations (list, get, update, delete), see the Meters API Reference.