pub struct ThresholdTier {
pub threshold_tokens: i64,
pub input_cost_per_token: f64,
pub output_cost_per_token: f64,
pub cache_read_input_token_cost: f64,
pub cache_creation_input_token_cost: f64,
pub cache_creation_input_token_cost_above_1hr: f64,
}Expand description
A threshold-based pricing tier.
When a request’s total input context (input + cache_read + cache_creation)
exceeds threshold_tokens, these per-token prices replace the base prices
for ALL token types on the model. Matches the Anthropic / Google “above Nk
tokens” model where the entire request switches to a higher rate once the
prompt crosses a size threshold.
cache_creation_input_token_cost_above_1hr is the price for cache writes
with Anthropic’s extended (1 hour) TTL. A value of 0.0 means the model
doesn’t offer 1hr cached writes at this tier — callers should fall back to
the 5-minute (cache_creation_input_token_cost) price.
Fields§
§threshold_tokens: i64Total input context (in tokens) above which this tier’s prices take over.
input_cost_per_token: f64Input price in USD per token at this tier.
output_cost_per_token: f64Output price in USD per token at this tier.
cache_read_input_token_cost: f64Cache-read price in USD per token at this tier.
cache_creation_input_token_cost: f64Cache-write (5-minute TTL) price in USD per token at this tier.
cache_creation_input_token_cost_above_1hr: f64Cache-write (1-hour TTL) price in USD per token; 0.0 falls back to the 5-minute rate.
Trait Implementations§
Source§impl Clone for ThresholdTier
impl Clone for ThresholdTier
Source§fn clone(&self) -> ThresholdTier
fn clone(&self) -> ThresholdTier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ThresholdTier
Source§impl Debug for ThresholdTier
impl Debug for ThresholdTier
Source§impl Default for ThresholdTier
impl Default for ThresholdTier
Source§fn default() -> ThresholdTier
fn default() -> ThresholdTier
Source§impl<'de> Deserialize<'de> for ThresholdTier
impl<'de> Deserialize<'de> for ThresholdTier
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>,
Auto Trait Implementations§
impl Freeze for ThresholdTier
impl RefUnwindSafe for ThresholdTier
impl Send for ThresholdTier
impl Sync for ThresholdTier
impl Unpin for ThresholdTier
impl UnsafeUnpin for ThresholdTier
impl UnwindSafe for ThresholdTier
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more