Billing
nokai.studio uses prepaid credits. Add credits via Stripe Checkout. Credits never expire.
Auth: Session auth (dashboard) required for checkout. API key accepted for balance reads.
POST /api/v1/billing/checkout-session
Create a Stripe Checkout session to add credits.
Request body
{ "amountUsd": 25.00 }| Field | Type | Range | Notes |
|---|---|---|---|
amountUsd | number | 0-10000 | USD amount to add. |
Response 200
{ "checkoutUrl": "https://checkout.stripe.com/pay/cs_live_..." }Redirect the user to checkoutUrl. After successful payment, credits appear on the account within seconds.
Errors
| Status | Meaning |
|---|---|
400 | Validation error (e.g. amount out of range). |
401 | Not authenticated. |
503 | Payment provider unavailable -- retry. |
GET /api/v1/billing/balance
Returns the credit balance. Identical data to GET /api/v1/balance but requires session auth.
Response 200
{
"customerId": "cust_uuid",
"balanceUsdMicro": 5000000,
"lowBalanceThresholdUsdMicro": 1000000
}balanceUsdMicro / 1_000_000 = balance in USD.
Low-balance notifications
When your balance drops below lowBalanceThresholdUsdMicro, the API server fires a credits.low_balance webhook event. Register a webhook endpoint with that event to receive automated alerts.
See Webhooks -> Payloads for the credits.low_balance payload shape.