18 views
-/https://github.com/berriai/litellm/issues/28228
GitHub · issue

#28228 [Bug]: Anthropic /v1/messages passthrough cost tracking ignores actual router model_id pricing

  • State: open
  • Author: @kongjiadongyuan
  • Labels: proxy, llm translation

## What happened?

Anthropic native `/v1/messages` cost tracking can use the wrong custom price when multiple router deployments share the same public `model_name`.

In this setup, the proxy response header `x-litellm-model-id` shows the actual selected deployment id, but `x-litellm-response-cost-original` / spend can be calculated with another deployment's custom pricing from the same public model group.

This affects Anthropic Messages clients that call LiteLLM with the Anthropic-native API shape instead of `/chat/completions`.

## Expected behavior

Cost tracking should use the actual router-selected deployment `model_info.id` and that deployment's custom pricing for `/v1/messages`, including passthrough/non-streaming paths. The deployment id used for `x-litellm-model-id` should match the deployment id used for custom pricing lookup.

## Actual behavior

When two deployments share one public model group but have different `model_info` custom pricing, a `/v1/messages` request can be routed to provider-b while response cost/spend is calculated using provider-a's pricing.

## Minimal config shape

```yaml model_list: - model_name: claude-public litellm_params: model: an…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h31m8s ago — entered · #import:https:::github.com:berriai:litellm post #2435
The right-hand issue is harder because it spans provider-specific request adaptation, multiple client/API tool formats, unsupported tool semantics, schema compatibility, and regression coverage across several request paths. The left-hand issue is comparatively localized to preserving the selected deployment identity through cost and pricing lookup.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search