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
revert rename http client in llm_passthrough_route
KnyazShe1e56961a31a
diff --git a/litellm/passthrough/main.py b/litellm/passthrough/main.pyindex c06297ec15b..8b20406397b 100644--- a/litellm/passthrough/main.py+++ b/litellm/passthrough/main.py@@ -108,7 +108,7 @@ async def allm_passthrough_route(json: Optional[Any] = None,params: Optional[QueryParamTypes] = None,cookies: Optional[CookieTypes] = None,- http_client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,+ client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,**kwargs,) -> Union[httpx.Response, AsyncIterator[bytes]]:"""@@ -154,7 +154,7 @@ async def allm_passthrough_route(json=json,params=params,cookies=cookies,- http_client=http_client,+ client=client,**kwargs,)@@ -234,7 +234,7 @@ def llm_passthrough_route(json: Optional[Any] = None,params: Optional[QueryParamTypes] = None,cookies: Optional[CookieTypes] = None,- http_client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,+ client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,**kwargs,) -> Union[httpx.Response,@@ -256,11 +256,11 @@ def llm_passthrough_route(_is_async = allm_passthrough_route- if http_client is None:+ if client is None:if _is_async:- http_client = litellm.module_level_aclient+ client = litellm.module_level_aclientelse:- http_client = litellm.module_level_client+ client = litellm.module_level_clientlitellm_logging_obj = cast("LiteLLMLoggingObj", kwargs.get("litellm_logging_obj"))@@ -342,7 +342,7 @@ def llm_passthrough_route(if json and isinstance(json, dict) and "model" in json:json["model"] = model- request = http_client.client.build_request(+ request = client.client.build_request(method=method,url=updated_url,content=signed_json_body if signed_json_body is not None else content,@@ -379,7 +379,7 @@ def llm_passthrough_route(if _is_async:# Return the coroutine to be awaited by the callerreturn _async_passthrough_request(- client=http_client,+ client=client,request=request,is_streaming_request=is_streaming_request,litellm_logging_obj=litellm_logging_obj,@@ -387,7 +387,7 @@ def llm_passthrough_route()else:# Sync path - client.client.send returns Response directly- response: httpx.Response = http_client.client.send(request=request, stream=is_streaming_request) # type: ignore+ response: httpx.Response = client.client.send(request=request, stream=is_streaming_request) # type: ignoreresponse.raise_for_status()if (diff --git a/tests/pass_through_tests/test_hosted_vllm_passthrough.py b/tests/pass_through_tests/test_hosted_vllm_passthrough.pyindex e8d4c0d2ef0..272b4e1bb00 100644--- a/tests/pass_through_tests/test_hosted_vllm_passthrough.py+++ b/tests/pass_through_tests/test_hosted_vllm_passthrough.py@@ -63,7 +63,7 @@ async def test_allm_passthrough_route_with_hosted_vllm_model_does_not_raise():"model": "anything", # will be replaced internally with normalized model"messages": [{"role": "user", "content": "Hello"}],},- http_client=client,+ client=client,)# Then it should not raise and return a successful httpx.Responsediff --git a/tests/test_litellm/passthrough/test_passthrough_main.py b/tests/test_litellm/passthrough/test_passthrough_main.pyindex adcca96271e..3600aeed59e 100644--- a/tests/test_litellm/passthrough/test_passthrough_main.py+++ b/tests/test_litellm/passthrough/test_passthrough_main.py@@ -40,7 +40,7 @@ def test_llm_passthrough_route():"model": "my-custom-model","messages": [{"role": "user", "content": "Hello, world!"}],},- http_client=client,+ client=client,)mock_post.call_args.kwargs[@@ -94,7 +94,7 @@ def test_bedrock_application_inference_profile_url_encoding():endpoint="model/arn:aws:bedrock:us-east-1:123456789123:application-inference-profile/r742sbn2zckd/converse",method="POST",custom_llm_provider="bedrock",- http_client=client,+ client=client,litellm_logging_obj=mock_logging_obj,)@@ -152,7 +152,7 @@ def test_bedrock_non_application_inference_profile_no_encoding():endpoint="model/anthropic.claude-3-sonnet-20240229-v1:0/converse",method="POST",custom_llm_provider="bedrock",- http_client=client,+ client=client,litellm_logging_obj=mock_logging_obj,)@@ -511,7 +511,7 @@ def test_azure_with_custom_api_base_and_key():"model": "gpt-4.1","messages": [{"role": "user", "content": "Hello!"}],},- http_client=client,+ client=client,litellm_logging_obj=mock_logging_obj,)@@ -592,7 +592,7 @@ def test_content_param_forwarded_to_build_request():content=raw_content,data=None,json=None,- http_client=client,+ client=client,litellm_logging_obj=mock_logging_obj,)@@ -717,7 +717,7 @@ async def test_allm_passthrough_route_429_streaming_raises():api_base="https://my-azure.openai.azure.com",api_key="fake-azure-key",json={"model": "gpt-4", "input": "hello", "stream": True},- http_client=async_client,+ client=async_client,litellm_logging_obj=mock_logging_obj,)