Skip to main content

compute_cost_usd

Function compute_cost_usd 

pub fn compute_cost_usd(
    model_provider_name: &str,
    model: &str,
    usage: &TokenUsage,
) -> Option<f64>
Expand description

Compute cost_usd for a provider/model/usage triple using the task-local pricing context but WITHOUT updating any accumulators. For emitting Usage events for rejected attempts where the cost is already accounted via settle_provider_attempts. Prices the usage exactly like the settlement path, including the cache-write band, so the projected rejected cost and the settled record agree.