Skip to content
会nokai.studio

Going to production

nokai.studio is a managed API -- there is nothing to deploy, scale, or operate on your side. Going live is a short checklist on your end.

1. Get a production API key

In the dashboard, open API Keys -> New key and create a key for production. Store it as a server-side secret. Do not ship it in client-side code. See Authentication.

2. Check your credit balance

Generation costs credits. Make sure you have enough before running in production:

curl -s https://nokai.studio/api/v1/balance \
  -H "Authorization: Bearer $NOKAI_KEY"

Top up at the dashboard (Billing -> Add credits) via Stripe if needed.

3. Set up webhooks (recommended)

Register a webhook endpoint to receive job completions without polling:

curl -s https://nokai.studio/v1/webhook-endpoints \
  -X POST \
  -H "Authorization: Bearer $NOKAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourapp.com/webhooks/kinokai",
    "events": ["job.completed", "job.failed", "credits.low_balance"]
  }'

Verify the X-Webhook-Signature on every incoming request. See Webhooks -> Signature verification.

Ack fast -- return 2xx within a few seconds and process async. Non-2xx responses are retried with exponential backoff up to 6 attempts.

4. Handle events idempotently

Webhooks are at-least-once. Dedupe by event_id:

async function handleWebhook(req) {
  const { event_id } = req.body;
  if (await alreadyProcessed(event_id)) return res.sendStatus(200);
  // do work
  await markProcessed(event_id);
}

See Idempotency.

5. Know your limits and errors

  • Rate limits -- see Rate limits.
  • Error handling -- see Errors.
  • Job failures -- match on failCode, not failMsg. Retry TIMEOUT and PROVIDER_ERROR; do not retry CONTENT_POLICY or INVALID_MODEL.

That is the whole checklist. No servers, no migrations, no queues to operate.