1000000 = $1.00).
Allowance storage is OpenMeter-backed, not a Postgres wei ledger. Reads use OpenMeter entitlement APIs; grants call OpenMeter
createGrant. OPENMETER_URL must be configured.Authentication
All allowance endpoints use M2M HTTP Basic auth:clientId in the path. Mismatches return 404.
Read allowances
SDK:
Grant a manual top-up
Add additional USD micro balance on top of the user’s existing subscription allowance:
Grants are additive on top of the Starter subscription’s included usage — they do not replace it.
Check real-time access balance
For a lightweight gate check before allowing a user action that consumes entitlement:Starter plan entitlement
Every app has a Starter plan with a defaultincludedUsdMicros allowance (typically 5000000 = $5.00). New users are automatically subscribed to the Starter plan when provisioned, and the Starter allowance is the baseline grant for every new user.
Providers update the Starter allowance via:
User subscription status
Read the full OpenMeter subscription state for a user (plan, period, status):Error responses
Key design decisions
- OpenMeter-authoritative. Allowance balances are never stored in Postgres. All reads and grants go through OpenMeter entitlement APIs, keeping the billing source of truth consistent with metering.
- Additive grants.
POST /allowancescalls OpenMetercreateGranton top of the existing Starter subscription — it does not replace or reset the subscription’s included usage. - Separate
balanceendpoint.GET .../usage/balanceis a lightweight gate check that returns onlyhasAccessand balance totals, suitable for pre-request checks without pulling full allowance detail.
Implementation tasks
- Call
getUsageBalance()(orGET .../usage/balance) before dispatching signed requests to checkhasAccess. - Use
grantUserAllowance()(orPOST .../allowances) withsource: "manual"for one-time top-ups (e.g. support credits, promotional credits). - Use
source: "promo"orsource: "trial"for time-limited promotional grants when your billing flow distinguishes them. - Poll
GET /allowancesfor the full grant history when building a user billing detail view.