From 6a9ebe88c2a6ce67c4c819975da74af387001526 Mon Sep 17 00:00:00 2001 From: Roman Leventov Date: Tue, 23 Sep 2025 13:50:10 +0800 Subject: [PATCH 1/2] Don't submit a task to a thread if streaming logging is disabled --- litellm/litellm_core_utils/streaming_handler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index 322691e28b4e..bc0fbdf5c119 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -1619,11 +1619,12 @@ def __next__(self): # noqa: PLR0915 completion_start_time=datetime.datetime.now() ) ## LOGGING - executor.submit( - self.run_success_logging_and_cache_storage, - response, - cache_hit, - ) # log response + if not litellm.disable_streaming_logging: + executor.submit( + self.run_success_logging_and_cache_storage, + response, + cache_hit, + ) # log response choice = response.choices[0] if isinstance(choice, StreamingChoices): self.response_uptil_now += choice.delta.get("content", "") or "" From 0a5fe102a28f70a4b06a452f1843c5ca605f89d2 Mon Sep 17 00:00:00 2001 From: Roman Leventov Date: Tue, 23 Sep 2025 15:01:42 +0800 Subject: [PATCH 2/2] Make httpx's sync transport configurable --- litellm/llms/custom_httpx/http_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index 36b543086f5a..28b1470e1f27 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -915,7 +915,7 @@ def _create_sync_transport(self) -> Optional[HTTPTransport]: if litellm.force_ipv4: return HTTPTransport(local_address="0.0.0.0") else: - return None + return getattr(litellm, 'sync_transport', None) def get_async_httpx_client(