Skip to main content

record_step_llm_usage

Function record_step_llm_usage 

Source
pub fn record_step_llm_usage(
    model: &str,
    input_tokens: i64,
    output_tokens: i64,
    cost_usd: f64,
) -> Result<(), VmError>
Expand description

Record that llm_call consumed input_tokens / output_tokens for cost_usd. Updates the active step’s running totals and returns a budget-exhaustion error if the step’s ceiling is now breached.

The check is performed AFTER the call so the test fixture’s first call (which fits under budget) succeeds and subsequent calls trip the limit. This matches the existing accumulate_cost_for_provider pattern where global budget is also checked post-hoc.