fix(providers): remove custom cloud httpx client, let SDK handle proxy defaults

chengyongru reviewed #4367 and identified that the cloud  branch
created a bare httpx.AsyncClient that lacked the SDK's default settings
(follow_redirects, connection pool limits). Since the SDK's
DefaultAsyncHttpxClient already has trust_env=True and proper defaults,
the simplest fix is to let http_client stay None for cloud endpoints.

Also updated the test to match the new behavior (http_client is None).
This commit is contained in:
michaelxer
2026-06-18 00:03:03 +08:00
committed by Xubin Ren
parent 72b8fc806f
commit 0023f6d998
2 changed files with 7 additions and 12 deletions
@@ -16,10 +16,10 @@ async def test_openai_compat_provider_defers_sdk_client_until_first_use() -> Non
kwargs = mock_async_openai.call_args.kwargs
_assert_openai_compat_timeout(kwargs["timeout"])
# Cloud endpoints get an httpx client with trust_env=True to respect
# proxy environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY).
assert kwargs["http_client"] is not None
assert kwargs["http_client"]._trust_env is True
# Cloud endpoints pass http_client=None so the SDK creates its own
# DefaultAsyncHttpxClient, which already handles proxy env vars,
# connection limits, and redirects correctly.
assert kwargs["http_client"] is None
async def test_openai_compat_provider_sets_timeout_on_local_http_client() -> None: