Skip to content

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]

merge: resolve conflicts with litellm_internal_staging

Devin AI41e7ea2033ce
diff --cc litellm/llms/azure/realtime/handler.py
index 51f9ef5989c,e3e1ef8ecd5..70e39f47d63
--- a/litellm/llms/azure/realtime/handler.py
+++ b/litellm/llms/azure/realtime/handler.py
@@@ -132,13 -117,13 +132,13 @@@ class AzureOpenAIRealtime(AzureChatComp
query_params=query_params,
)
+ auth_headers = self.get_auth_headers(api_key=api_key, azure_ad_token=azure_ad_token)
+
try:
- ssl_context = get_shared_realtime_ssl_context()
- async with websockets.connect( # type: ignore
+ ssl_context: Final = get_shared_realtime_ssl_context()
+ async with websockets.connect(
url,
- additional_headers={
- "api-key": api_key,
- },
+ additional_headers=auth_headers,
max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,
ssl=ssl_context,
) as backend_ws:
diff --cc litellm/realtime_api/main.py
index e981db216af,4e02be36daa..8933d5e4506
--- a/litellm/realtime_api/main.py
+++ b/litellm/realtime_api/main.py
@@@ -541,8 -577,7 +583,8 @@@ async def _realtime_health_check
"""
import websockets
- url: Optional[str] = None
+ url: str | None = None
+ auth_headers: dict[str, str | None] = {"api-key": api_key}
if custom_llm_provider == "azure":
url = azure_realtime._construct_url(
api_base=api_base or "",
@@@ -596,9 -625,11 +639,9 @@@
else:
raise ValueError(f"Unsupported model: {model}")
ssl_context = get_shared_realtime_ssl_context()
- async with websockets.connect( # type: ignore
+ async with websockets.connect(
url,
- additional_headers={
- "api-key": api_key,
- },
+ additional_headers=auth_headers,
max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,
ssl=ssl_context,
):