- A Stigg server API key.
- A credit type
currency-ai-creditsand a customercustomer-demo-01with a credit grant. See Set up credits. - A client, if you use an SDK. Reservations need TypeScript SDK
0.1.0-beta.62or Python SDK0.1.0-beta.53or later. See Availability for other languages.
1
Reserve credits
Call the entitlement check with When the balance covers the amount, the response grants access and includes the reservation. The reservation expires after one hour by default. If the operation can take longer, pass
reserveAmount, the most the operation can cost, and a reservationId that identifies the operation. Stigg checks the balance and holds the credits in one step.currentUsage now includes the 100 held credits. The response below is abbreviated.reservationTtlSeconds (up to 86400) or reservationExpiresAt (up to 24 hours ahead).2
Handle denied access
When the balance does not cover the amount,
isGranted is false, accessDeniedReason is InsufficientCredits, and nothing is held. Block the operation or offer a top-up.3
Run the operation and settle
Run the operation, calculate the credits it used, and release the reservation with that amount. The release endpoint settles the reservation: Stigg consumes the amount and returns the rest to the customer’s credit balance. If the operation fails, release with The response returns the released reservation and the updated balance:If a request fails, retry it with the same
consumedAmount: 0.reservationId. Both the reservation and the release are applied once.4
Review the ledger
In the Stigg app, go to Customers → customer-demo-01 → Credits and open the Ledger tab. The reservation appears as Credits reserved (-100), followed by Reservation released (+60). Expand the release to see the Hold returned (+100) and Usage (-40) entries, or click
job-123 to show only this reservation’s events.