pub struct PricingTable { /* private fields */ }Expand description
Provider/model pricing table.
Lookup keys on (provider, model); entries whose provider is None act as
model-only fallbacks (matched when no provider-qualified entry exists).
Implementations§
Source§impl PricingTable
impl PricingTable
Sourcepub fn builtin() -> Self
pub fn builtin() -> Self
Built-in snapshot of common models (USD/1K, as of 2026-09).
This is a convenience seed, not a maintained source of truth: provider
prices change frequently. Fetch a current crate::model_registry::ModelRegistry
remotely and convert it with PricingTable::from_registry for
production accounting.
Sourcepub fn with(
self,
provider: impl Into<String>,
model: impl Into<String>,
price: ModelPrice,
) -> Self
pub fn with( self, provider: impl Into<String>, model: impl Into<String>, price: ModelPrice, ) -> Self
Adds/replaces a qualified entry; returns the table for chaining.
Sourcepub fn with_model_only(
self,
model: impl Into<String>,
price: ModelPrice,
) -> Self
pub fn with_model_only( self, model: impl Into<String>, price: ModelPrice, ) -> Self
Adds/replaces a model-only fallback entry.
Sourcepub fn insert(
&mut self,
provider: Option<impl Into<String>>,
model: impl Into<String>,
price: ModelPrice,
)
pub fn insert( &mut self, provider: Option<impl Into<String>>, model: impl Into<String>, price: ModelPrice, )
Inserts an entry. provider = None registers a model-only fallback.
Sourcepub fn get(&self, provider: Option<&str>, model: &str) -> Option<&ModelPrice>
pub fn get(&self, provider: Option<&str>, model: &str) -> Option<&ModelPrice>
Lookup: provider-qualified first, then the model-only fallback.
Sourcepub fn from_registry(registry: &ModelRegistry) -> Self
pub fn from_registry(registry: &ModelRegistry) -> Self
Builds a table from a model registry (qualified entries only).
Trait Implementations§
Source§impl Clone for PricingTable
impl Clone for PricingTable
Source§fn clone(&self) -> PricingTable
fn clone(&self) -> PricingTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more