curl --request POST \
--url https://api.example.com/v1/seedance/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"callback_url": "<string>",
"return_last_frame": true,
"service_tier": "<string>",
"execution_expires_after": 123,
"camera_fixed": true,
"generate_audio": true,
"safety_identifier": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"role": "<string>"
}
],
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"frames": 123,
"seed": 123,
"watermark": true,
"draft": true,
"priority": 123
}
'import requests
url = "https://api.example.com/v1/seedance/video/generations"
payload = {
"model": "<string>",
"callback_url": "<string>",
"return_last_frame": True,
"service_tier": "<string>",
"execution_expires_after": 123,
"camera_fixed": True,
"generate_audio": True,
"safety_identifier": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"role": "<string>"
}
],
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"frames": 123,
"seed": 123,
"watermark": True,
"draft": True,
"priority": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
callback_url: '<string>',
return_last_frame: true,
service_tier: '<string>',
execution_expires_after: 123,
camera_fixed: true,
generate_audio: true,
safety_identifier: '<string>',
content: [{type: '<string>', text: '<string>', role: '<string>'}],
resolution: '<string>',
ratio: '<string>',
duration: 123,
frames: 123,
seed: 123,
watermark: true,
draft: true,
priority: 123
})
};
fetch('https://api.example.com/v1/seedance/video/generations', 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.example.com/v1/seedance/video/generations",
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>',
'callback_url' => '<string>',
'return_last_frame' => true,
'service_tier' => '<string>',
'execution_expires_after' => 123,
'camera_fixed' => true,
'generate_audio' => true,
'safety_identifier' => '<string>',
'content' => [
[
'type' => '<string>',
'text' => '<string>',
'role' => '<string>'
]
],
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'frames' => 123,
'seed' => 123,
'watermark' => true,
'draft' => true,
'priority' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/v1/seedance/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/seedance/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/seedance/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}Seedance 视频生成接口
兼容 Seedance 官方协议的视频生成接口,支持文生视频、图生视频、参考媒体与同步音频生成
curl --request POST \
--url https://api.example.com/v1/seedance/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"callback_url": "<string>",
"return_last_frame": true,
"service_tier": "<string>",
"execution_expires_after": 123,
"camera_fixed": true,
"generate_audio": true,
"safety_identifier": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"role": "<string>"
}
],
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"frames": 123,
"seed": 123,
"watermark": true,
"draft": true,
"priority": 123
}
'import requests
url = "https://api.example.com/v1/seedance/video/generations"
payload = {
"model": "<string>",
"callback_url": "<string>",
"return_last_frame": True,
"service_tier": "<string>",
"execution_expires_after": 123,
"camera_fixed": True,
"generate_audio": True,
"safety_identifier": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"role": "<string>"
}
],
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"frames": 123,
"seed": 123,
"watermark": True,
"draft": True,
"priority": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
callback_url: '<string>',
return_last_frame: true,
service_tier: '<string>',
execution_expires_after: 123,
camera_fixed: true,
generate_audio: true,
safety_identifier: '<string>',
content: [{type: '<string>', text: '<string>', role: '<string>'}],
resolution: '<string>',
ratio: '<string>',
duration: 123,
frames: 123,
seed: 123,
watermark: true,
draft: true,
priority: 123
})
};
fetch('https://api.example.com/v1/seedance/video/generations', 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.example.com/v1/seedance/video/generations",
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>',
'callback_url' => '<string>',
'return_last_frame' => true,
'service_tier' => '<string>',
'execution_expires_after' => 123,
'camera_fixed' => true,
'generate_audio' => true,
'safety_identifier' => '<string>',
'content' => [
[
'type' => '<string>',
'text' => '<string>',
'role' => '<string>'
]
],
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'frames' => 123,
'seed' => 123,
'watermark' => true,
'draft' => true,
'priority' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/v1/seedance/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/seedance/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/seedance/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"camera_fixed\": true,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"content\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"role\": \"<string>\"\n }\n ],\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"frames\": 123,\n \"seed\": 123,\n \"watermark\": true,\n \"draft\": true,\n \"priority\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}model 须为平台模型标识,路由后由网关改写为渠道模型名;callback_url 由网关覆盖注入带签名的默认回调地址。
功能特性
- 内容元素列表
content支持文本、图片、视频、音频与草稿任务五种类型 - 支持首帧 / 尾帧 / 参考图(2.0 系列 1-9 张)/ 参考视频 / 参考音频输入
- 支持同步音频生成
generate_audio(仅 Seedance 2.0 系列与 1.5 Pro) - 支持在线 / 离线推理
service_tier与任务超时阈值execution_expires_after - 支持草稿模式
draft(仅 1.5 Pro)、尾帧返回return_last_frame、任务优先级priority(仅 2.0) - 支持视频编辑(仅 2.5),可编辑原视频的画面或音频,在视频中添加、删除或修改物体,或重绘、修复部分画面
- 支持视频延长(仅 2.5),可向前或向后扩展原视频
认证方式
在请求头中携带Authorization 字段,格式为 Bearer YOUR_API_KEY。
支持的视频模型
| 模型标识 | 模型类型 | 模型描述 |
|---|---|---|
| seedance-2.5 | 参考生视频 | seedance 2.5 是新一代视频创作模型,在长叙事、多模态参考与编辑能力上有重大改进 |
| seedance-2.0 | 参考生视频 | seedance 旗舰视频生成模型 |
| seedance-2.0-mini | 参考生视频 | 新一代高性价比视频生成模型 |
| seedance-2.0-fast | 参考生视频 | 继承了Seedance-2.0的核心功能和优势,速度更快 |
快速示例
import requests
url = "https://api.haitoken.ai/v1/seedance/video/generations"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "seedance-2.0",
"content": [
{"type": "text", "text": "一只金毛犬在日落的海边奔跑,镜头缓慢跟随"},
{
"type": "image_url",
"image_url": {"url": "https://example.com/images/dog.png"},
"role": "first_frame"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": True,
"watermark": False
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const response = await fetch('https://api.haitoken.ai/v1/seedance/video/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'seedance-2.0',
content: [
{ type: 'text', text: '一只金毛犬在日落的海边奔跑,镜头缓慢跟随' },
{
type: 'image_url',
image_url: { url: 'https://example.com/images/dog.png' },
role: 'first_frame'
}
],
duration: 5,
resolution: '720p',
ratio: '16:9',
generate_audio: true,
watermark: false
})
});
const data = await response.json();
console.log(data);
curl -X POST 'https://api.haitoken.ai/v1/seedance/video/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "seedance-2.0",
"content": [
{"type": "text", "text": "一只金毛犬在日落的海边奔跑,镜头缓慢跟随"},
{
"type": "image_url",
"image_url": {"url": "https://example.com/images/dog.png"},
"role": "first_frame"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}'
{
"id": "cgt-20260730120000-a1b2c3"
}
下一步
- 查看 查询 Seedance 视频任务 获取生成结果
- 查看 视频生成 了解统一协议
- 查看 万相协议 了解阿里万相原生参数
- 查看 模型列表 了解可用的视频模型
请求体
平台模型标识(如 seedance-2.0),路由后由网关改写为渠道模型名
结果回调地址(任务状态变更时上游 POST 通知;网关配置回调后覆盖注入带签名的默认地址)
是否返回生成视频的尾帧图(PNG,与视频同分辨率且无水印),默认 false; 可用于以上一视频尾帧作为下一任务首帧,快速生成多段连续视频
服务层级:default 在线推理(默认)/ flex 离线推理(价格为在线 50%); Seedance 2.0 系列仅支持在线推理,不支持配置该参数
任务超时阈值(秒),自 created_at 起算,取值 [3600, 259200],默认 172800(48 小时); 超时后任务自动终止并标记为 expired
是否固定镜头,默认 false;参考图场景与 Seedance 2.0 系列不支持
是否生成与画面同步的音频(人声/音效/背景音乐),默认 true; 仅 Seedance 2.0 系列与 1.5 Pro 支持
终端用户唯一标识(用于平台安全审计,英文且长度不超过 64 字符, 建议传入用户名/用户ID/邮箱的哈希值,避免泄露隐私)
内容元素列表(文本提示词 / 图片 / 视频 / 音频 / 草稿任务ID)
Show child attributes
Show child attributes
生成视频分辨率:480p / 720p / 1080p / 4k; Seedance 2.0 系列与 1.5 Pro 默认 720p,1.0 Pro / Pro Fast 默认 1080p; 1080p 不支持 2.0 Fast / 2.0 Mini,4k 仅支持 Seedance 2.0
生成视频宽高比:16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive(按输入智能选择)
生成视频时长(整数秒),与 frames 二选一且 frames 优先,默认 5; Seedance 1.0 Pro / Pro Fast:[2, 12];1.5 Pro:[4, 12] 或 -1(模型智能选择时长); Seedance 2.0 系列:[4, 15] 或 -1
生成视频帧数(与 duration 二选一且优先),用于生成小数千秒的时长; 仅 Seedance 1.0 Pro / Pro Fast 支持(2.0 系列与 1.5 Pro 不支持), 取值 [29, 289] 且满足 25 + 4n(帧率 24,帧数 = 秒数 × 24)
随机种子,取值 [-1, 2^32-1],默认 -1(随机);Seedance 2.0 系列不支持
生成视频是否带 "AI Generated" 水印,默认 false
是否启用草稿模式(480p 预览视频,费用更低,用于快速验证),默认 false; 仅 Seedance 1.5 Pro 支持;草稿模式不支持尾帧返回与离线推理
任务执行优先级 0-9,值越大排队越靠前,默认 0; 仅 Seedance 2.0 支持,仅作用于同一 Endpoint 的排队顺序,离线推理(flex)不支持
响应
任务ID