Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

@Sameerlite Sameerlite commented Oct 29, 2025

Title

Add per-model-group header forwarding for Bedrock Invoke API (Messages API)

Relevant issues

Fixes LIT-1360

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

Problem

When calling Anthropic models via the Messages API (/v1/messages), custom headers configured via model_group_settings.forward_client_headers_to_llm_api were not being forwarded to Bedrock's Invoke API, even though they worked correctly for Chat Completions API with Bedrock's Converse API.

Solution

Modified async_anthropic_messages_handler in llm_http_handler.py to:

  1. Extract headers from kwargs["headers"] (set by proxy's add_headers_to_llm_call_by_model_group)
  2. Merge them with extra_headers from provider_specific_header
  3. Pass merged headers to validate_anthropic_messages_environment
image Screenshot 2025-10-29 at 11 19 49 AM

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 29, 2025 6:08am

@krrishdholakia krrishdholakia merged commit c1369a0 into main Oct 31, 2025
30 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants