OpenAI
OpenAI provider documentation and usage guide.
Overview
OpenAI is a leading AI research organization providing a comprehensive suite of AI models including GPT series, DALL-E, Whisper, and more.
Official Website: https://openai.com API Documentation: https://platform.openai.com/docs
Key Features
- Chat Completions — Text generation with function calling support
- Responses API — Enhanced interface with reasoning control
- Realtime API — Low-latency bidirectional audio communication
- 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
Usage Example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.yuhuanstudio.com/v1"
)
response = client.chat.completions.create(
model="model-id",
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: "YOUR_API_KEY",
baseURL: "https://api.yuhuanstudio.com/v1",
});
const response = await client.chat.completions.create({
model: "model-id",
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 YOUR_API_KEY" \
-d '{
"model": "model-id",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}'Available Models
Use the Models API to query available models:
curl https://api.yuhuanstudio.com/v1/models?provider=openai \
-H "Authorization: Bearer YOUR_API_KEY"Models and pricing are synced automatically from OpenAI. Check the dashboard for current availability and rates.
Official Resources
How is this guide?