credits.charged. If the wallet cannot cover a
request, the API returns 402 insufficient_credits with the required and
available amounts when available.
Use an idempotency key for every generation. A safe retry with the same key and
body returns the existing request instead of creating another charge.
Budget a batch
Read the current balance once before a batch, compare it with the catalog’scredit_estimate, and still handle 402 on submission because another request
can use credits in the meantime.
FAILED, its generation charge is restored. Poll the request or consume its
webhook before reconciling a final batch cost.
credit_estimate helps with planning, while credits.charged on the request
is the authoritative amount for that generation.