pub struct ProviderPreferences {
pub order: Option<Vec<String>>,
pub allow_fallbacks: Option<bool>,
pub require_parameters: Option<bool>,
pub data_collection: Option<String>,
pub only: Option<Vec<String>>,
pub ignore: Option<Vec<String>>,
pub quantizations: Option<Vec<String>>,
pub sort: Option<String>,
}Expand description
OpenRouter provider preferences for routing requests
Fields§
§order: Option<Vec<String>>List of provider slugs to try in order (e.g. [“anthropic”, “openai”])
allow_fallbacks: Option<bool>Whether to allow backup providers when the primary is unavailable
require_parameters: Option<bool>Only use providers that support all parameters in your request
data_collection: Option<String>Control whether to use providers that may store data (“allow” or “deny”)
only: Option<Vec<String>>List of provider slugs to allow for this request
ignore: Option<Vec<String>>List of provider slugs to skip for this request
quantizations: Option<Vec<String>>List of quantization levels to filter by (e.g. [“int4”, “int8”])
sort: Option<String>Sort providers by price or throughput (e.g. “price” or “throughput”)
Implementations§
Source§impl ProviderPreferences
impl ProviderPreferences
pub fn new() -> Self
pub fn with_order(self, order: Vec<String>) -> Self
pub fn with_allow_fallbacks(self, allow: bool) -> Self
pub fn with_require_parameters(self, require: bool) -> Self
pub fn with_data_collection(self, policy: impl Into<String>) -> Self
pub fn with_only(self, providers: Vec<String>) -> Self
pub fn with_ignore(self, providers: Vec<String>) -> Self
pub fn with_quantizations(self, quantizations: Vec<String>) -> Self
pub fn with_sort(self, sort: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for ProviderPreferences
impl Clone for ProviderPreferences
Source§fn clone(&self) -> ProviderPreferences
fn clone(&self) -> ProviderPreferences
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProviderPreferences
impl Debug for ProviderPreferences
Source§impl Default for ProviderPreferences
impl Default for ProviderPreferences
Source§fn default() -> ProviderPreferences
fn default() -> ProviderPreferences
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProviderPreferences
impl RefUnwindSafe for ProviderPreferences
impl Send for ProviderPreferences
impl Sync for ProviderPreferences
impl Unpin for ProviderPreferences
impl UnwindSafe for ProviderPreferences
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more