Skip to content

feature request: expose verify param of httpx client #2359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
ccurme opened this issue May 16, 2025 · 1 comment
Open
1 task done

feature request: expose verify param of httpx client #2359

ccurme opened this issue May 16, 2025 · 1 comment

Comments

@ccurme
Copy link

ccurme commented May 16, 2025

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • This is a feature request for the Python library

Describe the feature or improvement you're requesting

httpx allows you to specify SSL contexts when instantiating a client (see httpx docs). Otherwise, httpx will create a new SSL context when creating the client, which is expensive if you are instantiating multiple OpenAI clients.

Exposing verify in openai.(Async)OpenAI would allow you to share the SSL context among clients.

Currently, you'd need to share httpx clients. If you want default params (e.g., base URL) you need to ensure you're consistent with how OpenAI instantiates httpx clients.

Alternatively, OpenAI._client could be made a public attribute.

Additional context

No response

@RobertCraigie
Copy link
Collaborator

Hey, are you aware of client.with_options()? that will copy the httpx client over to the new client instance which will improve performance and also let you easily share common options. Would that work for you?

https://github.com/openai/openai-python?tab=readme-ov-file#configuring-the-http-client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants