Skip to content
会nokai.studio

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 }
FieldTypeRangeNotes
amountUsdnumber0-10000USD 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

StatusMeaning
400Validation error (e.g. amount out of range).
401Not authenticated.
503Payment 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.