Bypassing proxy settings with OpenAi's Python SDK

Hello everyone, I was wondering if it was possible to bypass the proxy settings on a Windows computer.
I am developing a piece of software that need to make different requests to openai’s server (using their Python SDK), but the machine where the software will be running has a proxy set up so that basicly nothing can go out.
I tryed using exclusion for the proxy like in this image:


Unfortunatly this didn’t work for me…

I also tryed something like this:

def InitOpenAIClient() -> AsyncOpenAI:
    proxies = {
        'http': None,
        'https': None,
    }
   return AsyncOpenAI(api_key=os.environ.get('OPENAI_API_KEY'), proxies=proxies)

Do you guys have any suggestions on how i can manage to do that?

Thank you in advance :innocent:

1 Like

Fixed just by adding these 3 lines:

os.environ['HTTP_PROXY'] = ''
os.environ['HTTPS_PROXY'] = ''
os.environ['NO_PROXY'] = 'api.openai.com'

Probably has something to do with httpx lib used by the openai sdk.
:man_shrugging:

1 Like