Failover
Failover is used to try other available channels when the primary channel times out, returns a 5xx response, triggers rate limiting, or fails a health check. Whether automatic retries occur and how many times they are attempted depends on the platform configuration and API type. Applications must not assume that every failure will automatically trigger a switch.
Configuration Recommendations
- Configure at least two available channels for critical models to avoid a single upstream point of failure.
- Assign lower priorities or weights to unstable channels, and regularly review their failure rates and latency.
- Set reasonable rate limits for models, tokens, and channels to prevent retries from amplifying traffic.
- For applications sensitive to output formats, keep the model version and channel fixed whenever possible to reduce upstream differences.
- Retry only idempotent requests or requests for which retries are explicitly allowed; once a streaming response has started, do not blindly submit the request again.
Application Strategies During Failures
- Record the original Request ID, status code, and reason for failure.
- Retry 429, 502, 503, and 504 responses with exponential backoff, and set a maximum number of attempts.
- If retries continue to fail, switch to a backup model or return an understandable fallback message.
- For insufficient balance, invalid tokens, insufficient permissions, and parameter errors, do not retry repeatedly; correct the configuration directly.
