Quick Start
CiYuanX provides a unified API for accessing hundreds of AI models through a single endpoint. Get started in minutes with a simple integration.
TIP
Looking for information on free models and rate limits? Check the FAQ.
Using the OpenAI SDK
The simplest way is to use the official OpenAI SDK — just change the base_url and you're ready to go.
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key-here",
base_url="https://ciyuanx.io/v1",
)
response = client.chat.completions.create(
model="gpt-4.1",
messages=[
{"role": "user", "content": "Hello!"}
],
)
print(response.choices[0].message.content)typescript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-api-key-here",
baseURL: "https://ciyuanx.io/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4.1",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);Calling the CiYuanX API directly
You can also invoke the API with plain HTTP requests.
INFO
Use our interactive request builder to generate API requests.
python
import requests
response = requests.post(
"https://ciyuanx.io/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "gpt-4.1",
"messages": [
{"role": "user", "content": "Hello!"}
],
},
)
print(response.json())typescript
const response = await fetch("https://ciyuanx.io/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-4.1",
messages: [{ role: "user", content: "Hello!" }],
}),
});
console.log(await response.json());bash
curl https://ciyuanx.io/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Next steps
Our API also supports advanced features like streaming and batch processing. See the Chat Completions API reference for details.
The API also supports streaming.
Supported models
We support a wide range of AI models, including but not limited to:
OpenAI models
- GPT-5.4
- GPT-5.5
- GPT-5.4-mini
Anthropic models
- Claude-3 Opus 4.7
- Claude-3 Sonnet 4.6
- Claude-3 Haiku 4.5