Skip to main content

calculate_cost_optional_split

Function calculate_cost_optional_split 

Source
pub fn calculate_cost_optional_split(
    model: &str,
    input_tokens: u64,
    output_tokens: u64,
    cache_read: u64,
    cache_creation: u64,
    cache_creation_5m: Option<u64>,
    cache_creation_1h: Option<u64>,
) -> f64
Expand description

Split-aware cost for callers holding an aggregate plus an optional TTL split (the shape of SessionEvent::Usage). When either split bucket is present the split rates apply; when both are None, the aggregate is billed at the 5m rate — fail-cheap, never fail-expensive.