/v1/chat/completions
Use with OpenAI SDKs, Cherry Studio, Cline, Open WebUI, and most tool clients.
ChinaAPI gives your app a single OpenAI-compatible endpoint for DeepSeek, Qwen, GLM, Kimi, Doubao, image, video, embedding, and rerank models. Keep your SDKs, replace the endpoint, and manage usage from one dashboard.
Connection
https://api.chinaapi.ai
https://api.chinaapi.ai/v1 and use your ChinaAPI token as the bearer key.
All API requests use bearer token authentication. Create a token in the dashboard, then send it in the Authorization header.
Authorization: Bearer $CHINAAPI_KEY
Content-Type: application/json
Most OpenAI clients work after changing baseURL. Use the model name published in your ChinaAPI dashboard.
curl https://api.chinaapi.ai/v1/chat/completions \
-H "Authorization: Bearer $CHINAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [
{ "role": "user", "content": "Hello" }
]
}'
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.CHINAAPI_KEY,
baseURL: "https://api.chinaapi.ai/v1",
});
const result = await client.chat.completions.create({
model: "deepseek-chat",
messages: [{ role: "user", content: "Hello" }],
});
ChinaAPI can forward OpenAI-style traffic and provider-specific traffic. Keep separate routes for clients that require Claude Messages API or Gemini-compatible payloads.
Use with OpenAI SDKs, Cherry Studio, Cline, Open WebUI, and most tool clients.
Route Claude-style message payloads while keeping the same gateway key and quota controls.
Use Gemini-compatible clients when your application depends on Gemini request structure.
Video models answer as tasks rather than as a single response. POST /v1/videos returns a task id with "status": "queued", and GET /v1/videos/{task_id} reports progress until the task reaches completed or failed. On completion the finished file is the signed URL under metadata.url; it carries an Expires parameter, so download the file rather than storing the link. A failed task carries the upstream code and text in error.code and error.message, which is usually enough to see which field the request was missing. POST /v1/video/generations reaches the same handler for clients already written against that path.
curl https://api.chinaapi.ai/v1/videos \
-H "Authorization: Bearer $CHINAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-i2v",
"prompt": "the cat turns and walks toward the camera",
"input_reference": "https://example.com/first-frame.jpg",
"size": "1280*720",
"duration": 5
}'
# {"id":"task_9f2c...","task_id":"task_9f2c...","object":"video",
# "model":"wan2.7-i2v","status":"queued","progress":0}
curl https://api.chinaapi.ai/v1/videos/task_9f2c... \
-H "Authorization: Bearer $CHINAAPI_KEY"
# {"id":"task_9f2c...","object":"video","model":"wan2.7-i2v",
# "status":"completed","progress":100,
# "metadata":{"url":"https://.../output.mp4?Expires=..."}}
model and prompt are the only required fields. Without size and duration the gateway submits 1280*720 for five seconds.
Animate a still image. input_reference takes a publicly reachable image URL and becomes the first frame; send size and duration with it.
Build a video from reference material. input_reference takes one reference image; to pass several use images instead, and video_url adds a reference video — references count together, up to five. Do not send input_reference and images together, because the gateway keeps only input_reference.
Edit an existing clip from a prompt. video_url takes the source video, which has to be 2 to 10 seconds of MP4 or MOV, and size sets the output.
Reference images go in images, since this family ignores input_reference. Length goes in seconds, and vendor parameters go in metadata, where resolution is either 480p or 720p.
size as width and height joined by an asterisk, as in 1280*720. The letter x is not accepted: 832x480 comes back as invalid size: 832x480, example: 1920*1080. duration is a whole number of seconds. For wan2.7-i2v, wan2.7-r2v and wan2.7-videoedit the gateway folds size into a resolution tier and upstream has only two, so send 1280*720 for 720P or 1920*1080 for 1080P; a 480P size such as 832*480 is refused. wan2.7-t2v takes the value as written.
curl https://api.chinaapi.ai/v1/videos \
-H "Authorization: Bearer $CHINAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "the subject slowly turns toward the camera",
"images": ["https://example.com/first-frame.jpg"],
"seconds": "5",
"metadata": {"resolution": "480p"}
}'
curl https://api.chinaapi.ai/v1/videos \
-H "Authorization: Bearer $CHINAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "keep the subject from the reference image",
"seconds": "5",
"metadata": {
"resolution": "480p",
"ratio": "16:9",
"content": [
{
"type": "image_url",
"image_url": {"url": "https://example.com/reference.jpg"},
"role": "reference_image"
}
]
}
}'
role is read as the first frame rather than as a reference: the output follows the aspect ratio of that image, sending ratio alongside it is refused with InvalidParameter.TaskTypeConstraint, and a seconds of 2 is refused there as well, while 5 works. generate_audio defaults to true upstream, so the file comes back with an audio track unless you set it to false in metadata. Tag every part of metadata.content with a role to reach the full reference mode — up to 30 images, 10 videos and 10 audio clips, audio-only input, and 30 seconds in one shot — where ratio is accepted.
Publish the model aliases you want your team to use, then map them to upstream channels, fallback pools, pricing, and groups inside the dashboard.
ChinaAPI is not only a forwarding endpoint. It includes keys, users, groups, channel health, logs, quota, and billing controls for real production traffic.
Create and rotate tokens, assign groups, and keep user traffic isolated.
Configure multiple upstream channels so one model alias can survive provider failures.
Track request status, token usage, quota consumption, and error details in one place.