All errors use OpenAI’s envelope:
{ "error": { "message": "...", "type": "...", "code": "..." } }.400 — Bad request
Your request body is malformed, an unknown model was requested, or a required field is missing.message field is safe to surface in your UI.
Prompt longer than the context window
A prompt above the model’s context window is refused with a 400 before any tokens are generated, so you are not billed for it. The message comes from the serving engine, which names the limit and what you sent:context_length on GET /v1/models
(see model discovery) — because a
model’s window can change when we move it to different hardware. Note that the
window covers the prompt and the completion together: if you ask for
max_tokens on top of a prompt that nearly fills the window, the request can
still be refused.
401 — Unauthorized
Missing, malformed, or revoked API key.Authorization: Bearer sk-… header. If the key is correct, it may have been revoked — generate a new one from the dashboard.
402 — Payment required
Your account’s credit is exhausted.404 — Not found
Typically a stale model id or an unknown video job id.429 — Too many requests
You exceeded the per-key requests-per-minute ceiling. The response includes these headers:Retry-After. If you consistently hit the ceiling, request a tier upgrade from support@flex.ai.
500 — Internal server error
Unexpected failure in our gateway or an upstream model backend.503 — Service unavailable
A specific subsystem is temporarily offline (e.g., a model under maintenance, or the playground disabled). What to do: retry later. Themessage explains which subsystem.