Skip to content

Add proxy argument support for openai client #313

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

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

adlternative
Copy link
Contributor

@adlternative adlternative commented Mar 16, 2023

Due to the fact that the openai cli cannot function properly in some poor network environments without a proxy, add a '--proxy' parameter to overcome this difficulty.

v1. support "--proxy" parameter.
v2. give proxy example in README.
v3. supports using multiple "--proxy" parameters.

@hallacy
Copy link
Collaborator

hallacy commented Apr 4, 2023

Can you give an example of how someone would use this feature if it was merged in?

@adlternative adlternative force-pushed the zh/cli-proxy-support branch from bf3e711 to 79f1ab4 Compare April 5, 2023 12:51
@adlternative
Copy link
Contributor Author

Can you give an example of how someone would use this feature if it was merged in?

I have added an example to the README. Please refer to the latest commit. Thank you!

@hallacy
Copy link
Collaborator

hallacy commented Apr 5, 2023

Yep that makes sense!

I'm about 90% convinced this is a good addition but need a bit more convincing before approving. I'm struggling a little bit because I'm worried users will think they can add a fully proxy dictionary like in https://requests.readthedocs.io/en/latest/user/advanced/#proxies. Since it looks like this will only support a string (which is fair), I'm worried this will lead to user confusion.

Thoughts?

@adlternative adlternative force-pushed the zh/cli-proxy-support branch from 79f1ab4 to 6c7bfd8 Compare April 6, 2023 06:30
@adlternative
Copy link
Contributor Author

Yep that makes sense!

I'm about 90% convinced this is a good addition but need a bit more convincing before approving. I'm struggling a little bit because I'm worried users will think they can add a fully proxy dictionary like in https://requests.readthedocs.io/en/latest/user/advanced/#proxies. Since it looks like this will only support a string (which is fair), I'm worried this will lead to user confusion.

Thoughts?

I change it to use multiple "--proxy" parameter.

In fact, it only supports HTTP or HTTPS, and the dictionary only allows at most one HTTP proxy and at most one HTTPS proxy. It feels like the improvement brought about by this change is very limited.

@hallacy hallacy self-requested a review April 8, 2023 01:09
Copy link
Collaborator

@hallacy hallacy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense! Thank you!

@hallacy hallacy merged commit 6572ef4 into openai:main Apr 8, 2023
davedittrich pushed a commit to davedittrich/openai-python that referenced this pull request Nov 14, 2023
cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
stainless-app bot pushed a commit that referenced this pull request Mar 27, 2025
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

Successfully merging this pull request may close these issues.

2 participants