Docs Guides
Guide

HTTP Status Codes

When calling API you will see standard HTTP status codes in addition to business JSON fields such as `success` / `code`. Common meanings and what to do:

When calling API you will see standard HTTP status codes in addition to business JSON fields such as success / code. Common meanings and what to do:

2xx Success

CodeMeaningNotes
200OKSuccess. Async submit often returns 200 too — you still need to poll the task
201CreatedResource created (uncommon; follow the specific API doc)

4xx Client errors

CodeMeaningTypical causeAction
400Bad RequestMissing/invalid params, bad JSONCheck body / query against the OpenAPI
401UnauthorizedBad/expired key, missing AuthorizationVerify Bearer sk-... and token status
403ForbiddenNo permission, model/group limits, IP denyCheck model limits, group, allow_ips
404Not FoundWrong path, missing task/resourceCheck Base URL + path; confirm task_id
408TimeoutClient or gateway timeoutShrink payload, retry, or use async APIs
429Too Many RequestsRate limitedBack off; lower concurrency

5xx Server / upstream

CodeMeaningAction
500Internal Server ErrorRetry later; if persistent, report with request_id / task id
502 / 503 / 504Bad gateway / unavailable / timeoutExponential backoff; reduce concurrency at peak

Troubleshooting tips

  • If the body starts with < (HTML), the Base URL or path is usually wrong.
  • Some business errors still return HTTP 200 with the error in JSON message / error — follow each platform OpenAPI.
  • Async: submit success ≠ generation success. See Async Task Guide.