200 OK | The request succeeded. A streaming request may also return 200 when the connection opens. | Read the response; for streams, handle subsequent data and errors during the stream. |
201 Created, 202 Accepted, 204 No Content | A resource was created, an asynchronous task was accepted, or the request succeeded without a response body. Usage depends on the endpoint. | Follow the endpoint documentation to read the resource, poll the task, or finish without parsing a JSON body. |
400 Bad Request | Invalid body, parameters, or model options. Some 400 errors are passed through from upstream. | Check JSON, required fields, parameter values, and model support; correct the request using error.message. |
401 Unauthorized | Missing, invalid, or expired API key. | Check Authorization: Bearer <API_KEY> and confirm the key is valid. Repeating the same request will not fix authentication. |
402 Payment Required | Some endpoints or upstream providers may use this for insufficient balance or quota. | Check your balance, subscription, and token quota. Use the actual status and error returned by the endpoint. |
403 Forbidden | Your account, group, model, token, or source IP lacks access. It can also indicate insufficient balance or subscription quota. | Check error.code and the message, then review permissions, allowed IPs, balance, and quota. insufficient_user_quota indicates insufficient quota. |
404 Not Found | The path or resource does not exist. Some upstream providers may also use it for an unknown model. | Verify the path, resource ID, and model name. The gateway may instead return 503 when no model channel is available. |
408 Request Timeout, 504 Gateway Timeout | Request processing or an upstream response timed out. | Review the client timeout. Before retrying, check whether the task was already created to avoid duplicates. |
413 Content Too Large | The request body exceeds an endpoint limit. | Reduce the file or body size and check the endpoint’s limits. |
422 Unprocessable Content | Some endpoints or upstream providers accept the request format but cannot process its content, such as input that fails validation. | Adjust the input using the error message and the endpoint’s rules. |
429 Too Many Requests | A platform, model, or upstream rate limit was reached. | Honor Retry-After if present; otherwise reduce the request rate and use exponential backoff. |
500 Internal Server Error | Server-side processing failed. | Retry a limited number of times later. If it persists, provide the request ID and time. |
502 Bad Gateway | The gateway or upstream returned an invalid response. | Retry a limited number of times later and check upstream availability. |
503 Service Unavailable | No model channel is available for the current group, or an upstream service is unavailable or rate limited. | Verify the model name and group access first. Retry later for a temporary limit or outage. |