pub struct ModelProfile {
pub provider: ProviderKey,
pub model: ModelKey,
pub capabilities: ProviderCapabilities,
pub cost_per_million_input: Option<MicroCents>,
pub cost_per_million_output: Option<MicroCents>,
pub region: Option<String>,
pub tags: Vec<String>,
}Expand description
Configured profile of one provider-model pair.
The profile is the single source of truth an adapter exposes through
crate::provider::ModelProvider::profile; routing reads capabilities,
cost, region and tags from it.
Fields§
§provider: ProviderKeyProvider key.
model: ModelKeyModel key.
capabilities: ProviderCapabilitiesDeclared capabilities.
cost_per_million_input: Option<MicroCents>Price per million input tokens, when known.
cost_per_million_output: Option<MicroCents>Price per million output tokens, when known.
region: Option<String>Region or data-residency label the model runs in (e.g. "eu").
Free-form configuration tags (e.g. "cheap", "eval-2026-08").
Implementations§
Source§impl ModelProfile
impl ModelProfile
Sourcepub fn new(
provider: impl Into<ProviderKey>,
model: impl Into<ModelKey>,
capabilities: ProviderCapabilities,
) -> Self
pub fn new( provider: impl Into<ProviderKey>, model: impl Into<ModelKey>, capabilities: ProviderCapabilities, ) -> Self
A profile with the given capabilities and no cost, region or tags.
Sourcepub fn with_cost(self, input: MicroCents, output: MicroCents) -> Self
pub fn with_cost(self, input: MicroCents, output: MicroCents) -> Self
Sets both per-million prices.
Sourcepub fn with_region(self, region: impl Into<String>) -> Self
pub fn with_region(self, region: impl Into<String>) -> Self
Sets the region label.
Sourcepub fn max_cost_per_million(&self) -> Option<MicroCents>
pub fn max_cost_per_million(&self) -> Option<MicroCents>
The higher of the two declared per-million prices, when both are known.
Routing compares this against a cost ceiling; a profile with an unknown price does not pass a ceiling (fail closed).
Sourcepub fn estimate_cost(&self, usage: &TokenUsage) -> Option<MicroCents>
pub fn estimate_cost(&self, usage: &TokenUsage) -> Option<MicroCents>
Estimated cost of a call from reported usage, when prices are known.
Trait Implementations§
Source§impl Clone for ModelProfile
impl Clone for ModelProfile
Source§impl Debug for ModelProfile
impl Debug for ModelProfile
Source§impl<'de> Deserialize<'de> for ModelProfile
impl<'de> Deserialize<'de> for ModelProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ModelProfile
Source§impl PartialEq for ModelProfile
impl PartialEq for ModelProfile
Source§impl Serialize for ModelProfile
impl Serialize for ModelProfile
impl StructuralPartialEq for ModelProfile
Auto Trait Implementations§
impl Freeze for ModelProfile
impl RefUnwindSafe for ModelProfile
impl Send for ModelProfile
impl Sync for ModelProfile
impl Unpin for ModelProfile
impl UnsafeUnpin for ModelProfile
impl UnwindSafe for ModelProfile
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.