pub struct ModelPricing {
pub input: f64,
pub output: f64,
pub cached_input: f64,
pub cached_write_5m: f64,
pub cached_write_1h: f64,
pub reasoning: f64,
pub batch_discount: f64,
}Expand description
Per-model pricing in USD per token.
Fields§
§input: f64USD per uncached input token.
output: f64USD per output token.
cached_input: f64USD per cached input READ token (cache hit). For Anthropic this is
~10% of input; for OpenAI ~50%. If 0.0, cached reads are billed
at the full input rate.
cached_write_5m: f64USD per cached input WRITE token, 5-minute TTL tier. Anthropic charges ~1.25× input for 5m-ephemeral cache creation. If 0.0, cache writes are billed at the uncached input rate.
cached_write_1h: f64USD per cached input WRITE token, 1-hour TTL tier. Anthropic charges ~2.0× input for 1h-ephemeral cache creation.
reasoning: f64USD per reasoning / thinking token. If 0.0, reasoning tokens
are billed at the output rate.
batch_discount: f64Multiplier applied to the final per-call cost when
meta.batch == true — e.g. 0.5 for a 50% batch discount.
1.0 (or 0.0 as a sentinel) means no discount.
Implementations§
Trait Implementations§
Source§impl Clone for ModelPricing
impl Clone for ModelPricing
Source§fn clone(&self) -> ModelPricing
fn clone(&self) -> ModelPricing
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelPricing
impl Debug for ModelPricing
Source§impl<'de> Deserialize<'de> for ModelPricing
impl<'de> Deserialize<'de> for ModelPricing
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ModelPricing
impl PartialEq for ModelPricing
Source§fn eq(&self, other: &ModelPricing) -> bool
fn eq(&self, other: &ModelPricing) -> bool
self and other values to be equal, and is used by ==.