For an application using the HTTPX2-based OpenAI Python SDK transport, pass the forward proxy to DefaultHttpx2Client:

from openai import OpenAI, DefaultHttpx2Client

client = OpenAI(
    http_client=DefaultHttpx2Client(
        proxy='http://proxy.example:8080',
    ),
)

For a permitted public-proxy route to the API, the HTTP proxy list provides candidates for the transport’s HTTP proxy URL. Retain the application’s normal API-key configuration, use this client for its API operations, and close it through the existing client lifecycle.

Keep base_url as the API service endpoint. An ordinary forward proxy implements a network hop rather than that API; its address belongs in the transport’s proxy option.

The helper name must match the installed SDK generation. Older HTTPX-based helpers and a Requests session use other transport interfaces.

If the intermediary requires authentication, supply its account through the transport. The API key still authenticates requests to the API service.

ХӀокхунах тера йаззамаш