From 2a4e5b59fda3c5b4826094ad20ead63e4a14d021 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 10 Apr 2026 11:13:17 -0700 Subject: [PATCH] fix(responses): prevent duplicate kwargs in WebSocket call Filter all explicitly-passed keys from remaining_kwargs before spreading into async_responses_websocket(). The router now injects custom_llm_provider into kwargs (via #25334), which collides with the explicit custom_llm_provider= argument. --- litellm/responses/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/litellm/responses/main.py b/litellm/responses/main.py index c82574278b..bcc3f7f05e 100644 --- a/litellm/responses/main.py +++ b/litellm/responses/main.py @@ -1967,11 +1967,18 @@ async def _aresponses_websocket( ) # Extract params that we're passing explicitly to avoid duplicates in **kwargs - remaining_kwargs = { - k: v - for k, v in kwargs.items() - if k not in {"user_api_key_dict", "litellm_metadata"} + _explicit_keys = { + "user_api_key_dict", + "litellm_metadata", + "custom_llm_provider", + "model", + "websocket", + "litellm_logging_obj", + "api_base", + "api_key", + "timeout", } + remaining_kwargs = {k: v for k, v in kwargs.items() if k not in _explicit_keys} await base_llm_http_handler.async_responses_websocket( model=model,