Skip to main content

estimate_cost

Function estimate_cost 

Source
pub fn estimate_cost(
    model: &str,
    input_tokens: u64,
    output_tokens: u64,
    cache_read_tokens: u64,
) -> Option<f64>
Expand description

Estimate USD cost for a provider/model request from the global pricing catalog. Returns None when the model id is malformed, the model is absent from the catalog, or the model has no pricing — callers treat None as “cost unknown” (no error).