Skip to main content
The official OpenAI SDK is designed to allow overriding base_url, so it is fully compatible with OpenPAI — no need to swap libraries.

Python

Node.js / TypeScript

Go

github.com/sashabaranov/go-openai:

Java

com.openai:openai-java:

Environment variables

The OpenAI SDK reads the following environment variables by default — configuring via environment variables is recommended:
Then your code needs no explicit arguments:

Notes

  • Timeouts: long-context / reasoning models may require raising the client timeout to 5-10 minutes.
  • Retries: OpenPAI already retries upstream failures at the gateway, so the client can disable its own retries (max_retries=0) or keep them as a fallback.
  • Beta features: whether certain OpenAI Beta endpoints (Assistants API, Threads) are supported is subject to console announcements.