Errors and retries
Public errors are provider-neutral. Use the HTTP status, error.code, and request ID.
01
Error envelope
json
{
"error": {
"type": "gateway_error",
"code": "capacity_limited",
"message": "GateYourWay capacity is temporarily limited. Please retry later."
}
}For diagnosable inference responses, X-GYW-Request-ID links the client error to the server record.
02
Retry matrix
| HTTP | Code / class | Retry | Action |
|---|---|---|---|
| 400 / 422 | invalid_request | No | Fix the body, parameters, or model ID. |
| 401 | Key error | No | Check the header and key state. |
| 402 | Insufficient balance | After top-up | Add balance. |
| 403 | Scope or access | No | Use the correct key/group. |
| 404 | model_not_found | No | Refresh the model catalog. |
| 410 | model_retired | No | Move to the indicated replacement. |
| 429 | capacity_limited | Yes | Exponential backoff with jitter. |
| 502 / 503 / 504 | route_unavailable | Yes | Use a short bounded retry. |
03
Backoff
Start at 500-1000 ms, double the delay, add random jitter, and cap the number of attempts. Do not retry after the client has received useful streaming output.