Skip to main content
FreeModel returns errors in the OpenAI-compatible envelope. error.code is the stable machine-readable value; error.type groups it.
Anthropic Messages (/v1/messages) and Gemini native (/v1beta/...) requests return the same HTTP status and message in their protocol’s own error shape (error.type for Anthropic, error.status for Gemini), without error.code.

Quick reference

400 Bad Request

Meaning: The body or parameters do not match the selected model’s contract. Common causes:
  • A seconds, resolution, aspect_ratio, or size value the model does not list
  • seconds sent to a model whose length follows a source clip
  • Missing required media, such as image_urls for an image-to-video model
  • Private, local, or non-HTTP media URLs
  • Malformed JSON or a missing model, messages, or prompt
How to fix: open the model page under API Manual, match its allowed values, and resubmit. Do not blind-retry the same payload.
Gemini Omni T2V only accepts "10", so this returns 400 with error.code unsupported_seconds.

401 Unauthorized

Meaning: Authentication failed. How to fix:
  1. Create or rotate a key under Console > API Keys.
  2. Send Authorization: Bearer <key> on every request, without quotes or extra whitespace.
  3. Keep the key on the server only.

402 Payment Required

Meaning: The gateway reserves the maximum possible charge before calling the provider. insufficient_funds means your balance cannot cover that reservation; api_key_spend_limit_exceeded means the key’s own spend limit would be exceeded. How to fix: add balance under Console > Billing, or raise the key’s spend limit. For text models, a smaller max_tokens (or max_completion_tokens) lowers the reservation.

404 Not Found

Meaning: model_not_available — the model ID is unknown, disabled, or has no live route. How to fix: call GET /v1/models with the same key and copy an ID exactly. Also confirm the protocol: a model is only served on the protocols listed on its page (for example, Gemini models answer generateContent, GPT-5 models do not).

429 Too Many Requests

Meaning: rate_limit_exceeded (request rate) or api_key_concurrency_exceeded (requests in flight on one key). How to fix: wait for the Retry-After header, then retry with exponential backoff and jitter. Cap parallel video submissions.

502 and 503

Meaning: 502 means the upstream provider failed the request or task (provider_http_error, provider_task_failed). 503 means no healthy route could take it (no_eligible_route, provider_route_unavailable). How to fix: retry with exponential backoff. For async tasks, check task status before resubmitting so you do not pay for a duplicate. Contact support with the status, time, model ID, and the x-gateway-execution-id or task ID — never the API key.

Retry safely

Log the HTTP status, x-gateway-execution-id, and the complete error object. Do not log API keys or sensitive prompt content.