The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge pull request #34531 from BerriAI/litellm_forward_client_headers_responses_api
Mateo Wangf60e99c583b5
diff --cc litellm/responses/utils.pyindex 5d4cfcaf06f,25a355edbc1..6e951367995--- a/litellm/responses/utils.py+++ b/litellm/responses/utils.py@@@ -99,11 -90,33 +99,33 @@@ class ResponsesAPIRequestUtilsreturn [*merged_input]@staticmethod+ def merge_client_forwarded_headers(+ extra_headers: dict[str, Any] | None,+ client_headers: dict[str, str] | None,+ ) -> dict[str, Any] | None:+ """+ Merge headers forwarded by the proxy (`headers` kwarg, set when+ `forward_client_headers_to_llm_api` is enabled) into `extra_headers`.++ `extra_headers` wins on conflicts, since it is set explicitly by the caller.+ Header names are compared case-insensitively, as HTTP defines them.+ """+ if not client_headers:+ return extra_headers+ if not extra_headers:+ return dict(client_headers)+ explicit_names = frozenset(name.lower() for name in extra_headers)+ return {+ **{name: value for name, value in client_headers.items() if name.lower() not in explicit_names},+ **extra_headers,+ }++ @staticmethoddef _check_valid_arg(- supported_params: Optional[List[str]],- non_default_params: Dict,- drop_params: Optional[bool],- custom_llm_provider: Optional[str],+ supported_params: list[str] | None,+ non_default_params: dict,+ drop_params: bool | None,+ custom_llm_provider: str | None,model: str,):if supported_params is None: