pub struct Price {
pub input_per_token: u64,
pub output_per_token: u64,
}Expand description
Price table entry. Units: micro-cents per token, where 1 cent = 10 000 micro-cents. Stored this way so per-token values are integers even for cheap models.
Fields§
§input_per_token: u64Micro-cents per input token.
output_per_token: u64Micro-cents per output token.
Implementations§
Source§impl Price
impl Price
Sourcepub const HAIKU: Self
pub const HAIKU: Self
Claude Haiku 4.5 public pricing: $0.25/M input, $1.25/M output.
$0.25/M tokens = 25 cents/M = 250 000 micro-cents/M = 25 micro-cents per 100 tokens
= 0.25 micro-cents per token. We scale the whole per-M price up by 1e6 so the
per-token figure is integer: 2.5 micro-cents/token for input → stored as 2.
For accuracy we use $0.25/M = 2 500 micro-cents per 10 000 tokens, i.e. we
charge in chunks. Simpler: bill on 1 000 tokens at a time by keeping the per-
1M ratio. See record_with_price below.
Trait Implementations§
impl Copy for Price
impl Eq for Price
impl StructuralPartialEq for Price
Auto Trait Implementations§
impl Freeze for Price
impl RefUnwindSafe for Price
impl Send for Price
impl Sync for Price
impl Unpin for Price
impl UnsafeUnpin for Price
impl UnwindSafe for Price
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