pub struct ProviderPreferences {
pub allow_fallbacks: Option<bool>,
pub require_parameters: Option<bool>,
pub data_collection: Option<DataCollectionPolicy>,
pub order: Option<Vec<String>>,
pub ignore: Option<Vec<String>>,
pub quantizations: Option<Vec<Quantization>>,
pub sort: Option<ProviderSortBy>,
}
Expand description
Configuration for how OpenRouter routes requests to AI providers
See detailed documentation at: https://openrouter.ai/docs/features/provider-routing
This struct allows you to control:
- Provider fallback behavior
- Data collection policies
- Provider selection order
- Provider blacklisting
- Quantization preferences
- Routing optimization strategies
Fields§
§allow_fallbacks: Option<bool>
Whether to allow backup providers to serve requests
- true: (default) when the primary provider is unavailable, use the next best provider
- false: use only the primary/custom provider, and return error if unavailable
require_parameters: Option<bool>
Whether to filter providers to only those that support the provided parameters If false or omitted, providers will receive only the parameters they support
data_collection: Option<DataCollectionPolicy>
Data collection setting If no available provider meets the requirement, request will fail
order: Option<Vec<String>>
Ordered list of provider names Router will attempt to use the first available provider in this list
ignore: Option<Vec<String>>
List of provider names to ignore Merged with account-wide ignored provider settings
quantizations: Option<Vec<Quantization>>
Quantization levels to filter providers by
sort: Option<ProviderSortBy>
Sorting strategy when no order is specified When set, no load balancing is performed
Trait Implementations§
Source§impl Clone for ProviderPreferences
impl Clone for ProviderPreferences
Source§fn clone(&self) -> ProviderPreferences
fn clone(&self) -> ProviderPreferences
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more