peterdemin / openai-cli

Command-line client for OpenAI APIs
MIT License
164 stars 28 forks source link

Added proxy option #3

Open Khang5687 opened 1 year ago

Khang5687 commented 1 year ago

I added the option to specify proxies so that OpenAI API can be accessed through proxy. Please have a look!

peterdemin commented 1 year ago

Have you tried using HTTPS_PROXY env var, as documented here: https://requests.readthedocs.io/en/latest/user/advanced/#proxies? This should work out of the box

Khang5687 commented 1 year ago

I think it would be beneficial for Windows users as they can specify proxy with --proxy option instead of manually adding an environment variable in Windows settings.

peterdemin commented 1 year ago

I see. Sounds good. Let's remove mentions of OPENAI_PROXY_SERVER and rely on standard HTTP_PROXY.

Khang5687 commented 1 year ago

I have changed in accordance to your wish, please have a thorough check if there should be any errors in my codes :)

Khang5687 commented 1 year ago

I fixed an error in cli.py. For some reasons, git didn't push my fixed code, I had to update it directly through github. Please have a look :)