Skip to content

httpx 0.28.0 removed proxies in httpx.Client, result in error #1915

@fefe982

Description

@fefe982

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

httpx 0.28.0 removed proxies in httpx.Client, result in error:

  File ".../test.py", line 3, in <module>
    client = OpenAI(
        api_key="API_KEY",
        base_url="https://some_url/v1",
    )
  File ".../lib/python3.13/site-packages/openai/_client.py", line 123, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        version=__version__,
        ^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        _strict_response_validation=_strict_response_validation,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".../lib/python3.13/site-packages/openai/_base_client.py", line 857, in __init__
    self._client = http_client or SyncHttpxClientWrapper(
                                  ~~~~~~~~~~~~~~~~~~~~~~^
        base_url=base_url,
        ^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        follow_redirects=True,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".../lib/python3.13/site-packages/openai/_base_client.py", line 755, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

To Reproduce

With a python file with the following content can reproduce the error:

from openai import OpenAI

client = OpenAI(
    api_key="API_KEY",
    base_url="https://some_url/v1",
)

Output of pip freeze: (note httpx is 0.28.0)

annotated-types==0.7.0
anyio==4.6.2.post1
blinker==1.9.0
build==1.2.2.post1
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
click==8.1.7
cryptography==43.0.3
distro==1.9.0
Flask==3.1.0
h11==0.14.0
httpcore==1.0.7
httpx==0.28.0
idna==3.10
itsdangerous==2.2.0
Jinja2==3.1.4
jiter==0.8.0
MarkupSafe==3.0.2
openai==1.54.4
packaging==24.2
pip-tools==7.4.1
pycparser==2.22
pydantic==2.10.2
pydantic_core==2.27.1
pyproject_hooks==1.2.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
requests==2.32.3
setuptools==75.1.0
six==1.16.0
sniffio==1.3.1
tqdm==4.67.1
typing_extensions==4.12.2
urllib3==2.2.3
volcengine-python-sdk==1.0.109
Werkzeug==3.1.3
wheel==0.44.0

Code snippets

No response

OS

Linux Ubuntu 22.04.3 LTS

Python version

Python 3.13.0

Library version

openai==1.54.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions