Skip to main content

repack_saving_usd

Function repack_saving_usd 

Source
pub fn repack_saving_usd(
    before_tokens: u64,
    after_tokens: u64,
    cost: &ModelCost,
) -> f64
Expand description

Cache-write cost saved by re-seeding a compressed prefix instead of the full one, in USD. On a cold prefix the provider re-writes regardless, so the saving is the avoided write of the dropped tokens: (before − after) × cache_write. Clamped to 0.0 when compression did not shrink the prefix.