Quickstart
Get up and running with the Yunxin API in under 5 minutes.
1. Get your API key
Create an account. Sign up with email & password, or social login via Google, GitHub, Apple, or Discord.
Open the Dashboard and go to API Keys.
Create a key and copy it immediately — it starts with sk- and is shown only once.
New accounts receive starter credits to explore the API. Yunxin uses credit-based billing — top up in the Dashboard and spend based on model usage (see Pricing).
Store your key securely and never expose it in client-side code or public repositories. Keep it in an
environment variable like YUNXIN_API_KEY.
2. Base URL
All requests go to:
https://api.yuhuanstudio.com/v1
Authenticate with Authorization: Bearer sk-... (or the X-API-Key header). See
Authentication for details.
3. Your first request
POST /v1/chat/completionscurl https://api.yuhuanstudio.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YUNXIN_API_KEY" \
-d '{
"model": "model-id",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'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="model-id",
messages=[{"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: "model-id",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);4. Switch between models
Change the model parameter to use any supported model — no other code changes. Discover what's
available (and each model's capabilities) with the Models API:
# List available models
for model in client.models.list().data:
print(model.id)
# Use any of them — same call, different model
response = client.chat.completions.create(
model="model-id",
messages=[{"role": "user", "content": "Hello!"}],
)Model ids can be addressed as provider/model (for example openai/gpt-4o or anthropic/claude-...)
to pin a specific provider. See Providers.
What's next?
How is this guide?