Meters
Beta
API Monetization is in beta and free to try. The APIs are stable but should be evaluated in non-production environments first. To go to production, contact sales@zuplo.com. Production pricing has not yet been announced.
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.,
requests,tokens) - Value property - JSONPath to extract the numeric value from event data.
Events use
$.totalas the standard value property. - 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 subscription over time.
Common Examples
API Request Counting
Track the total number of API requests:
Code
Each event identifies the subscription being metered, the actor that drove the
consumption, and how much to record. The subscription field carries the
subscription ID, the subject field identifies the actor, and data.total
carries the quantity:
Code
subject identifies who consumed the subscription's entitlements on this
request — typically the API key's consumer name, the end-user id, or another
stable per-actor identifier. It is not the subscription id (use the
subscription field for that) and is not used to route billing. Its purpose is
to let you break down usage within a subscription so you can see which key,
user, or agent drove the consumption — a single subscription will commonly emit
events with many different subject values. See
Monetization Policy for how usage is recorded.
Token Usage
Track token consumption for AI applications:
Code
The meter aggregates events from the gateway; the per-request quantity comes
from the MonetizationInboundPolicy. Set a fixed cost per request in the
policy's meters option, or call
MonetizationInboundPolicy.setMeters
from a custom outbound policy to report a value derived from the response — for
example, the actual token count an LLM returned. An event for a request that
consumed 50 tokens looks like this:
Code
Data Transfer
Track bytes transferred:
Code
Each event reports the number of bytes transferred:
Code
Naming Consistency
The meter eventType must match the key used in three places:
- The meter's
slugandeventType - The key in the monetization policy's
metersconfiguration - The
featureKeyon the plan's entitlement
If these don't match, usage is not tracked correctly against the subscription's entitlements.
Creating a Meter
Code
API Reference
For complete API operations (list, get, update, delete), see the Meters API Reference.