Skip to main content
Inferoute’s routing engine sits at the core of every API call you make. Instead of sending requests to a single hardcoded provider, Inferoute evaluates your routing strategy and the current state of all connected providers, then forwards your request to the option that best matches your requirements. This happens transparently — your code stays the same regardless of which provider handles the work.

Routing strategies

You can control how Inferoute selects a provider by specifying a routing strategy. Each strategy optimizes for a different dimension of performance.
Inferoute routes to the provider with the lowest measured response time for the requested model at the moment of the call. This is the best choice for interactive applications where response speed is critical.
If you do not specify X-Inferoute-Strategy, Inferoute uses the balanced strategy by default. Balanced weighs latency, cost, and availability together to make a reasonable choice for most workloads.

Specifying routing preferences

You have two ways to communicate your routing preference to Inferoute.

Via the model parameter

You can embed the strategy directly in the model name using a routing suffix. This works with any OpenAI-compatible client without modifying headers.
Supported suffixes: :latency, :cost, :availability, :round-robin.

Via the X-Inferoute-Strategy header

Pass the strategy as a custom request header. This keeps your model names clean and lets you change strategy at the request level without altering model identifiers.

Fallback behavior

Inferoute automatically retries failed requests on alternative providers. If the primary provider returns an error or times out, Inferoute selects the next best option according to your strategy and retries the request — without any additional code on your side. Fallback behavior covers:
  • Provider-side 5xx errors
  • Request timeouts
  • Rate limit responses (429s) when no retry window is available
The retry chain continues until a provider returns a successful response or all eligible providers for that model are exhausted. If all providers fail, Inferoute returns an error with details about each attempted provider.