metered products.
The credit balance object
Unique identifier for this balance record.
The customer this balance belongs to.
The product this balance is tied to.
Current available credits.
Total credits consumed to date.
Total credits granted to date.
ISO 8601 timestamp.
ISO 8601 timestamp.
Get balance
GET /customers/{customer_id}/credits/{product_id}
Returns the current credit balance for a customer on a given product.
Ingest usage
POST /customers/{customer_id}/credits/{product_id}/transaction
Deduct, refund, or grant credits. Pass dry_run: true to check if the customer has enough credits without committing anything.
Body
Raw usage amount in the product’s native unit (e.g. tokens, requests). Converted to credits automatically based on the product’s
units_per_credit setting.One of
deduct, refund, or grant.If
true, checks credit sufficiency without making any changes. Returns is_sufficient and remaining_balance instead of the normal response.Optional description of why this transaction occurred.
Arbitrary key-value data to attach to the transaction.

