pub struct ModelInfo {
pub context_length: Option<u32>,
pub pricing: Option<PricingConfig>,
pub vision: Option<bool>,
}Expand description
Per-model metadata: context window and token pricing.
Every field is Option so partial overrides work — a config entry
that sets only context_length can leave pricing unset.
Fields§
§context_length: Option<u32>Maximum context window in tokens.
pricing: Option<PricingConfig>Token pricing (per-axis costs per million tokens).
vision: Option<bool>Whether the model accepts image/video input.
Implementations§
Source§impl ModelInfo
impl ModelInfo
Sourcepub fn cost(&self, u: &Usage) -> f64
pub fn cost(&self, u: &Usage) -> f64
Compute cost in USD for the given usage. Returns 0.0 when pricing is unset.
Each axis is priced independently. Secondary rates fall back to the next-coarser bucket when unset:
cache_read,cache_write,audio_input→input_cost_per_millionreasoning,audio_output→output_cost_per_million
None never means “free” — that would silently zero out billing on any
axis where pricing data is incomplete.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelInfo
impl<'de> Deserialize<'de> for ModelInfo
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ModelInfo
impl RefUnwindSafe for ModelInfo
impl Send for ModelInfo
impl Sync for ModelInfo
impl Unpin for ModelInfo
impl UnsafeUnpin for ModelInfo
impl UnwindSafe for ModelInfo
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