Customizable backoff retry logic for failed AI provider requests
Create your configuration
ai-gateway-config.yaml
with basic retry configuration (3 retries with 50ms constant delay):Start the gateway
Test retries
Request Fails
Wait Period
Retry Request
Repeat or Return
Condition | Retried? | Reason | Examples |
---|---|---|---|
5xx Server Errors | ✅ Yes | Temporary provider issues | 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout |
Network Transport Errors | ✅ Yes | Connection/network problems | Connection refused, timeouts, DNS failures, TLS handshake errors |
Stream Interruptions | ✅ Yes | Streaming response failures | Stream ended unexpectedly, transport errors during streaming |
4xx Client Errors | ❌ No | Request format/auth issues | 400 Bad Request , 401 Unauthorized , 403 Forbidden , 404 Not Found , 422 Unprocessable Entity |
429 Rate Limits | ❌ No | Handled by load balancing | Provider temporarily removed from rotation based on Retry-After header |
2xx Success Responses | ❌ No | Request succeeded | 200 OK , 201 Created , 202 Accepted |
Auth/Config Errors | ❌ No | Setup/configuration issues | Invalid Helicone API keys, missing auth headers, provider not configured |
Cache/Storage Errors | ❌ No | Persistent storage issues | Cache operation failures, malformed request/response bodies |
retries
section to individual router configurations.