pub struct PricingTable {
map: HashMap<String, ModelPricing>,
}Expand description
Per-model USD pricing keyed by the exact message.model id.
Fields§
§map: HashMap<String, ModelPricing>Implementations§
Source§impl PricingTable
impl PricingTable
Sourcepub fn from_litellm_json(json: &str) -> Self
pub fn from_litellm_json(json: &str) -> Self
Parse a LiteLLM model_prices_and_context_window.json body.
Entries missing either core per-token cost are skipped; a
malformed body yields an empty table (logged), never a panic.
Sourcepub fn price(&self, model_id: &str) -> Option<&ModelPricing>
pub fn price(&self, model_id: &str) -> Option<&ModelPricing>
Exact-match price for model_id; None when the id is absent
(an unknown/new model, or <synthetic>).
Auto Trait Implementations§
impl Freeze for PricingTable
impl RefUnwindSafe for PricingTable
impl Send for PricingTable
impl Sync for PricingTable
impl Unpin for PricingTable
impl UnsafeUnpin for PricingTable
impl UnwindSafe for PricingTable
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