Fun ohun elo ti o nlo OpenAI Python SDK transport ti o da lori HTTPX2, fi forward proxy ranṣẹ si DefaultHttpx2Client:

from openai import OpenAI, DefaultHttpx2Client

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

Fun ọna proxy gbangba ti a gba laaye si API, akojọ proxy HTTP pese awọn oludije fun URL proxy HTTP ti transport. Pa atunto API kọkọ deede ti ohun elo mọ, lo alabara yii fun awọn iṣẹ API rẹ, ki o si pa a nipasẹ igbesi aye alabara ti o wa tẹlẹ.

Pa base_url mọ gẹgẹbi endpoint iṣẹ API. Forward proxy lasan n ṣe fifo nẹtiwọọki kii ṣe API yẹn; adiresi rẹ wa ninu aṣayan proxy ti transport.

Orukọ oluranlọwọ gbọdọ ba iran SDK ti a fi sori ẹrọ mu. Awọn oluranlọwọ atijọ ti o da lori HTTPX ati igba Requests lo awọn ibaraẹnisọrọ transport miiran.

Ti alarinrin ba nilo ijẹrisi, pese akọọlẹ rẹ nipasẹ transport. Kọkọ API ṣi n jẹrisi awọn ibeere si iṣẹ API.

Àwọn àpilẹ̀kọ tó jọra