Skip to content

There is no way to pass proxy to AsyncOpenAI #1529

@mohammadhzp

Description

@mohammadhzp

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

The parent of AsyncOpenAI which is AsyncAPIClient Accepts a parameter called proxies. However, there is no way to pass proxies when constructing AsyncOpenAI. This makes it tough to use the library correctly.

Clarification
It's not ideal to pass an HTTP client at all. AsyncAPIClient constructs a special client called AsyncHttpxClientWrapper with certain defaults; therefore it's hard to make a correct client and pass it as http_client

To Reproduce

1- Try to pass proxies param to AsyncOpenAI

2- It will fail as it does not accept proxies as a parameter

Code snippets

AsyncClient(proxies="")
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# TypeError: AsyncOpenAI.__init__() got an unexpected keyword argument 'proxies'

OS

Linux

Python version

Pytho v3.12.3

Library version

1.35.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions