18 views
-/https://github.com/berriai/litellm/issues/27944
GitHub ยท issue

#27944 [Bug]: Anthropic batch costs always 0 โ€” transform_file_content_request routes msgbatch_* IDs to wrong endpoint

  • State: open
  • Author: @anand-patel-behavox
  • Labels: bug, proxy, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Bug Description

When using the Anthropic batch API through LiteLLM, `CheckBatchCost` always records 0 tokens and $0 cost for completed batches, silently dropping all cost data.

## Root Cause

`AnthropicFilesConfig.transform_file_content_request` in `litellm/llms/anthropic/files/transformation.py` generates the wrong URL for batch result IDs:

```python # Current (broken) โ€” always uses the Files API endpoint return f"{api_base.rstrip('/')}/v1/files/{file_id}/content", {}

### Steps to Reproduce

1. Send batch to anthropic model 2. Check the costs after the polling has completed 3. Costs remain 0

### Relevant log output

```shell

```

### What part of LiteLLM is this about?

Proxy

### What LiteLLM version are you on ?

v1.83.10

### Twitter / LinkedIn details

_No response_

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 ยท 31d19h8m21s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #1821
The right issue is harder because it involves diagnosing and correcting the cross-platform container build and publication pipeline, validating manifests and binary architecture, and preventing recurrence across registries. The left issue is comparatively contained to endpoint-selection logic plus focused regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search