创建 Seedance 视频生成任务
curl --request POST \
--url https://api-vip.apigo.ai/api/v3/contents/generations/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "dreamina-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "让图片1中的苹果轻微运动,保留主体及构图。"
},
{
"type": "image_url",
"role": "reference_image",
"image_url": {
"url": "asset://asset-20261020080000-abcde"
}
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": false,
"watermark": false
}
'import requests
url = "https://api-vip.apigo.ai/api/v3/contents/generations/tasks"
payload = {
"model": "dreamina-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "让图片1中的苹果轻微运动,保留主体及构图。"
},
{
"type": "image_url",
"role": "reference_image",
"image_url": { "url": "asset://asset-20261020080000-abcde" }
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": False,
"watermark": False
}
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: 'dreamina-seedance-2-0-260128',
content: [
{type: 'text', text: '让图片1中的苹果轻微运动,保留主体及构图。'},
{
type: 'image_url',
role: 'reference_image',
image_url: {url: 'asset://asset-20261020080000-abcde'}
}
],
duration: 5,
resolution: '720p',
ratio: '16:9',
generate_audio: false,
watermark: false
})
};
fetch('https://api-vip.apigo.ai/api/v3/contents/generations/tasks', 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-vip.apigo.ai/api/v3/contents/generations/tasks",
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' => 'dreamina-seedance-2-0-260128',
'content' => [
[
'type' => 'text',
'text' => '让图片1中的苹果轻微运动,保留主体及构图。'
],
[
'type' => 'image_url',
'role' => 'reference_image',
'image_url' => [
'url' => 'asset://asset-20261020080000-abcde'
]
]
],
'duration' => 5,
'resolution' => '720p',
'ratio' => '16:9',
'generate_audio' => false,
'watermark' => false
]),
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-vip.apigo.ai/api/v3/contents/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\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-vip.apigo.ai/api/v3/contents/generations/tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-vip.apigo.ai/api/v3/contents/generations/tasks")
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\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "task_20261020080000abcdef"
}{
"error": {
"code": "InvalidParameter",
"message": "Asset 'asset-20261020080000-abcde' is still processing. Use it after its status becomes Active.",
"param": "",
"type": "BadRequest"
}
}{
"error": {
"code": "AuthenticationError",
"message": "The API key is missing or invalid.",
"param": "",
"type": "Unauthorized"
}
}{
"error": {
"code": "AccountOverdueError",
"message": "Your account balance is insufficient.",
"param": "",
"type": "Forbidden"
}
}{
"error": {
"code": "InvalidEndpointOrModel.NotFound",
"message": "The model or endpoint does not exist or you do not have access to it.",
"param": "",
"type": "NotFound"
}
}{
"error": {
"code": "AccountRateLimitExceeded",
"message": "Too many requests, please retry later.",
"param": "",
"type": "TooManyRequests"
}
}视频
/api/v3/contents/generations/tasks
提交文本与参考媒体,异步生成视频。创建成功只返回任务 ID,需轮询查询接口获取结果。
POST
/
api
/
v3
/
contents
/
generations
/
tasks
创建 Seedance 视频生成任务
curl --request POST \
--url https://api-vip.apigo.ai/api/v3/contents/generations/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "dreamina-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "让图片1中的苹果轻微运动,保留主体及构图。"
},
{
"type": "image_url",
"role": "reference_image",
"image_url": {
"url": "asset://asset-20261020080000-abcde"
}
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": false,
"watermark": false
}
'import requests
url = "https://api-vip.apigo.ai/api/v3/contents/generations/tasks"
payload = {
"model": "dreamina-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "让图片1中的苹果轻微运动,保留主体及构图。"
},
{
"type": "image_url",
"role": "reference_image",
"image_url": { "url": "asset://asset-20261020080000-abcde" }
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": False,
"watermark": False
}
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: 'dreamina-seedance-2-0-260128',
content: [
{type: 'text', text: '让图片1中的苹果轻微运动,保留主体及构图。'},
{
type: 'image_url',
role: 'reference_image',
image_url: {url: 'asset://asset-20261020080000-abcde'}
}
],
duration: 5,
resolution: '720p',
ratio: '16:9',
generate_audio: false,
watermark: false
})
};
fetch('https://api-vip.apigo.ai/api/v3/contents/generations/tasks', 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-vip.apigo.ai/api/v3/contents/generations/tasks",
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' => 'dreamina-seedance-2-0-260128',
'content' => [
[
'type' => 'text',
'text' => '让图片1中的苹果轻微运动,保留主体及构图。'
],
[
'type' => 'image_url',
'role' => 'reference_image',
'image_url' => [
'url' => 'asset://asset-20261020080000-abcde'
]
]
],
'duration' => 5,
'resolution' => '720p',
'ratio' => '16:9',
'generate_audio' => false,
'watermark' => false
]),
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-vip.apigo.ai/api/v3/contents/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\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-vip.apigo.ai/api/v3/contents/generations/tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-vip.apigo.ai/api/v3/contents/generations/tasks")
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\": \"dreamina-seedance-2-0-260128\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"让图片1中的苹果轻微运动,保留主体及构图。\"\n },\n {\n \"type\": \"image_url\",\n \"role\": \"reference_image\",\n \"image_url\": {\n \"url\": \"asset://asset-20261020080000-abcde\"\n }\n }\n ],\n \"duration\": 5,\n \"resolution\": \"720p\",\n \"ratio\": \"16:9\",\n \"generate_audio\": false,\n \"watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "task_20261020080000abcdef"
}{
"error": {
"code": "InvalidParameter",
"message": "Asset 'asset-20261020080000-abcde' is still processing. Use it after its status becomes Active.",
"param": "",
"type": "BadRequest"
}
}{
"error": {
"code": "AuthenticationError",
"message": "The API key is missing or invalid.",
"param": "",
"type": "Unauthorized"
}
}{
"error": {
"code": "AccountOverdueError",
"message": "Your account balance is insufficient.",
"param": "",
"type": "Forbidden"
}
}{
"error": {
"code": "InvalidEndpointOrModel.NotFound",
"message": "The model or endpoint does not exist or you do not have access to it.",
"param": "",
"type": "NotFound"
}
}{
"error": {
"code": "AccountRateLimitExceeded",
"message": "Too many requests, please retry later.",
"param": "",
"type": "TooManyRequests"
}
}使用
可用的时长、分辨率、比例和计费规则以账号开通情况为准。
Authorization: Bearer <API_KEY> 鉴权。任务异步执行,创建成功只返回任务 ID,需调用查询视频生成任务获取结果。
模型
| 模型 ID | 说明 |
|---|---|
dreamina-seedance-2-0-260128 | Seedance 2.0 |
content 元素
| 类型 | 写法 |
|---|---|
| 文本 | {"type":"text","text":"提示词"} |
| 图片 | {"type":"image_url","role":"reference_image","image_url":{"url":"asset://<素材ID>"}} |
| 音频 | {"type":"audio_url","role":"reference_audio","audio_url":{"url":"asset://<素材ID>"}} |
| 视频 | {"type":"video_url","role":"reference_video","video_url":{"url":"asset://<素材ID>"}} |
url可以是素材库中Status=Active的素材(asset://<素材ID>),也可以是可公开访问的 HTTP(S) 地址。素材的导入方式见素材库。- 提示词中用“图片1”“音频1”“视频1”按同类媒体在
content中出现的顺序指代参考媒体。 - 音频不能作为唯一参考媒体,需搭配图片或视频。
audio_url是输入的参考音频,generate_audio控制输出视频是否带声音,两者独立。使用参考音频或参考视频原声时,generate_audio传true。
素材引用错误
引用素材不可用时返回 HTTP 400,error.code 为 InvalidParameter:
| message | 处理方式 |
|---|---|
Asset '<ID>' does not exist. | 检查素材 ID 是否正确、是否已删除 |
Asset '<ID>' is still processing. Use it after its status becomes Active. | 等待 GetAsset 返回 Active 后再提交 |
Asset '<ID>' failed processing and cannot be used. | 素材处理失败,修正来源文件后重新导入 |
The referenced assets cannot be used together in one request. | 所引用的素材不能在同一请求中组合使用。新建一个素材组,把本次要用的素材全部重新导入,等全部变为 Active 后再引用 |
错误码
| HTTP 状态码 | error.type | error.code | 说明 |
|---|---|---|---|
| 400 | BadRequest | InvalidParameter | JSON 不合法、缺少字段、类型错误或素材引用不可用 |
| 400 | BadRequest | InvalidParameter.UnsupportedImageFormat、InputImageSensitiveContentDetected 等 | 媒体格式、参数或内容审核不通过。param 可能为空,请同时查看 message |
| 401 | Unauthorized | AuthenticationError | API Key 缺失或无效 |
| 403 | Forbidden | AccountOverdueError | 余额不足 |
| 403 | Forbidden | AccessDenied | IP 白名单或模型权限不允许调用 |
| 404 | NotFound | InvalidEndpointOrModel.NotFound | 模型不存在或当前不可用 |
| 429 | TooManyRequests | AccountRateLimitExceeded | 请求过于频繁 |
| 429 | TooManyRequests | QuotaExceeded | 达到 API Key 设置的额度上限 |
| 500 | InternalServerError | InternalServiceError | 服务内部或上游异常 |
创建请求超时或连接中断时,任务可能已经创建。直接重试可能产生重复任务。
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
模型 ID。
示例:
"dreamina-seedance-2-0-260128"
文本与参考媒体数组。提示词用“图片1”“音频1”“视频1”按同类素材出现顺序指代参考媒体。
Show child attributes
Show child attributes
视频时长(秒)。
示例:
5
输出分辨率,例如 720p。
示例:
"720p"
画面比例,例如 16:9、1:1。
示例:
"16:9"
是否生成声音。使用参考音频或参考视频原声时传 true。
是否添加水印。
任务优先级。传入后会在查询结果中回传。
终端用户标识,建议使用不可逆的哈希值。传入后会在查询结果中回传。
响应
任务已创建
任务 ID。
