Getting started

One key for the speech API, studio endpoints for signed-in apps, and every render C2PA-sealed. Keys are created on the Developers screen in the app.

GET/api/healthz

Service health

A minimal liveness check. Dependency and deployment details are available only to authenticated operators.

curl
curl https://api.regalabs.dev/api/healthz
response
{ "ok": true }

Authentication

One header, one key. Keys are created on the Developers screen and spend your account's paid credits — subscription or purchased — from the same balance as the app. Free plan credits cannot be spent through the API.

ParameterTypeRequiredDescription
AuthorizationBearer rega_live_…yesThe key. A malformed or revoked key is 401 before anything else runs.
Idempotency-Keystring ≤ 160yesRequired in production on every paid generation. Replaying the same key returns the first response instead of charging twice.
Content-Typeapplication/jsonyesEvery machine request carries a JSON body.

What a key can reach

A key authenticates the speech API (/v1/audio/speech, /v1/audio/transcriptions, /v1/audio/stream) and POST /api/v1/generate. The other routes on this page are app routes: they authenticate with the signed-in session cookie, not a key.
POST/api/v1/generate

Generate — the machine API

Third-party image and video generation. Spends your account's paid credits. Requires an administrator to have enabled a provider on the account first; with none configured this returns 400.

ParameterTypeRequiredDescription
kindimage | videoyesWhat to make. The provider must support it.
providerIdstringyesA public generation provider. Ask an admin which are enabled for your account.
promptstringyesWhat to generate.
durationSecondsnumbernoVideo only. Billed by the second at 250 credits a minute — a ten-second clip costs ten seconds, not a minute.

An image generation is a flat 2 credits per call, regardless of size or provider.

curl
curl -X POST https://api.regalabs.dev/api/v1/generate   -H "Authorization: Bearer rega_live_…"   -H "Idempotency-Key: $(uuidgen)"   -H "Content-Type: application/json"   -d '{
    "kind": "image",
    "providerId": "your-provider",
    "prompt": "a rooftop in Hewlêr at dusk"
  }'

202 means submitted, not finished

A provider that works asynchronously answers 202 with a job id. The credits are already spent at that point.

No provider configured yet

RegaLabs hosts no image or video generation model of its own. Until an administrator enables a third-party provider on this account, every call here returns 400 with a message saying so — this is not a bug.

Error contract

Errors always carry a machine-readable code and a human message.

error codes
{
  "SIGN_IN_REQUIRED":          "Identity-bound operations need a session.",
  "ACCOUNT_BANNED":            "Account is no longer active.",
  "STUDIO_CLOSED":             "The studio is closed for maintenance.",
  "VOICE_CLONE_LIMIT_EXCEEDED": "One clone per account — deepfake shield.",
  "CREDITS_EXHAUSTED":         "Not enough credits for this generation.",
  "IDEMPOTENCY_KEY_REQUIRED":  "Paid generations need an Idempotency-Key header.",
  "IDEMPOTENCY_KEY_REUSED":    "That key was used for different content.",
  "COUPON_APPLIES_AT_CHECKOUT": "A percent code comes off the price, not the balance.",
  "COUPON_ALREADY_REDEEMED":   "Code already used on this account."
}

Local dev

Run npm run stack and hit http://127.0.0.1:8787/api/v1/* directly — the gateway proxies the signed inference channel for you.