Skip to main content

Module cost_tracker

Module cost_tracker 

Source
Expand description

Session-level cost tracking for LLM API usage.

Uses ModelInfo pricing ($ per million tokens) to compute cost from the usage dict returned by each LLM API call.

Ported from opendev/core/runtime/cost_tracker.py.

Structsยง

CostTracker
Tracks cumulative token usage and estimated cost for a session.
PricingInfo
Pricing info needed for cost computation.
TokenUsage
Token usage from a single LLM call.