Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(providers): remove custom cloud httpx client, let SDK handle proxy defaults
michaelxer0023f6d99813
diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.pyindex a3d3772cd..5e2d71154 100644--- a/nanobot/providers/openai_compat_provider.py+++ b/nanobot/providers/openai_compat_provider.py@@ -417,14 +417,9 @@ class OpenAICompatProvider(LLMProvider):timeout=timeout_s,transport=httpx.AsyncHTTPTransport(proxy=None, limits=_local_limits),)- else:- # Cloud endpoints: respect proxy environment variables- # (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY) so corporate- # or VPN proxies work without explicit configuration.- http_client = httpx.AsyncClient(- timeout=timeout_s,- trust_env=True,- )+ # else: http_client stays None → SDK creates DefaultAsyncHttpxClient+ # which already reads proxy env vars via trust_env=True, has proper+ # connection limits, and follows redirects.self._client = AsyncOpenAI(api_key=self._api_key_for_client,base_url=self._effective_base,diff --git a/tests/providers/test_openai_compat_timeout.py b/tests/providers/test_openai_compat_timeout.pyindex bf685158e..519d22ec2 100644--- a/tests/providers/test_openai_compat_timeout.py+++ b/tests/providers/test_openai_compat_timeout.py@@ -16,10 +16,10 @@ async def test_openai_compat_provider_defers_sdk_client_until_first_use() -> Nonkwargs = 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 Noneasync def test_openai_compat_provider_sets_timeout_on_local_http_client() -> None: