except openai.RateLimitError handlers keep working. The original error is chained as __cause__.
Exceptions
All of them are importable from
routehub or routehub.exceptions.
Timeout is not a routehub.APIConnectionError, and ServiceUnavailableError is not a routehub.InternalServerError. Catch openai.APIConnectionError or openai.InternalServerError to cover both.Retries
RouteHub retries rate limits, 5xx errors, timeouts and connection failures twice by default, with exponential backoff that honoursretry-after. Set num_retries= per call, or num_retries=0 to handle every failure yourself.
Fall back to another model
RouteHub has nofallbacks argument. Catch the error and call the next model: