Skip to main content
The API returns errors as JSON with an error code and a human-readable message.

Error Format

Errors

unauthorized (401)

The API key is missing, malformed, invalid, or revoked.
Fix: Send a valid, non-revoked key via Authorization: Bearer sk_996_... (or ?api_key= for WebSockets).

invalid_json / missing_transcript (400)

The request body is malformed or missing required fields. Common causes:
  • Invalid JSON body
  • Missing transcript, voice, model_id, or output_format

Invalid output_format (400)

The output_format uses an unsupported container, encoding, or sample_rate. Validation is strict — there’s no silent fallback. The message names the offending field. Common causes:
  • Removed formats: container: "mp3", encoding: "pcm_f32le"
  • Unsupported sample_rate (only 8000, 16000, 22050 are allowed)
  • container: "wav" on a streaming endpoint (/tts/sse, /tts/websocket are raw-only)
Fix: Use a supported combination — see Create Speech → Output Format.

payment_required (402)

The organization’s credit balance can’t cover the request.
Fix: Top up on the Billing page.

rate_limited / concurrent_limit (429)

You’ve exceeded your org’s per-minute request rate or concurrency cap (shared across all your API keys). See Rate Limits. Fix: Honor the Retry-After header and retry. For concurrent_limit, retry the rejected turn on a fresh context_id — only that context was rejected, not the whole connection.

billing_unavailable (503)

Credits couldn’t be verified, so the request fails closed (no audio is generated and you aren’t charged). Fix: Retry shortly.

upstream_unavailable (502)

The synthesis backend errored. Any pre-charge is refunded automatically. Fix: Retry the request. If it persists, contact support.

Handling Errors in Code