Overview
Theextra_body parameter allows you to fine-tune model selection, fallbacks, and optimization preferences. All parameters are optional.
Parameters
models
An array of model identifiers to consider for selection or use as fallbacks.
For specific model requests: These are used as fallback models if the primary model fails.
For auto model selection: These define the pool of models to choose from.
ignore
An array of providers or specific models to exclude from selection or fallbacks.
You can exclude:
- Entire providers:
"groq"excludes all Groq models - Specific models:
"groq/llama-3.3-70b-versatile"excludes only that model
sort
An array of sorting criteria in priority order. The optimizer uses these to rank and select models.
Available criteria:
"price"- Cost optimization"latency"- Low latency"throughput"- High throughput"intelligence"- General intelligence/capability"math"- Mathematical reasoning"coding"- Code generation and understanding
Format Difference: The
sort field in extra_body (for chat completions) uses string arrays like ["price", "latency"]. However, when using sort in router configuration within model_selection, you must use object array format: [{"metric": "SORT_METRIC_PRICE"}, {"metric": "SORT_METRIC_LATENCY"}]. See Create Router for router configuration details.provider
An object that controls provider-level routing when the model is specified without a provider prefix (e.g., "model": "gpt-oss-120b").
| Field | Type | Default | Description |
|---|---|---|---|
order | string[] | — | Explicit list of providers to try, in order (e.g., ["groq", "fireworks"]). |
allow_fallbacks | boolean | true | Whether to fall back to the next provider if the current one fails. |
order is specified, the sort criteria determines the order providers are tried. If no sort is specified either, providers are selected by lowest latency.
When order is specified, providers are tried in the listed order — sort does not reorder the provider list, but still applies to models fallbacks.
See Provider Routing for detailed examples and execution order.
metadata
An object containing key-value pairs that can be used for conditional routing with CEL expressions. This is used when routing with Routers that have conditional routes.
"cel_expression": "tier == \"premium\"" will match when metadata.tier is "premium".
See Conditional Routing for more details on using metadata for routing.
Complete Example
- Considers only the three specified models
- Excludes all Groq models
- Prioritizes coding capability, then cost, then latency
Best Practices
- Be specific with
models: Limiting the model pool improves selection speed and predictability - Use
ignorestrategically: Exclude providers or models that don’t meet your requirements - Order
sortby priority: List the most important criteria first - Combine criteria: Use multiple sort criteria for balanced optimization