9 views
-/https://github.com/berriai/litellm/issues/35130
GitHub ยท issue

#35130 [Bug]: afile_content calls are billed at 3x model_cost_per_token due to default-message-value placeholder

  • State: open
  • Author: @jimmychen-p72
  • Labels: llm translation, SDK

### Check for existing issues

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

### What happened?

`afile_content` calls (retrieving file content โ€” a files/storage API call, not an LLM completion) are billed a `response_cost`, even though there is no real token usage to bill. The cost consistently equals **exactly 3 ร— the model's `input_cost_per_token`** โ€” e.g. for `vertex_ai/gemini-3-flash-preview` (`input_cost_per_token = 5e-07`), the recorded cost is `1.5e-6`, which is `3 ร— 5e-07`. This pattern appears across all `afile_content` calls where a response cost is recorded, regardless of the actual file size or content.

**Root cause:** `afile_content` is not a first-class, documented call type in `cost_calculator.py`'s Literal list and has no dedicated pricing rule. However, `afile_content` calls go through the same `@client` logging path as chat-style completions, and `HttpxBinaryResponseContent` is treated as a normal logged response โ€” so the generic `response_cost` / `completion_cost` path still runs. Because `function_setup` never fills in real messages for this call type, it falls back to the placeholder string `"default-message-value"`,โ€ฆ

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 ยท 31d18h12m33s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #2647
#35130 requires tracing and modifying shared logging, response-cost, and pricing behavior, with regression coverage to avoid affecting normal completion billing. #30120 has insufficient technical detail and appears primarily a triage or reproduction task, so its implementation scope is much smaller.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search