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
fix(openai): restore httpx client union type on owns_wrapped_http_client (#35706)
ryan-crabbe-berria6d4654261d9
diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.pyindex 082764df208..808998ddaf6 100644--- a/litellm/llms/openai/common_utils.py+++ b/litellm/llms/openai/common_utils.py@@ -135,7 +135,7 @@ class BaseOpenAILLM:return _cached_client@staticmethod- def owns_wrapped_http_client(http_client: Optional[Union[httpx.Client, httpx.AsyncClient]]) -> bool:+ def owns_wrapped_http_client(http_client: httpx.Client | httpx.AsyncClient | None) -> bool:"""Whether litellm may close an SDK client built around ``http_client``.``_get_async_http_client`` / ``_get_sync_http_client`` hand backdiff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.pyindex 7096cdbf8fd..f01730a06a5 100644--- a/litellm/llms/openai/openai.py+++ b/litellm/llms/openai/openai.py@@ -366,7 +366,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM):if cached_client:if isinstance(cached_client, OpenAI) or isinstance(cached_client, AsyncOpenAI):return cached_client- http_client: Optional[Union[httpx.Client, httpx.AsyncClient]] = (+ http_client: httpx.Client | httpx.AsyncClient | None = (OpenAIChatCompletion._get_async_http_client(shared_session=shared_session)if is_asyncelse OpenAIChatCompletion._get_sync_http_client()