创建视频任务
curl --request POST \
--url https://api.chenyu.cn/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"content": [
{}
],
"generation_category": "<string>",
"first_frame": {},
"last_frame": {},
"images": [
{}
],
"reference_images": [
{}
],
"videos": [
{}
],
"audios": [
{}
],
"duration": {},
"seconds": {},
"resolution": "<string>",
"ratio": "<string>",
"aspect_ratio": "<string>",
"generate_audio": true,
"watermark": true,
"contains_real_person_material": true,
"extra_body": {}
}
'import requests
url = "https://api.chenyu.cn/v1/videos"
payload = {
"model": "<string>",
"prompt": "<string>",
"content": [{}],
"generation_category": "<string>",
"first_frame": {},
"last_frame": {},
"images": [{}],
"reference_images": [{}],
"videos": [{}],
"audios": [{}],
"duration": {},
"seconds": {},
"resolution": "<string>",
"ratio": "<string>",
"aspect_ratio": "<string>",
"generate_audio": True,
"watermark": True,
"contains_real_person_material": True,
"extra_body": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
content: [{}],
generation_category: '<string>',
first_frame: {},
last_frame: {},
images: [{}],
reference_images: [{}],
videos: [{}],
audios: [{}],
duration: {},
seconds: {},
resolution: '<string>',
ratio: '<string>',
aspect_ratio: '<string>',
generate_audio: true,
watermark: true,
contains_real_person_material: true,
extra_body: {}
})
};
fetch('https://api.chenyu.cn/v1/videos', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chenyu.cn/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'content' => [
[
]
],
'generation_category' => '<string>',
'first_frame' => [
],
'last_frame' => [
],
'images' => [
[
]
],
'reference_images' => [
[
]
],
'videos' => [
[
]
],
'audios' => [
[
]
],
'duration' => [
],
'seconds' => [
],
'resolution' => '<string>',
'ratio' => '<string>',
'aspect_ratio' => '<string>',
'generate_audio' => true,
'watermark' => true,
'contains_real_person_material' => true,
'extra_body' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.chenyu.cn/v1/videos"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chenyu.cn/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chenyu.cn/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"created_at": 123,
"url": "<string>",
"upstream_response": {}
}直接 API 调用
创建视频任务
创建视频生成任务
POST
/
v1
/
videos
创建视频任务
curl --request POST \
--url https://api.chenyu.cn/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"content": [
{}
],
"generation_category": "<string>",
"first_frame": {},
"last_frame": {},
"images": [
{}
],
"reference_images": [
{}
],
"videos": [
{}
],
"audios": [
{}
],
"duration": {},
"seconds": {},
"resolution": "<string>",
"ratio": "<string>",
"aspect_ratio": "<string>",
"generate_audio": true,
"watermark": true,
"contains_real_person_material": true,
"extra_body": {}
}
'import requests
url = "https://api.chenyu.cn/v1/videos"
payload = {
"model": "<string>",
"prompt": "<string>",
"content": [{}],
"generation_category": "<string>",
"first_frame": {},
"last_frame": {},
"images": [{}],
"reference_images": [{}],
"videos": [{}],
"audios": [{}],
"duration": {},
"seconds": {},
"resolution": "<string>",
"ratio": "<string>",
"aspect_ratio": "<string>",
"generate_audio": True,
"watermark": True,
"contains_real_person_material": True,
"extra_body": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
content: [{}],
generation_category: '<string>',
first_frame: {},
last_frame: {},
images: [{}],
reference_images: [{}],
videos: [{}],
audios: [{}],
duration: {},
seconds: {},
resolution: '<string>',
ratio: '<string>',
aspect_ratio: '<string>',
generate_audio: true,
watermark: true,
contains_real_person_material: true,
extra_body: {}
})
};
fetch('https://api.chenyu.cn/v1/videos', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chenyu.cn/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'content' => [
[
]
],
'generation_category' => '<string>',
'first_frame' => [
],
'last_frame' => [
],
'images' => [
[
]
],
'reference_images' => [
[
]
],
'videos' => [
[
]
],
'audios' => [
[
]
],
'duration' => [
],
'seconds' => [
],
'resolution' => '<string>',
'ratio' => '<string>',
'aspect_ratio' => '<string>',
'generate_audio' => true,
'watermark' => true,
'contains_real_person_material' => true,
'extra_body' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.chenyu.cn/v1/videos"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chenyu.cn/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chenyu.cn/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"content\": [\n {}\n ],\n \"generation_category\": \"<string>\",\n \"first_frame\": {},\n \"last_frame\": {},\n \"images\": [\n {}\n ],\n \"reference_images\": [\n {}\n ],\n \"videos\": [\n {}\n ],\n \"audios\": [\n {}\n ],\n \"duration\": {},\n \"seconds\": {},\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"generate_audio\": true,\n \"watermark\": true,\n \"contains_real_person_material\": true,\n \"extra_body\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"created_at": 123,
"url": "<string>",
"upstream_response": {}
}创建视频任务
创建视频生成任务。视频生成是异步任务,接口会先返回任务 ID,后续通过查询接口获取状态和结果。直接调用
https://api.chenyu.cn/v1/videos 时,大模型网关会负责 API Key 认证、预扣费和终态结算。通过晨羽智云应用接口使用外部模型时,请使用 外部模型任务接口。图片、视频、音频等普通媒体字段直接传资源字符串:公网 URL、
data:image/<format>;base64,<data> 或 asset://asset_xxx。需要声明素材角色或在提示词中引用素材时,使用 { "uri": "...", "role": "reference_image", "label": "人物A" }。本地文件建议先调用 上传资源,再把返回的 asset_uri 字段值放入请求参数。请求格式
推荐使用application/json。接口也兼容 multipart/form-data,表单字段会被解析为 JSON 字段;文件字段 image、image[]、mask、video、video[]、input_video 会被转为 data URL 后继续处理。
请求参数
视频生成模型 ID
视频生成提示词。不传
content 时可直接使用该字段;传入后网关会转换为 content 中的文本项官方内容数组。可直接传文本、图片、视频或音频内容。传了
content 时会保留原结构生成方式。常用值:
text_to_video、first_frame_to_video、first_last_frame、reference_to_video首帧图片。图生视频或首尾帧视频必填。支持公网 URL、data URL、
asset://asset_xxx 或 { "uri": "...", "role": "first_frame" }尾帧图片。首尾帧视频必填。支持公网 URL、data URL、
asset://asset_xxx 或 { "uri": "...", "role": "last_frame" }参考图片列表。数组元素支持公网 URL、data URL、
asset://asset_xxx,也支持带 uri、role 和 label 的对象。传 label 后可在 prompt 中用 @label 引用该素材参考图片列表,等价于
images参考视频列表。多模态参考生视频使用,具体支持范围以模型为准。对象写法支持
uri、role 和 label参考音频列表。多模态参考生视频使用,具体支持范围以模型为准。对象写法支持
uri、role 和 label视频时长,单位秒。例如
5。Seedance 当前支持 4 到 15 秒duration 的兼容别名。也兼容 duration_sec、duration_seconds输出分辨率,例如
480p、720p、1080p。Seedance 2.0 支持 480p、720p、1080p;Seedance Fast 支持 480p、720p画面比例,例如
16:9、9:16、1:1ratio 的兼容别名。multipart/form-data 或 SDK 中传 size=1280x720 时,网关会自动推断为 16:9是否生成音频。具体是否支持以模型为准
是否添加水印。具体是否支持以模型为准
输入图片或视频素材包含真人并需要素材备案时传
true透传给上游渠道的扩展参数。网关会把其中字段展开到请求顶层
响应参数
视频任务 ID。后续查询任务状态时使用
固定为
video实际调用的模型 ID
任务状态,如
queued、running、completed、failed、cancelled创建时间戳
如果上游同步返回视频地址,或查询任务完成后返回视频地址,则包含该字段
上游原始响应摘要,便于排查任务状态
代码示例
import requests
url = "https://api.chenyu.cn/v1/videos"
headers = {
"Authorization": "Bearer your_api_key",
"Content-Type": "application/json"
}
payload = {
"model": "doubao-seedance-2-0-fast-260128",
"generation_category": "text_to_video",
"prompt": "一只白色机器人在未来城市街道上行走,电影感镜头",
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json()["id"])
const axios = require('axios');
axios.post('https://api.chenyu.cn/v1/videos', {
model: 'doubao-seedance-2-0-fast-260128',
generation_category: 'text_to_video',
prompt: '一只白色机器人在未来城市街道上行走,电影感镜头',
duration: 5,
resolution: '720p',
ratio: '16:9'
}, {
headers: {
Authorization: 'Bearer your_api_key',
'Content-Type': 'application/json'
}
}).then((response) => {
console.log(response.data.id);
});
curl -X POST "https://api.chenyu.cn/v1/videos" \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-fast-260128",
"generation_category": "text_to_video",
"prompt": "一只白色机器人在未来城市街道上行走,电影感镜头",
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}'
响应示例
{
"id": "cgt-20260602154730-twmv2",
"object": "video",
"model": "doubao-seedance-2-0-fast-260128",
"status": "queued",
"created_at": 1780000000
}
图生视频示例
{
"model": "doubao-seedance-2-0-260128",
"generation_category": "first_frame_to_video",
"prompt": "闪白转场,女主在茶园悠闲采茶",
"first_frame": "asset://asset_first_frame",
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"contains_real_person_material": true
}
官方 content 格式示例
下面是 OpenAI 兼容的官方content 协议格式,所以图片地址位于 image_url.url。普通媒体字段仍按上文规则直接传资源字符串;只有需要标记素材角色时才使用 { "uri": "...", "role": "..." }。
{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "闪白转场,女主在茶园悠闲采茶"
},
{
"type": "image_url",
"image_url": {
"url": "asset://asset_first_frame"
},
"role": "first_frame"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"contains_real_person_material": true
}
多模态参考示例
{
"model": "doubao-seedance-2-0-fast-260128",
"generation_category": "reference_to_video",
"prompt": "@人物A 和 @人物B 在画面中自然互动,保持人物特征一致",
"images": [
{
"uri": "asset://asset_person_a",
"label": "人物A",
"role": "reference_image"
},
{
"uri": "asset://asset_person_b",
"label": "人物B",
"role": "reference_image"
}
],
"videos": ["asset://asset_reference_video_1"],
"audios": ["asset://asset_reference_audio_1"],
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}
提示词引用素材
当提示词需要明确指向某张图片、某段视频或某段音频时,在资源对象里增加label,并在 prompt 中用 @label 引用。
label建议直接写显示名,例如人物A,不需要带@prompt中写@人物A,也兼容{{人物A}}和{{ 人物A }}- 同一个请求里
label不能重复 - 服务端会把用户自定义标签改写成上游模型需要的内部引用,例如
@人物A会对应到该请求中的@图1
{
"model": "doubao-seedance-2-0-fast-260128",
"generation_category": "reference_to_video",
"prompt": "@阿九 携手 @沈渡 跳舞",
"images": [
{
"uri": "asset://asset_a252553f9364ad0fa635cb7c48793491",
"label": "阿九",
"role": "reference_image"
},
{
"uri": "asset://asset_cf7584e3e836a2b3ee65ef072a71fdd6",
"label": "沈渡",
"role": "reference_image"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}
⌘I