Files
crewAI/lib
Devin AI 0976c42c6b fix: track token usage in litellm non-streaming and async calls
This fixes GitHub issue #4170 where token usage metrics were not being
updated when using litellm with streaming responses and async calls.

Changes:
- Add token usage tracking to _handle_non_streaming_response
- Add token usage tracking to _ahandle_non_streaming_response
- Add token usage tracking to _ahandle_streaming_response
- Fix sync streaming to track usage in both code paths
- Convert usage objects to dicts before passing to _track_token_usage_internal
- Add comprehensive tests for token usage tracking in all scenarios

Co-Authored-By: João <joao@crewai.com>
2026-01-03 19:28:08 +00:00
..
2025-12-19 15:47:00 -05:00
2025-12-19 15:47:00 -05:00