Skip to main content

Module cost_tracker

Module cost_tracker 

Source
Available on crate feature eval only.
Expand description

Cost and latency tracking for evaluation runs.

This module provides CostTracker which extracts token usage from agent event streams and computes estimated dollar costs using configurable per-model pricing tables.

§Example

use adk_eval::cost_tracker::{CostTracker, CostMetrics};

let tracker = CostTracker::new();

// Compute cost for a known model
let cost = tracker.compute_cost("gpt-4o", 1000, 500);
assert!(cost.is_some());

// Unknown models return None
let cost = tracker.compute_cost("unknown-model", 100, 50);
assert!(cost.is_none());

Structs§

CostMetrics
Cost and latency metrics for a single evaluation turn.
CostTracker
Tracks cost and latency metrics from agent event streams.