How it works
When you send a request to the gateway, MetrixLLM evaluates your configured routing rules for that specific endpoint (e.g./v1/chat/completions).
Instead of routing directly to a single model, MetrixLLM tries providers sequentially based on your fallback chain.
Routing modes
Every request can specify amode parameter to control how the gateway authenticates with providers:
How auto mode works
- If you have a BYOK key configured for the requested provider, the gateway uses it (no charge).
- If no BYOK key is configured, the gateway uses the platform key (deducted from workspace credits).
- If your workspace has insufficient credits and you have a BYOK key, the gateway automatically uses your BYOK key to avoid a payment error.
Custom providers
Requests routed to Custom Providers (Ollama, vLLM, LM Studio, etc.) are always BYOK regardless of themode parameter. These requests never deduct workspace credits since they use your own infrastructure.
Configuring a fallback chain
1
Open Routing Rules
In your workspace, go to Routing Rules and click New Rule.
2
Add primary provider
Select the primary provider and model (e.g.
openai, gpt-4o). This is the first provider MetrixLLM will always try.3
Add fallback providers
Click Add Fallback and select your secondary provider (e.g.
anthropic, claude-opus-4-5). You can add as many fallbacks as you want.4
Configure retries
Set the Max Retries and select which HTTP status codes should trigger a retry (e.g.
429 Too Many Requests, 500 Internal Server Error).Retry Configuration
MetrixLLM supports automatic retries with configurable parameters:
Retries happen within the same provider before falling back to the next provider in the chain.
What your application sees
Your application does not need to handle the fallback logic. Ifopenai is down and returns a 502 Bad Gateway, MetrixLLM automatically catches the error, retries the exact same prompt with anthropic, and returns the successful Anthropic response back to your app.
Your code receives a normal HTTP 200 response, exactly as if the first provider had succeeded.
Response headers
To help you understand what happened under the hood, the gateway injects metadata headers into every response:Customizing behavior per request
If you want to override the dashboard routing rules for a specific request, you can use theprompt_id mechanism (see Prompt Management) or define custom endpoint targets in the Custom Provider settings.