API Docs
Credits
Read balance and understand reservations
Read the balance
GET /api/v1/credits requires credits:read and returns only the available
integer balance.
curl https://sci-draw.com/api/v1/credits \
-H 'Authorization: Bearer sd_YOUR_KEY'{ "success": true, "data": { "balance": 125 } }Reservation lifecycle
Credits are reserved atomically when a job is first accepted. This prevents two concurrent requests from spending the same balance. A repeated idempotent request reuses the original reservation.
- Successful jobs settle the exact reserved amount once.
- Terminal failures release the exact original credit allocations.
- Retried internal work does not create a new reservation.
credits_reservedandcredits_consumedare visible on every job.
If the available balance is too low at job creation, the API returns HTTP 402
with INSUFFICIENT_CREDITS; no job or reservation is created.

API Docs