Error Codes & Troubleshooting
Use the HTTP status and error body to diagnose failures. Once a stream opens, inspect its SSE events and completion signal.
On this page
| Status | What to do |
|---|---|
400 | Check the JSON, required fields, parameter types and request format. |
401 | Check that the request carries an active platform key in the correct header. |
402 / 403 | If the error indicates insufficient funds, check your wallet balance. For access restrictions, check the key status, model permissions, and error message. |
404 | Check the host, HTTP method and path, including that /v1 is not repeated (for example /v1/v1/messages). The gateway accepts paths with and without /v1. If the model was not found, check GET /v1/models. |
413 | The request body is too large. Shorten the conversation history or reduce the input text before retrying. |
429 | Reduce request rate or concurrency. Wait for Retry-After when present, or back off between attempts. |
5xx | The service may be unavailable or timed out. Check the original call and usage history before retrying with bounded backoff. |
JSON errors typically include error.message and may also have error.code and error.type. Branch on the status and then read the available error fields.
Errors can arrive inside an open SSE stream. Handle the protocol’s error events and keep the partial output and request details if the connection closes early.
JSON
{
"error": {
"message": "Invalid API key"
}
}- Start with the endpoint’s curl example and a short text prompt to check the base URL, key and model.
- Send support the request time and time zone, model ID, path, HTTP status and any available request ID. Remove your API key before sharing logs.
Include the x-request-id response header when reporting an issue, if available. It identifies the request on this platform.