fix(proxy): use get_async_httpx_client for logo download (#20155)

Replace direct AsyncHTTPHandler instantiation with get_async_httpx_client
to avoid +500ms latency per request from creating new async clients.

Added httpxSpecialProvider.UI for UI-related HTTP requests like logo downloads.
This commit is contained in:
shin-bot-litellm
2026-01-31 09:51:16 -08:00
committed by GitHub
parent f2cb31a45e
commit 2f6d18e6bc
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -10164,9 +10164,13 @@ async def get_image():
if logo_path.startswith(("http://", "https://")):
try:
# Download the image and cache it
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler
from litellm.llms.custom_httpx.http_handler import get_async_httpx_client
from litellm.types.llms.custom_http import httpxSpecialProvider
async_client = AsyncHTTPHandler(timeout=5.0)
async_client = get_async_httpx_client(
llm_provider=httpxSpecialProvider.UI,
params={"timeout": 5.0},
)
response = await async_client.get(logo_path)
if response.status_code == 200:
# Save the image to a local file
+1
View File
@@ -26,6 +26,7 @@ class httpxSpecialProvider(str, Enum):
RAG = "rag"
A2A = "a2a"
PromptManagement = "prompt_management"
UI = "ui"
VerifyTypes = Union[str, bool, ssl.SSLContext]