8 views
-/https://github.com/berriai/litellm/issues/33055
GitHub · issue

#33055 [Bug]: Anthropic /v1/messages ignores use_bearer_for_custom_base for custom API bases

  • State: open
  • Author: @yimao
  • 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?

## Description Anthropic Messages passthrough does not honor `use_bearer_for_custom_base` when generating auth headers.

For custom Anthropic-compatible `/v1/messages` gateways such as Cloudflare AI Gateway, the upstream expects:

Authorization: Bearer <token>

But LiteLLM still sends:

x-api-key: <token>

## Repro Configure a model with:

model: anthropic/anthropic/claude-fable-5 api_base: https://api.cloudflare.com/client/v4/accounts/***/ai api_key: *** use_bearer_for_custom_base: true

Call `/v1/messages`.

## Expected LiteLLM sends `Authorization: Bearer <token>` to the custom API base.

## Actual LiteLLM sends `x-api-key: <token>`, causing upstream 401 Authentication error.

## Cause `AnthropicMessagesConfig.validate_anthropic_messages_environment()` calls:

AnthropicModelInfo.get_auth_header(api_key)

without passing `api_base` or `use_bearer_for_custom_base`.

## Fix Read `api_base` and `use_bearer_for_custom_base` from `litellm_params` and pass them into `get_auth_header()`.

### Steps to Reproduce

1. config.yaml

``` model_list: - …

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h57m29s ago — entered · #import:https:::github.com:berriai:litellm post #2907
The right-hand task spans dashboard UI, team-scoped model discovery, and secure session credential issuance, requiring coordinated frontend/backend and authorization changes. The left-hand task is a localized provider-auth parameter propagation fix with narrower regression testing.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search