@radzor/usage-metering
Track and bill usage-based metrics. Record usage events against named meters, query usage summaries over time periods, and trigger threshold alerts for overage billing.
Paymentv0.1.0typescriptpythonServerusagemeteringbillingconsumptionpay-per-usesaasby Radzor
Install
View source on GitHub →$npx radzor@latest add usage-metering
⚠ Constraints: In-memory storage is not persistent across restarts. For production, use 'stripe' backend with a valid Stripe secret key. Meters must be created before recording usage. Threshold events fire once per threshold crossing per period.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| secretKey | string | — | Stripe secret API key for reporting metered usage to Stripe Billing.STRIPE_SECRET_KEY |
| flushIntervalMs | number | 60000 | Interval in milliseconds for flushing batched usage records. |
| storageBackend | 'memory' | 'stripe' | memory | Where to store usage records. 'memory' for local tracking, 'stripe' to also report to Stripe Billing. |
secretKeystring
Stripe secret API key for reporting metered usage to Stripe Billing.
STRIPE_SECRET_KEY
flushIntervalMsnumber
Interval in milliseconds for flushing batched usage records.