pub struct ModelPrice {
pub input_per_mtok: f64,
pub output_per_mtok: f64,
}Expand description
Per-million-token prices for one model, in US dollars.
Fields§
§input_per_mtok: f64Input (prompt) tokens, dollars per million.
output_per_mtok: f64Output (completion) tokens, dollars per million.
Implementations§
Source§impl ModelPrice
impl ModelPrice
Sourcepub fn cost_usd(&self, prompt_tokens: u64, completion_tokens: u64) -> f64
pub fn cost_usd(&self, prompt_tokens: u64, completion_tokens: u64) -> f64
Dollar cost of one round-trip’s token counts.
Cached prompt tokens are billed at the full input rate here: the
provider-reported discount varies per provider and per cache tier,
and over-reporting cost is the safe direction for a cap (a budget
that stops slightly early never overspends). Named rather than
silently assumed — see the per-turn-cost-usage-accounting ledger
row’s note.
Trait Implementations§
Source§impl Clone for ModelPrice
impl Clone for ModelPrice
Source§fn clone(&self) -> ModelPrice
fn clone(&self) -> ModelPrice
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ModelPrice
Source§impl Debug for ModelPrice
impl Debug for ModelPrice
Source§impl PartialEq for ModelPrice
impl PartialEq for ModelPrice
impl StructuralPartialEq for ModelPrice
Auto Trait Implementations§
impl Freeze for ModelPrice
impl RefUnwindSafe for ModelPrice
impl Send for ModelPrice
impl Sync for ModelPrice
impl Unpin for ModelPrice
impl UnsafeUnpin for ModelPrice
impl UnwindSafe for ModelPrice
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