Skip to content

Conversation

@colinlin-stripe
Copy link
Contributor

@colinlin-stripe colinlin-stripe commented Nov 28, 2025

extra_headers in messages api bedrock invoke

Relevant issues

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
✅ Test

Changes

Extra_headers from litellm config were not being propagated for messages api -> bedrock invoke
the are present in the kwargs but are not being extracted.

motivation is to pass anthropic beta headers to bedrock see docs

Testing

ran poetry run pytest tests/test_litellm/llms/custom_httpx/test_llm_http_handler.py -v

Screenshot 2025-11-28 at 5 27 21 PM

example litellm_config.yaml

- model_name: claude-sonnet-4.5-1m
    litellm_params:
      model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
      extra_headers:
        anthropic-beta: "context-1m-2025-08-07"

example curl

curl -v http://localhost:4000/v1/messages \
  -H 'Authorization: Bearer sk-master' \
  -H 'Content-Type: application/json' \
  -d '{"model": "claude-sonnet-4-5-1m", "max_tokens": 10, "messages": [{"role": "user", "content": "200k+ tokens of content"}]}' \

if request succeeds then anthropic beta header was propagated successfully

@vercel
Copy link

vercel bot commented Nov 28, 2025

@colinlin-stripe is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@colinlin-stripe colinlin-stripe marked this pull request as ready for review November 28, 2025 22:31
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.

2 participants