Quickstart
Get up and running with the Yunxin API in under 5 minutes.
Get Your API Key
- Sign up for a Yunxin account
- Navigate to Dashboard → API Keys
- Click Create API Key and copy the generated key
Store your API key securely. Do not expose it in client-side code or public repositories.
Base URL
https://api.yuhuanstudio.com/v1
This URL is configured via Dashboard → Admin → Settings.
Your First Request
POST /v1/chat/completionscurl https://api.yuhuanstudio.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "model-id",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'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": "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: "user", content: "Hello!" },
],
});
console.log(response.choices[0].message.content);Switch Between Models
Change the model parameter to use any supported model — no other code changes needed. Use the Models API to list available models:
# List available models
models = client.models.list()
for model in models.data:
print(model.id)
# Use any model
response = client.chat.completions.create(
model="model-id",
messages=[{"role": "user", "content": "Hello!"}]
)What's Next?
How is this guide?