Skip to main content

calculate_cost_split

Function calculate_cost_split 

Source
pub fn calculate_cost_split(
    model: &str,
    input_tokens: u64,
    output_tokens: u64,
    cache_read: u64,
    cache_write_5m: u64,
    cache_write_1h: u64,
) -> f64
Expand description

Calculate the USD cost of a single model turn with the cache-write TTL split made first-class.

Cache pricing relative to input price: reads 0.10× | 5m write 1.25× | 1h write 2.0×.