NexisVoice API
Sign in

Docs Errors

One envelope for every refusal, every code the gateway can return, and how to retry each one.

The envelope

Every non-audio answer, success or failure, has the same shape:

{
  "error": {
    "type": "gateway_error",
    "code": "rate_limited",
    "message": "This key may make 30 requests per minute. Try again in a minute.",
    "hint": "Queue in the caller; the gateway is not a job system.",
    "request_id": "req_9c1f2ab7d3e4"
  }
}
  • type is gateway_error for anything this gateway refuses, and the worker's own type when an upstream error is relayed.
  • code is stable — branch on it, never on message.
  • hint appears only when there is a next step worth naming.
  • request_id matches the X-Request-Id response header and the worker log line.

Codes

code status meaning retry?
invalid_key 401 Header missing, malformed or unknown No — fix the credential
revoked_key 401 Key was revoked No — mint or rotate
rate_limited 429 Over the per-minute rate for this key Yes, after Retry-After
quota_exceeded 429 Monthly characters spent No — raise the budget or mint another key
missing_input 400 input absent, empty or not a string No
input_too_long 400 Over 3,000 characters No — split the text
invalid_json 400 Body is not valid JSON No
unsupported_media_type 415 Content-Type is not application/json No
payload_too_large 413 Body over 64 KB No
worker_busy 503 Another generation holds the GPU stream Yes, after Retry-After
worker_unreachable 503 The gateway could not open a connection to the worker Yes, with backoff
worker_failed 502 The worker answered 5xx while generating Yes, once
worker_error 4xx/5xx Any upstream error without a more specific mapping Usually no
not_found 404 No such route No

Retry policy

429 / 503      retry with exponential backoff, 1s → 2s → 4s, cap 30s
502            retry once, then treat as failed
4xx except 429 do not retry; the request is wrong

A failed generation costs no characters, so retrying a 503 is free. A 429 quota_exceeded is not retried by the gateway and should not be retried by you: the budget is a hard stop.

Reading a failure from a script

import httpx

try:
    response = httpx.post(url, headers=headers, json=body, timeout=120)
    response.raise_for_status()
except httpx.HTTPStatusError as exc:
    error = exc.response.json().get("error", {})
    raise RuntimeError(f"{error.get('code')}: {error.get('message')} "
                       f"({error.get('request_id')})") from exc

What is never in an error

  • No stack traces, no file paths, no worker URL.
  • No partial keys. The public prefix is all that is ever named.
  • No other caller's key, usage or name. A 403 from the worker is relayed as worker_error without the worker's body.

Health

curl https://tts.nexis-ai.tech/v1/health
{ "status": "ok", "worker": { "up": true, "sample_rate": 24000, "ws_port": 8081 } }

status is degraded when the gateway is up but the worker does not answer. Health needs no key and is cached for 10 seconds.