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
refactor(responses): drop the api_base cast and mark the header merge mutable-ok
mateo-berriebae692a0ddc
diff --git a/litellm/llms/azure_ai/responses/transformation.py b/litellm/llms/azure_ai/responses/transformation.pyindex b61c856f733..66a284c821d 100644--- a/litellm/llms/azure_ai/responses/transformation.py+++ b/litellm/llms/azure_ai/responses/transformation.py@@ -34,7 +34,11 @@ class AzureAIResponsesAPIConfig(AzureOpenAIResponsesAPIConfig):litellm_params=params.model_dump(),api_key_header=api_key_header_for_base(AzureFoundryModelInfo.get_api_base(params.api_base)),)- return {**headers, **auth_headers, "Content-Type": "application/json"}+ return { # mutable-ok: the handler updates the returned headers in place per the dict contract+ **headers,+ **auth_headers,+ "Content-Type": "application/json",+ }def supports_native_websocket(self) -> bool:return Falsediff --git a/litellm/responses/main.py b/litellm/responses/main.pyindex a138d6f8eb3..63bee9f6d99 100644--- a/litellm/responses/main.py+++ b/litellm/responses/main.py@@ -492,6 +492,11 @@ def _resolve_responses_api_provider_config(return OpenAILikeResponsesConfig()+def _api_base_kwarg(kwargs: Mapping[str, object]) -> str | None:+ api_base: Final = kwargs.get("api_base")+ return api_base if isinstance(api_base, str) else None++def _will_bridge_to_chat_completions(model: str,custom_llm_provider: str | None,@@ -622,7 +627,7 @@ async def aresponses(custom_llm_provider,bool(kwargs.get("use_chat_completions_api")),kwargs.get("model_info"),- cast(str | None, kwargs.get("api_base")),+ _api_base_kwarg(kwargs),),):(@@ -792,7 +797,7 @@ def _apply_prompt_management_to_responses_call(custom_llm_provider,use_chat_completions_api,kwargs.get("model_info"),- cast(str | None, kwargs.get("api_base")),+ _api_base_kwarg(kwargs),),):(