Using the httpx library
-
You can use the httpx library to configure the proxy when creating an OpenAI client:
```python
import httpx
from openai import OpenAI
import os
from dotenv import load_dotenv[3]
load_dotenv()
proxy_url = os.environ.get("OPENAI_PROXY_URL")client = OpenAI(api_key="GEMINI_API_KEY",base_url="https://generativelanguage.googleapis.com/v1beta/openai/",http_client=httpx.Client(proxy=proxy_url) if proxy_url else None
)
# Your code to make calls to the OpenAI API
```