Model Routing
Multi-model routing is in beta. OpenRouter provides two options today:
- The Auto router, a special model ID that you can use to choose between selected high-quality models based on your prompt, powered by NotDiamond.
{ "model": "openrouter/auto", ... // Other params }
The resulting generation will have model
set to the model that was used.
- The
models
array, which lets you automatically try other models if the primary model's providers are down, rate-limited, or refuse to reply due to content moderation required by all providers:
{ "models": ["anthropic/claude-3.5-sonnet", "gryphe/mythomax-l2-13b"], ... // Other params }
If the model you selected returns an error, OpenRouter will try to use the fallback model instead. If the fallback model is down or returns an error, OpenRouter will return that error.
By default, any error can trigger the use of a fallback model, including context length validation errors, moderation flags for filtered models, rate-limiting, and downtime.
Requests are priced using the model that was used, which will be returned in the model
attribute of the response body.
If no fallback model is specified but route: "fallback"
is included, OpenRouter will try the most appropriate open-source model available, with pricing less than the primary model (or very close to it).