Skip to main content

session_cost_usd

Function session_cost_usd 

Source
pub fn session_cost_usd() -> f64
Expand description

Estimate the running cost (USD) of the current session, using the global crate::telemetry::TOKEN_USAGE counters and pricing_for_model. Applies provider-specific prompt-cache multipliers via cache_read_multiplier and cache_write_multiplier.

Assumes prompt_tokens in the counter already excludes cached input — which is how crate::telemetry::AtomicTokenCounter::record_model_usage_with_cache is invoked from every provider adapter.