Skip to main content
The official OpenAI Python SDK works with Yelu by changing the API key and base URL.

Install

Configure the client

Chat Completions

Responses

Stream output

Handle errors

Keep the Yelu base URL explicit when the same application also calls OpenAI directly. This prevents an environment-variable change from routing requests to the wrong service.

Async client

See the Chat example, Streaming guide, and Errors for protocol-level behavior.
Last modified on July 13, 2026