#创建任务(OpenAI 兼容 / Sora 格式)
本格式即 OpenAI 的 Videos API(Sora 系列模型使用的同一套端点),任何在售视频模型都可用此格式调用,文生 / 图生视频调用同一端点,下文以 kling-video-v2.5-turbo 为例:
#端点
POST /v1/videos
#请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 模型名,以模型广场为准 |
prompt | string | 是 | 视频描述 |
seconds | number | 否 | 时长(秒) |
size | string | 否 | 画布大小,宽 x 高(如 1280x720),决定画幅比例;缺省 1:1 |
mode | string | 否 | 分辨率三档:std→720p、pro→1080p、ultra→4k(仅 v3 系支持 4k,档位合法性由上游校验)。不传时默认 std(720p) |
image | string | 否 | 图生视频首帧图片(URL 或 Base64);带此字段按图生视频处理 |
metadata | object | 否 | 厂商参数透传对象 |
#请求示例
cURL
Python
Node.js
# 文生视频
curl https://api-model.shuntianchuang.cn/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-你的令牌" \
-d '{
"model": "kling-video-v2.5-turbo",
"prompt": "一只橘猫在草地上追蝴蝶,电影感镜头,缓慢推近"
}'# 图生视频:image 传首帧图片 URL 或 Base64
curl https://api-model.shuntianchuang.cn/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-你的令牌" \
-d '{
"model": "kling-video-v2.5-turbo",
"prompt": "让画面中的猫跑起来,镜头缓慢推近",
"image": "https://example.com/first-frame.jpg"
}'import requests
SUBMIT_URL = "https://api-model.shuntianchuang.cn/v1/videos"
HEADERS = {
"Authorization": "Bearer sk-你的令牌",
"Content-Type": "application/json",
}
resp = requests.post(
SUBMIT_URL,
headers=HEADERS,
json={
"model": "kling-video-v2.5-turbo",
"prompt": "一只橘猫在草地上追蝴蝶,电影感镜头,缓慢推近",
},
)
task = resp.json()
print(task["id"], task.get("status"))
# 图生视频:json 里加 "image": "https://example.com/first-frame.jpg"(URL 或 Base64)// 视频接口无 openai SDK 支持,使用原生 fetch(Node.js 18+)
const resp = await fetch('https://api-model.shuntianchuang.cn/v1/videos', {
method: 'POST',
headers: {
Authorization: 'Bearer sk-你的令牌',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'kling-video-v2.5-turbo',
prompt: '一只橘猫在草地上追蝴蝶,电影感镜头,缓慢推近',
}),
});
const task = await resp.json();
console.log(task.id, task.status);
// 图生视频:body 里加 image: 'https://example.com/first-frame.jpg'(URL 或 Base64)#响应体
提交成功返回任务对象,记住其中的 id(status 起始为小写 queued):
#响应示例
{
"id": "video_xxxxxxxx",
"object": "video",
"status": "queued",
"model": "kling-video-v2.5-turbo"
}后续轮询与视频下载见查询与下载。
