Skip to main content
Router serves the first candidate that answers, so a rate limit or an outage at one provider falls through to the next instead of failing the run. Candidates are the catalog_id values from GET https://api.router.com/v1/models, optionally suffixed with a service tier.
fallback.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your API keys

4

Run the example

Save the code above as fallback.py, then run:
Full source: cookbook/90_models/ramp/fallback.py