Repository navigation
v4.133.0
Prepaid metered usage under one cap
A hobby or team organization can now turn its pooled quotas into prepaid metered usage. Storage and vault bytes above the lease's included pools cost a published price per GB-month (prorated by the UTC day), API calls above the included amount a price per million, charged once a day from the organization's allowance and never past one monthly cap you set. A day the allowance or the cap cannot cover is not charged: metering suspends, nothing is deleted, everything keeps serving on the flat pool, and it resumes on the next covered pass. There is no invoice and no post-paid charge.
The same cap bounds a card standing order: save a card once through a setup link, and the card refills the allowance when it falls below a threshold, up to the cap's remaining room for the month. Three declines turn the order off.
SDK (@run402/sdk)
r.billing.getMetering(orgId): the metering block (cap, month spent, headroom, suspension, standing order, saved card as brand, last four and expiry).r.billing.setMetering({ organizationId, enabled, capUsdMicros, standingOrder }): enable or disable metering, set the cap, and turn the standing order on or off with its threshold and recharge amounts.r.billing.createCardSetup(orgId, { returnUrl }): a one-time browser link that saves a card for the standing order.TierStatusResultgainsmeteringandpool_usage.*_included;QuoteResultgainsmeteredwith the published prices.
CLI (run402)
run402 billing metering [<org_id>] [--enable --cap <usd> | --disable] [--standing-order on|off] [--threshold <usd>] [--recharge <usd>]: show or change the setting; dollar flags take whole or decimal dollars.run402 billing card setup [<org_id>] [--return-url <url>]: print the setup link.
MCP (run402-mcp)
- Reachable through
runas the SDK methods above; the setup link is a one-time link, not a secret, so it stays on the sandbox surface.
Platform
PATCH /orgs/v1/:org_id/billing/meteringandPOST /orgs/v1/:org_id/billing/payment-methods/setup; ameteringblock onGET /tiers/v1/statusandGET /orgs/v1/:org_id/billing;meteredprices onGET /tiers/v1;metered_usageandstanding_order_chargerows in billing history.- A quota refusal on a metered organization names the remedy:
fund_allowanceandraise_metering_capahead ofrenew_tier, withdetails.metering. - Four events:
metering_cap_nearing(once a month at 80% of the cap),metering_suspended,metering_resumed,standing_order_failed.