docs
This commit is contained in:
@@ -1,3 +1,36 @@
|
||||
"""
|
||||
Cost Tracker - Token cost estimation for API calls.
|
||||
|
||||
This module provides cost estimation for different LLM providers based on per-token pricing.
|
||||
It is used to display estimated costs in the MMA Dashboard.
|
||||
|
||||
Pricing Data (per 1M tokens):
|
||||
- gemini-2.5-flash-lite: $0.075 input / $0.30 output
|
||||
- gemini-3-flash-preview: $0.15 input / $0.60 output
|
||||
- gemini-3.1-pro-preview: $3.50 input / $10.50 output
|
||||
- claude-*-sonnet: $3.0 input / $15.0 output
|
||||
- claude-*-opus: $15.0 input / $75.0 output
|
||||
- deepseek-v3: $0.27 input / $1.10 output
|
||||
|
||||
Usage:
|
||||
from src.cost_tracker import estimate_cost
|
||||
|
||||
total = estimate_cost("gemini-2.5-flash-lite", 50000, 10000)
|
||||
# Returns: 0.007 (approx)
|
||||
|
||||
Accuracy:
|
||||
- Pricing data may be outdated
|
||||
- Uses regex matching for model identification
|
||||
- Returns 0.0 for unknown models
|
||||
|
||||
Integration:
|
||||
- Used by gui_2.py for MMA dashboard cost display
|
||||
- Called after each API call
|
||||
|
||||
See Also:
|
||||
- src/ai_client.py for token tracking
|
||||
- docs/guide_mma.md for MMA dashboard documentation
|
||||
"""
|
||||
import re
|
||||
|
||||
# Pricing per 1M tokens in USD
|
||||
|
||||
Reference in New Issue
Block a user