OpenAI
OpenAI provider documentation and usage guide.
Overview
OpenAI is a leading AI research organization providing a comprehensive suite of models, including the GPT family, DALL·E, Whisper, text-to-speech, embeddings, and the Realtime API.
Official Website: https://openai.com API Documentation: https://platform.openai.com/docs
Key features
- Chat Completions — Text generation with function calling and streaming
- Responses API — Stateful interface with reasoning control and built-in tools
- Realtime API — Low-latency bidirectional audio over WebSocket
- Vision — Image analysis and understanding
- Image generation — DALL·E image creation
- Audio — Whisper speech-to-text and TTS text-to-speech
- Embeddings — Text embeddings for semantic search
- Batch & files — Asynchronous batch processing and file uploads
Using OpenAI with Yunxin
Address OpenAI models using the provider/model convention — prefix the model id with openai/ (for example, openai/gpt-4o). Requests use the same Yunxin base URL (https://api.yuhuanstudio.com/v1) and your Yunxin sk- API key; no separate OpenAI credentials are required.
Usage example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["YUNXIN_API_KEY"],
base_url="https://api.yuhuanstudio.com/v1"
)
response = client.chat.completions.create(
model="openai/gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.YUNXIN_API_KEY,
baseURL: "https://api.yuhuanstudio.com/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello!" },
],
});
console.log(response.choices[0].message.content);curl https://api.yuhuanstudio.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YUNXIN_API_KEY" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}'Available models
Query the live catalog with the Models API:
curl "https://api.yuhuanstudio.com/v1/models?provider=openai" \
-H "Authorization: Bearer $YUNXIN_API_KEY"Capabilities and pricing are tracked per model. Use GET /v1/models?provider=openai and each model's capabilities array as the authoritative source rather than relying on a hardcoded list.
Official resources
How is this guide?