Events, meters, and features
Use
eventSlug for the action and properties for its measured values. Use featureSlug when
checking or consuming one specific feature.
One asynchronous event can update several matching feature meters:
aiMessages while an output-token meter sums outputTokens.
Configure each usage feature with its event slug, aggregation method, and aggregation field.
Aggregation methods
sum, max, and last need an aggregationField. count counts events rather than reading a
numeric field. Retries of the same event must use the same idempotencyKey.
Quota resets and billing periods
A quota window controls when a customer’s usage allowance resets. A billing period controls when charges are invoiced. These can differ, for example a daily allowance on a monthly subscription. Configure the feature’s reset cadence separately from its billing cadence. Do not assume that an invoice date also resets every usage limit. Useaccess.check to inspect current usage, limit, and quotaWindow. The window contains
startAt, endAt, and periodKey; timestamps use epoch milliseconds. A null endAt means the
window has no end. A null quotaWindow means active grants do not share a single reset window.
Use usage analytics for historical reporting, not as a live spend gate.
Report usage or authorize work
- Use
usage.recordafter an action when you need asynchronous metering and evidence. It does not prevent over-budget work. - Use
usage.consumebefore an action when its usage amount is already known. Checkallowedbefore starting the work. - Use a budgeted run when the final amount is unknown before work starts. Reserve first, then settle actual usage when the workload finishes.
access.check does not consume an allowance or reserve money. Two concurrent requests
can both pass a read-only check. Use an enforcing operation for spend control.
Report resource snapshots
For resources such as active seats or stored bytes, report the absolute value from your own system. Configuremax to track the highest reported value or last to track the latest one.