feat: implement token usage tracking for LLM calls with new accumulator and callback

This commit is contained in:
Anish Sarkar 2026-04-14 13:40:32 +05:30
parent 917f35eb33
commit 3cfe53fb7f
6 changed files with 223 additions and 4 deletions

View file

@ -22,10 +22,13 @@ litellm.drop_params = True
# Memory controls: prevent unbounded internal accumulation
litellm.telemetry = False
litellm.cache = None
litellm.success_callback = []
litellm.failure_callback = []
litellm.input_callback = []
from app.services.token_tracking_service import token_tracker
litellm.callbacks = [token_tracker]
logger = logging.getLogger(__name__)