Client.__init__() got an unexpected keyword argument 'proxies' with latest openai version 1.57.0 and httpx 0.27.2

Hi,

This used to work a few days ago and suddenly gives this error no matter what I try.

I tried:

  • Downgrading httpx to 0.27.2 and 0.25.2
  • !pip install openai “httpx[socks]”
  • Upgrading openait ot latest version 0.57.0

client = OpenAI()
TypeError: Client.init() got an unexpected keyword argument ‘proxies’

Please help!

Okay. Today’s fix.

I broke OpenAI, and then fixed it, validating versions. A command shell pip to run against your install or venv:

pip install --upgrade --upgrade-strategy eager "regex" "charset-normalizer<4" "idna" "urllib3<3" "certifi" "requests" "anyio<5" "distro<2" "sniffio" "h11<0.15" "httpcore==1.*" "annotated-types" "typing-extensions<5" "pydantic-core==2.27.1" "pydantic<3" "jiter<1" "tqdm" "colorama" "openai" "tiktoken" "httpx<0.28"

The httpx version without deprecated and shutoff methods OpenAI continues to use is thusly installed:

...
Requirement already satisfied: openai in \python311\lib\site-packages (1.57.0)
Requirement already satisfied: tiktoken in \python311\lib\site-packages (0.8.0)
Collecting httpx<0.28
  Downloading httpx-0.27.2-py3-none-any.whl.metadata (7.1 kB)
Downloading regex-2024.11.6-cp311-cp311-win_amd64.whl (274 kB)
...

If you are using someone else’s Jupyter notebook, you can try the bang magic command notation:

!pip install --upgrade --upgrade-strategy eager "regex" "charset-normalizer<4" "idna" "urllib3<3" "certifi" "requests" "anyio<5" "distro<2" "sniffio" "h11<0.15" "httpcore==1.*" "annotated-types" "typing-extensions<5" "pydantic-core==2.27.1" "pydantic<3" "jiter<1" "tqdm" "colorama" "openai" "tiktoken" "httpx<0.28"

This includes a latest Pydantic and pinned core version, that I have not extensively tested, but it does work with a complex parsed response_format schema. You may wish to maintain pydantic-2.8.2 and pydantic_core-2.20.1 if facing specific challenges.

2 Likes