litellm/enterprise/litellm_enterprise
Devin AI 97b613d342 fix(batches): bound CheckBatchCost memory and add poll leader election
CheckBatchCost's cost-tracking path downloaded a completed batch's output
file and parsed it into a List[dict], keeping the full base64 image payloads
of Gemini image-gen responses resident on top of the raw bytes; two
json.dumps(..., indent=4) debug calls also re-serialized that whole structure
unconditionally because the argument was evaluated before the log-level check.
The scheduled job had no leader election, so every worker/pod polled and
buffered the same files at once.

- add calculate_batch_cost_and_usage_from_content: a single-pass fold over the
  JSONL output that keeps peak memory bounded to the raw bytes plus one row,
  preserving cost/usage/model/status behavior across providers
- guard the json.dumps debug serialization behind isEnabledFor(DEBUG)
- gate the poll behind PodLockManager so only the lock holder runs each cycle
  when Redis is configured, injected via the constructor with a fallback to the
  shared manager; unchanged unlocked behavior with no Redis

Fixes #33955
2026-07-20 09:38:30 +00:00
..
enterprise_callbacks feat(logging): add user and team level spend and budget to StandardLoggingPayload metadata (#33459) 2026-07-16 12:01:11 -07:00
integrations feat: allow multiple calls from tags 2026-03-07 11:24:18 +05:30
litellm_core_utils fix(litellm_logging.py): log custom headers in requester metadata (#10818) 2025-05-13 23:04:37 -07:00
proxy fix(batches): bound CheckBatchCost memory and add poll leader election 2026-07-20 09:38:30 +00:00
types Max budget alerts 2025-12-17 15:04:20 -08:00
__init__.py [Refactor] Use pip package for enterprise/ folder (#10709) 2025-05-09 17:18:48 -07:00