跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://wisdom-docs.juheapi.com/llms.txt

Use this file to discover all available pages before exploring further.

概述

Seedance 原生 Endpoint 格式与火山方舟 Seedance 视频生成 API 直接兼容。与 OpenAI 兼容格式/v1/videos)不同,该格式使用带有类型化多模态条目的 content 数组,可对参考素材、音频、样片任务和生参数进行更精细的控制。

支持的模型

模型分辨率说明
doubao-seedance-2.0480p、720p、1080p全功能支持
doubao-seedance-2-fast480p、720p生成速度更快,分辨率上限较低

创建任务

POST /api/v3/contents/generations/tasks

请求头

Header必填示例
Content-Typeapplication/json
AuthorizationBearer <YOUR_API_KEY>

请求参数

参数类型必填说明
modelstring模型名称:doubao-seedance-2.0doubao-seedance-2-fast
contentobject[]多模态输入数组。详见 content 参数
durationnumber条件必填视频时长(秒),范围 5–15。按秒计费模型必传
framesnumber条件必填总帧数。与 duration 二选一
resolutionstring480p720p1080p2-fast 仅支持 480p/720p)
ratiostring16:99:161:1
seednumber随机种子。-1 表示随机。默认:-1
generate_audioboolean是否生成同步音频。默认:false
watermarkboolean是否添加 AI 生成水印。默认:false
return_last_frameboolean查询结果时是否返回尾帧图像 URL。默认:false
service_tierstring服务等级。默认:default
execution_expires_afternumber任务超时时间(秒)

content 参数

content 中每个条目必须包含 type 及对应的数据字段:
类型必填字段说明
texttext描述所需视频的文本提示词
image_urlimage_url.url图片 URL、Base64 数据 URI 或素材 ID(asset://<ASSET_ID>
video_urlvideo_url.url视频 URL 或素材 ID(asset://<ASSET_ID>
audio_urlaudio_url.url音频 URL、Base64 数据 URI 或素材 ID(asset://<ASSET_ID>
draft_taskdraft_task.id基于样片任务生成正式视频
支持的素材组合:
  • 文本
  • 文本(可选)+ 图片
  • 文本(可选)+ 视频
  • 文本(可选)+ 图片 + 音频
  • 文本(可选)+ 图片 + 视频
  • 文本(可选)+ 视频 + 音频
  • 文本(可选)+ 图片 + 视频 + 音频

role 取值

类型role说明
image_urlfirst_frame图生视频首帧。单张图片不指定 role 时也视为首帧
image_urllast_frame图生视频尾帧。需同时提供 first_frame
image_urlreference_image多模态参考图(Seedance 2.0 支持 1–9 张)
video_urlreference_video多模态参考视频(最多 3 个,总时长 ≤ 15s)
audio_urlreference_audio多模态参考音频(最多 3 段,总时长 ≤ 15s)
图生视频首帧、首尾帧生视频、多模态参考生视频为互斥场景,不要在同一次请求中混用这些模式。

文生视频

curl --location --request POST 'https://api.wisgate.ai/api/v3/contents/generations/tasks' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --data-raw '{
    "model": "doubao-seedance-2.0",
    "content": [
      {
        "type": "text",
        "text": "一只小猫在清晨阳光里伸懒腰,镜头缓慢推进,画面温暖自然。"
      }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "seed": -1,
    "generate_audio": true,
    "watermark": false
  }'

参考素材生视频

curl --location --request POST 'https://api.wisgate.ai/api/v3/contents/generations/tasks' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --data-raw '{
    "model": "doubao-seedance-2.0",
    "content": [
      {
        "type": "text",
        "text": "全程使用视频1的第一视角构图,全程使用音频1作为背景音乐。第一人称视角果茶宣传广告。"
      },
      {
        "type": "image_url",
        "image_url": { "url": "https://example.com/reference.jpg" },
        "role": "reference_image"
      },
      {
        "type": "video_url",
        "video_url": { "url": "https://example.com/reference.mp4" },
        "role": "reference_video"
      },
      {
        "type": "audio_url",
        "audio_url": { "url": "https://example.com/reference.mp3" },
        "role": "reference_audio"
      }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "generate_audio": true,
    "return_last_frame": true
  }'

首尾帧生视频

{
  "model": "doubao-seedance-2.0",
  "content": [
    {
      "type": "text",
      "text": "让画面从首帧自然过渡到尾帧,镜头保持平稳推进。"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/first-frame.png" },
      "role": "first_frame"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/last-frame.png" },
      "role": "last_frame"
    }
  ],
  "resolution": "720p",
  "ratio": "16:9",
  "duration": 5
}

创建响应

{
  "id": "cgt-20260518175249-8x55h"
}

查询任务

GET /api/v3/contents/generations/tasks/{id}

路径参数

参数类型必填说明
idstring创建任务接口返回的任务 ID

请求头

Header必填示例
AuthorizationBearer <YOUR_API_KEY>

查询示例

curl --location --request GET 'https://api.wisgate.ai/api/v3/contents/generations/tasks/cgt-20260518175249-8x55h' \
  --header 'Authorization: Bearer <YOUR_API_KEY>'

成功响应

{
  "id": "cgt-20260518175249-8x55h",
  "model": "doubao-seedance-2-0-260128",
  "status": "succeeded",
  "error": null,
  "created_at": 1778756838,
  "updated_at": 1778757081,
  "content": {
    "video_url": "https://example.com/generated-video.mp4?signature=<SIGNED_URL_PARAMS>",
    "last_frame_url": "https://example.com/last-frame.png?signature=<SIGNED_URL_PARAMS>"
  },
  "seed": 29545,
  "resolution": "720p",
  "ratio": "16:9",
  "duration": 5,
  "framespersecond": 24,
  "generate_audio": true,
  "service_tier": "default",
  "execution_expires_after": 172800,
  "usage": {
    "completion_tokens": 173700,
    "total_tokens": 173700
  }
}

响应字段

字段类型说明
idstring任务 ID
modelstring上游实际使用的模型
statusstring任务状态:queuedrunningsucceededfailedexpiredcancelled
errorobject / null失败时的错误信息
created_atnumber创建时间戳(Unix 秒)
updated_atnumber最后更新时间戳(Unix 秒)
content.video_urlstring生成视频 URL(带签名的临时链接,请及时下载)
content.last_frame_urlstring尾帧图像 URL(仅当 return_last_frametrue 时返回)
seednumber生成使用的随机种子
resolutionstring视频分辨率
ratiostring视频宽高比
durationnumber视频时长(秒)
framesnumber总帧数(按帧计费模型)
framespersecondnumber帧率(FPS)
generate_audioboolean是否生成了同步音频
service_tierstring服务等级
execution_expires_afternumber结果保留时长(秒)
usage.completion_tokensnumber生成消耗的 token 数
usage.total_tokensnumber总 token 消耗

完整工作流

import requests
import time

BASE_URL = "https://api.wisgate.ai"
HEADERS = {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
}

# 第一步:创建任务
response = requests.post(
    f"{BASE_URL}/api/v3/contents/generations/tasks",
    headers=HEADERS,
    json={
        "model": "doubao-seedance-2.0",
        "content": [{"type": "text", "text": "一只猫在阳光明媚的街道上走"}],
        "resolution": "720p",
        "ratio": "16:9",
        "duration": 5
    }
)
task_id = response.json()["id"]
print(f"任务已创建: {task_id}")

# 第二步:轮询状态并下载
while True:
    result = requests.get(
        f"{BASE_URL}/api/v3/contents/generations/tasks/{task_id}",
        headers={"Authorization": HEADERS["Authorization"]}
    ).json()

    status = result["status"]
    print(f"状态: {status}")

    if status == "succeeded":
        video_url = result["content"]["video_url"]
        video = requests.get(video_url, stream=True)
        with open("generated_video.mp4", "wb") as f:
            for chunk in video.iter_content(chunk_size=8192):
                f.write(chunk)
        print("视频下载成功!")
        break
    elif status in ("failed", "expired", "cancelled"):
        print(f"任务结束: {status},错误: {result.get('error')}")
        break

    time.sleep(10)

参数限制

参数支持值
duration515
ratio16:99:161:1
resolution480p720p1080p
content.image_url.url公网 URL、data:image/<format>;base64,<BASE64>asset://<ASSET_ID>
content.video_url.url公网 URL 或 asset://<ASSET_ID>
content.audio_url.url公网 URL、data:audio/<format>;base64,<BASE64>asset://<ASSET_ID>

注意事项

API Key 安全 不要在代码、文档、日志或截图中暴露真实 API Key。请使用环境变量或占位符替代。
人像内容政策 Seedance 2.0 系列模型不支持直接上传含有真人人脸的参考图或参考视频。如需肖像素材,请使用平台支持的合规素材、虚拟人像或已授权素材。
及时下载 content.video_url 通常是带有效期的签名链接,请在过期前下载或转存。可通过 execution_expires_after 字段查看保留时长。
轮询间隔 如果任务尚未完成,请间隔数秒重复查询任务接口。避免过于频繁的轮询以防止触发频率限制。
  • /v1/videos/api/v3/contents/generations/tasks 的请求体格式不同,不要混用 prompt/sizecontent/ratio/resolution 字段。
  • 大文件建议使用公网 URL 或素材 ID,避免使用 Base64 编码导致请求体过大。
  • 如果 API Key 已暴露或泄露,请立即轮换或作废该 Key。

格式对比

功能OpenAI 兼容 (/v1/videos)Seedance 原生 (/api/v3/...)
内容输入prompt + images[] + videos[]content[] 含类型化条目
音频参考不支持audio_url 类型
样片任务不支持draft_task 类型
分辨率格式1280x7201920x1080720p1080p480p
宽高比size 字段ratio 字段(16:99:161:1
水印控制不支持watermark 布尔值
尾帧获取不支持return_last_frame 布尔值
种子控制不直接暴露seed 字段
简单的文生视频和基础图片/视频参考场景建议使用 OpenAI 兼容格式。需要音频参考、样片任务、水印控制或尾帧获取等进阶功能时,建议使用 Seedance 原生格式。