Metered Usage
Report usage after each chargeable operation and handle limits and credit overage.
If your plugin sells metered capacity (API calls, image generations, translations), report usage after each chargeable operation so limits and billing stay accurate.
Report usage
The response tells you where the customer stands:
| Field | Meaning |
|---|---|
allowed | Whether this operation is permitted |
remaining | Units left this period |
resetAt | When the counter resets |
Check-then-do pattern
Report (and decrement) before doing expensive work, so you never perform an operation the customer can't pay for:
Credit overage
Set consumeCredits: true to let the operation dip into the customer's credit
balance once the plan limit is exhausted:
Within plan limit
Usage counts against the monthly cap as normal.
Over the limit, with credits
Credits are deducted and allowed: true is returned.
Over the limit, no credits
allowed: false — show an upgrade/buy-credits prompt.
See Billing & Credits for how credit packs are purchased and tracked.
Choosing metric keys
- Use stable, lowercase, snake_case keys (
api_requests,image_generations). - Keep the set small and meaningful — each maps to a limit in your plan config.
- Don't rename keys after launch; historical usage is bucketed by key.