pub struct ModelPricing {
pub input: f64,
pub output: f64,
pub cache_read: f64,
pub cache_write: f64,
pub cache_write_1h: f64,
}Expand description
Pricing per 1M tokens (USD) by model family.
Anthropic bills three prompt-cache tiers off the base input rate:
5-minute cache write = 1.25× input, 1-hour cache write = 2× input,
cache read = 0.1× input. cache_write is the 5-minute rate (Claude Code’s
historical default); cache_write_1h is the 1-hour rate. Claude Code now
emits usage.cache_creation.ephemeral_1h_input_tokens for the 1-hour
portion, so the two must be priced separately or 1h writes undercount ~38%.
Fields§
§input: f64§output: f64§cache_read: f64§cache_write: f645-minute cache write (1.25× input).
cache_write_1h: f641-hour cache write (2× input).
Auto Trait Implementations§
impl Freeze for ModelPricing
impl RefUnwindSafe for ModelPricing
impl Send for ModelPricing
impl Sync for ModelPricing
impl Unpin for ModelPricing
impl UnsafeUnpin for ModelPricing
impl UnwindSafe for ModelPricing
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