litellm/enterprise/litellm_enterprise
Mateo Wang 9076c33347
fix(batches): price anthropic passthrough message batches correctly in batch cost job (#32307)
* fix(batches): price anthropic passthrough message batches correctly in batch cost job

Anthropic message batches created via the /anthropic passthrough were never
cost tracked. The CheckBatchCost job fetched batch results from the Files API
(POST /v1/files/msgbatch_.../content), which Anthropic rejects with "File id
must have file_ prefix"; the error response was silently wrapped as file
content, parsed as zero successful rows, logged as a $0 aretrieve_batch spend
row, and the job was marked batch_processed=true so the $0 was permanent.

Route msgbatch_ file ids to GET /v1/messages/batches/{id}/results in the
anthropic files transformation, raise on HTTP error status in
retrieve_file_content instead of returning the error body as content, parse
Anthropic's results JSONL shape (result.type == "succeeded",
result.message.usage with cache creation/read tokens) in batch_utils, price
cache creation tokens at cache_creation_input_token_cost in the batch cost
fallback (50% batch discount preserved for base input, cache reads, cache
writes, and output), and leave the managed object row unprocessed when cost
tracking fails so a later poll retries instead of permanently recording $0.

* fix(batches): carry cache token details into aggregated anthropic batch usage
2026-07-06 20:33:57 -07:00
..
enterprise_callbacks fix: prevent duplicate budget alert emails on concurrent threshold crossings (#32011) 2026-07-03 14:59:34 -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): price anthropic passthrough message batches correctly in batch cost job (#32307) 2026-07-06 20:33:57 -07: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