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]

fix: revert realtime endpoint change, replace fragile asserts with fallback

Cursor Agenta5b86d3b2fe9
diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py
index 10caafb5ebe..a8d649064ac 100644
--- a/litellm/llms/custom_httpx/llm_http_handler.py
+++ b/litellm/llms/custom_httpx/llm_http_handler.py
@@ -4871,11 +4871,12 @@ class BaseLLMHTTPHandler:
timeout=timeout,
)
except Exception as e:
- assert provider_config is not None
- raise self._handle_error(
- e=e,
- provider_config=provider_config,
- )
+ if provider_config is not None:
+ raise self._handle_error(
+ e=e,
+ provider_config=provider_config,
+ )
+ raise
async def async_realtime_calls_handler(
self,
@@ -4956,11 +4957,12 @@ class BaseLLMHTTPHandler:
timeout=timeout,
)
except Exception as e:
- assert provider_config is not None
- raise self._handle_error(
- e=e,
- provider_config=provider_config,
- )
+ if provider_config is not None:
+ raise self._handle_error(
+ e=e,
+ provider_config=provider_config,
+ )
+ raise
async def async_responses_websocket(
self,
diff --git a/litellm/proxy/realtime_endpoints/endpoints.py b/litellm/proxy/realtime_endpoints/endpoints.py
index 876ff330cc5..0a91112298a 100644
--- a/litellm/proxy/realtime_endpoints/endpoints.py
+++ b/litellm/proxy/realtime_endpoints/endpoints.py
@@ -181,9 +181,10 @@ async def create_realtime_client_secret(
upstream_resp.status_code,
upstream_resp.text,
)
- raise HTTPException(
+ return Response(
+ content=upstream_resp.content,
status_code=upstream_resp.status_code,
- detail=upstream_resp.text,
+ media_type="application/json",
)
upstream_json: dict = upstream_resp.json()