litellm - 💡(How to fix) Fix use_chat_completions_url_for_anthropic_messages config key not loaded from proxy YAML

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

vLLM receives a Responses API payload (input: [...]) instead of the expected chat completions format (messages: [...]), resulting in a 400 error.

Root Cause

In litellm/llms/anthropic/experimental_pass_through/messages/handler.py:

_RESPONSES_API_PROVIDERS = frozenset({"openai"})

def _should_route_to_responses_api(custom_llm_provider: Optional[str]) -> bool:
    if litellm.use_chat_completions_url_for_anthropic_messages:
        return False
    return custom_llm_provider in _RESPONSES_API_PROVIDERS

The module-level variable litellm.use_chat_completions_url_for_anthropic_messages is never populated from the proxy config YAML. Setting use_chat_completions_url_for_anthropic_messages: true under litellm_settings has no effect because the config parsing code does not map this key to the litellm module attribute.

Fix Action

Fix / Workaround

Current Workaround

Manually patch the source file:

_RESPONSES_API_PROVIDERS = frozenset()  # empty set bypasses the check

Code Example

_RESPONSES_API_PROVIDERS = frozenset({"openai"})

def _should_route_to_responses_api(custom_llm_provider: Optional[str]) -> bool:
    if litellm.use_chat_completions_url_for_anthropic_messages:
        return False
    return custom_llm_provider in _RESPONSES_API_PROVIDERS

---

_RESPONSES_API_PROVIDERS = frozenset()  # empty set bypasses the check
RAW_BUFFERClick to expand / collapse

Bug Description

The config key use_chat_completions_url_for_anthropic_messages is not respected when set in litellm_settings in the LiteLLM proxy configuration YAML.

Root Cause

In litellm/llms/anthropic/experimental_pass_through/messages/handler.py:

_RESPONSES_API_PROVIDERS = frozenset({"openai"})

def _should_route_to_responses_api(custom_llm_provider: Optional[str]) -> bool:
    if litellm.use_chat_completions_url_for_anthropic_messages:
        return False
    return custom_llm_provider in _RESPONSES_API_PROVIDERS

The module-level variable litellm.use_chat_completions_url_for_anthropic_messages is never populated from the proxy config YAML. Setting use_chat_completions_url_for_anthropic_messages: true under litellm_settings has no effect because the config parsing code does not map this key to the litellm module attribute.

Reproduction Steps

  1. Configure LiteLLM proxy with an openai/-prefixed vLLM backend
  2. Set use_chat_completions_url_for_anthropic_messages: true in litellm_settings in the proxy config YAML
  3. Send an Anthropic Messages API request through the proxy (e.g., via Claude Code with ANTHROPIC_BASE_URL pointing to the proxy)
  4. The request is incorrectly routed to the Responses API endpoint

Observed Behavior

vLLM receives a Responses API payload (input: [...]) instead of the expected chat completions format (messages: [...]), resulting in a 400 error.

Expected Behavior

When use_chat_completions_url_for_anthropic_messages: true is set in the proxy YAML, the litellm.use_chat_completions_url_for_anthropic_messages flag should be True, causing _should_route_to_responses_api() to return False and route through the Chat Completions API instead.

Environment

  • LiteLLM version: 1.86.0
  • Backend: vLLM (OpenAI-compatible)
  • Client: Claude Code via ANTHROPIC_BASE_URL proxy

Current Workaround

Manually patch the source file:

_RESPONSES_API_PROVIDERS = frozenset()  # empty set bypasses the check

Suggested Fix

Wire the use_chat_completions_url_for_anthropic_messages config key from litellm_settings in the proxy YAML to the litellm.use_chat_completions_url_for_anthropic_messages module attribute during proxy startup.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix use_chat_completions_url_for_anthropic_messages config key not loaded from proxy YAML