Check the HTTP status first, then read error.message or message in the response. Error formats may differ by protocol and upstream channel.
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid request | Check the model, required fields, and parameter types. |
401 | Authentication failed | Check the API key, expiration, quota, and authentication header. |
403 | Access denied | Check account status and access permissions. |
404 | Not found | Verify the API host, endpoint path, and model ID. |
429 | Rate limit or quota exceeded | Read the error, reduce concurrency, or check balance and quota. |
500 / 502 / 503 | Service or upstream unavailable | Retry later. If failures persist, contact support with request details. |
Use bounded exponential backoff with jitter for temporary network errors, rate limits, and service unavailability. Honor Retry-After when present. Fix invalid parameters or credentials before retrying.
A timeout does not guarantee that the upstream did not execute the request. Retrying image or audio generation may incur additional charges; check usage logs first.
- Record the request time, model ID, HTTP status, and full error message.
- Review account balance, key limits, and request logs in the console.
- Remove API keys and sensitive input before sharing a request example.
- Streaming requests may fail after HTTP 200. Handle error events inside the stream as well.