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

I am using openai==1.44.0

Code:
from openai import OpenAI
client = OpenAI()

I get the following error suddenly now when running the application -
TypeError: Client.init() got an unexpected keyword argument ‘proxies’

This had not been the issue before. I cannot currently upgrade the OpenAI version to 1.55.3, as suggested in similar posts on the forum. Is there a fix coming from OpenAI regarding this?

3 Likes

The proxies argument issue occurs because it was deprecated in recent versions of OpenAI. Since an upgrade is not possible, revert to a proxy-compatible earlier version of the OpenAI library or remove proxies and set them via environment variables instead. Older versions are not expected to have a fix.

Thanks for the response. I am sure there are many other prod projects as well that are not at the liberty to upgrade the version. Is there an official update from OpenAI available regarding the support?

Something has been changed in versions if you get this error, or it never worked for you.

It originates from a deprecated method of the httpx library continuing to be used often in automated OpenAI SDK code.

Upgrading to the latest OpenAI Python library will fix many occurences.

as will pip install --upgrade "httpx<0.28"

It used to work perfectly well till a few days ago. This is our production code, so its a bit difficult to fix.

adding this to my requirements.txt fixed it
httpx==0.27.2

6 Likes

This worked for me. Thank you! @mail64

1 Like

Thanks for the short-term fix!

On the general topic: This would be a great time for the OpenAI team to check whether they have any other deprecated functions they call that might blow up by being removed upstream at any given time :sweat_smile:

1 Like

Worked for me. Thanks @mail64

thank you @mail64, funcioned for me!!

I am using version 1.54.1 and same issue
which version should i use ?

Why not simply the newest openai, which should address concerns (unless you are passing the now-unsupported “proxies” argument yourself into the httpx module in code).

1.56.1 - replaced deprecated proxies parameter with mounts
1.57.2 - fixed cli - used by tools like training file validator

Great and thanks

working for me now