latestOpenAPI 3.1.02026-08-211061591.1 MB

69a962f1578f

Billing

Usage Billing State

Read the caller's usage-billing credit state for a product.

get/api/v1/usage_billing/state

Query parameters

productstring

Product whose credit state to read.

Example:automations

Response

Successful Response

available_unitsinteger required

Balance net of in-flight holds (available_cached - held). The ledger unit, kept for support and reconciliation; display available_amount instead. Not a permission to start a run: use usage_allowed for that.

available_amountinteger required

available_units in money, in microdollars (millionths of one currency unit), so 8372600 is $8.3726. The scale is exact for every amount this API reports; cents and hundredths of a cent both truncate a single chat message to zero. Converted by the server because the client cannot: the ratio is the account's pinned price and only the backend holds it.

currencystring required

ISO currency code every amount in this response is in. Fixed for the life of the account: the first top-up pins the price, and the price fixes the currency.

usage_allowedboolean required

Whether a new run may start right now.

low_balanceboolean required

Balance is at or below the low-balance threshold.

depletedboolean required

No further runs may start. Equivalent to usage_allowed being false; can be true while available_units is still positive, because the floor holds back one run's worth.

Example response

{
  "available_units": 4186300,
  "available_amount": 8372600,
  "currency": "usd",
  "usage_allowed": true
}