From 67fc9457e5406a742c89db694fab322430d86fa5 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 3 Feb 2026 16:39:47 -0800 Subject: [PATCH] OpenAIRealtime --- litellm/llms/openai/realtime/handler.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/litellm/llms/openai/realtime/handler.py b/litellm/llms/openai/realtime/handler.py index 217c04b22cb..a6340ec571d 100644 --- a/litellm/llms/openai/realtime/handler.py +++ b/litellm/llms/openai/realtime/handler.py @@ -59,7 +59,18 @@ class OpenAIRealtime(OpenAIChatCompletion): Returns: SSL configuration (None, True, or SSLContext) """ - return None if url.startswith("ws://") else get_shared_realtime_ssl_context() + if url.startswith("ws://"): + return None + + # Use the shared SSL context which respects custom CA certs and SSL settings + ssl_config = get_shared_realtime_ssl_context() + + # If ssl_config is False (ssl_verify=False), websockets library needs True instead + # to establish connection without verification (False would fail) + if ssl_config is False: + return True + + return ssl_config def _construct_url(self, api_base: str, query_params: RealtimeQueryParams) -> str: """ @@ -120,7 +131,7 @@ class OpenAIRealtime(OpenAIChatCompletion): ) async with websockets.connect( # type: ignore url, - additional_headers=headers, # type: ignore + extra_headers=headers, # type: ignore max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES, ssl=ssl_config, ) as backend_ws: