S
Seedance 2.0 API 指南

Seedance 2.0 视频生成 API

通过 TokenHub 统一 API 访问 ByteDance Seedance 2.0 视频生成 model。支持文生视频、图生视频、视频编辑、音频驱动生成等能力。本指南将带你完成完整的集成流程。

Text → VideoImage → VideoVideo → VideoAudio Reference480p / 720p4–15 秒

1获取你的 API Key

  1. 访问 tokenhub.store 创建账号(支持 GitHub / Google 登录)
  2. 前往 Dashboard → API Keys,点击“Create New Key”
  3. 前往 Dashboard → Billing 添加 Credits(1 Credit = $1 USD)
  4. 复制你的 API Key(格式: th-xxxxxxxxxxxx...
⚠️ API Key 仅会在创建时显示一次。请妥善保存。如果丢失,需要重新创建新的。

2API 概览

Base URL

https://tokenhub.store/api/v1

认证

所有请求都需要在请求头中携带 API Key:

Header
Authorization: Bearer th-your-api-key

两个端点

POST
/videos/generations

创建视频生成任务,返回任务 ID

GET
/videos/generations/{task_id}

查询任务状态,成功时返回视频 URL

3模型与定价

模型 ID分辨率输出速率描述
doubao-seedance-2.0720p$0.20/sFlagship model, highest quality
480p$0.12/s标准画质,性价比高
doubao-seedance-2.0-fast720p$0.16/sFast model, quicker generation
480p$0.10/s最实惠的选项

计费说明:

  • 输出视频:按实际时长 × 速率计费
  • 输入图片:免费(不收费)
  • 输入视频:按输入视频时长 × 速率计费
  • 总费用 = (输入视频时长 + 输出视频时长)× 速率

示例:doubao-seedance-2.0(720p),5s 输入视频 + 10s 输出 → 费用 = (5+10)×$0.20 = $3.00

4请求参数

参数类型必填描述
modelstring必填模型 ID,例如 "doubao-seedance-2.0"
promptstring必填视频描述文本。英文提示词通常效果更好
durationnumber可选视频时长(秒),范围 4–15,默认 5
resolutionstring可选"480p" 或 "720p"(默认 720p)
aspect_ratiostring可选宽高比:"adaptive"(默认)、"16:9"、"9:16"、"1:1" 等
image_urlstring可选参考图片 URL(image-to-video)
image_urlsstring[]可选多个参考图片 URL 的数组
video_urlstring可选参考视频 URL(视频编辑 / video-to-video)
video_urlsstring[]可选多个参考视频 URL 的数组(最多 3 个)
video_durationsnumber[]可选每个视频的时长数组,单位秒,例如 [3, 5]
input_video_durationnumber可选输入视频总时长,单位秒(video_durations 的替代项)
audio_urlstring可选参考音频 URL(背景音乐 / SFX)
audio_urlsstring[]可选多个参考音频 URL 的数组(最多 3 个)
generate_audioboolean可选是否生成音频,默认 true
watermarkboolean可选是否添加水印,默认 false
contentarray可选媒体资源数组。每项:{ type: "image_url", image_url: { url }, role }。支持的 role:first_frame(最多 1 个)、last_frame(最多 1 个)、reference_image、reference_video、reference_audio

5输入限制

你可以自由组合文本、图片、视频和音频作为输入。请注意以下限制:

图片:每次请求 0–9 张
视频:每次请求 0–3 个,每个 2–15 秒,总时长 ≤ 15 秒
音频:每次请求 0–3 个,每个 2–15 秒,总时长 ≤ 15 秒
❌ 不支持仅“文本 + 音频”和“纯音频”输入

支持的格式

  • 图片格式:JPEG、PNG、WebP、BMP、TIFF、GIF(每个最大 30MB)
  • 视频格式:MP4、MOV(H.264/H.265,每个最大 50MB)
  • 音频格式:WAV、MP3(每个最大 15MB)
⚡ 提示:只有视频时长会影响计费。总费用 =(输入视频时长 + 输出视频时长)× 费率。输入图片免费。

6完整 API 示例

最基础的用法——用文本描述一个场景来生成视频。

bash
curl -X POST https://tokenhub.store/api/v1/videos/generations \
  -H "Authorization: Bearer th-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2.0",
    "prompt": "A golden retriever running on a sunny beach, waves crashing in the background, cinematic slow motion, 4K quality",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "watermark": false
  }'

响应:

json
{
  "id": "xxxxxx-task-id",
  "object": "video.generation.task",
  "model": "doubao-seedance-2.0",
  "status": "queued",
  "created": 1719900000
}

视频生成是异步的——请轮询状态直到完成。

bash
# Poll task status using the task_id from creation response
curl https://tokenhub.store/api/v1/videos/generations/YOUR_TASK_ID \
  -H "Authorization: Bearer th-your-api-key"

任务进行中:

json
{
  "id": "YOUR_TASK_ID",
  "object": "video.generation.task",
  "model": "doubao-seedance-2.0",
  "status": "running",
  "created": 1719900000
}

任务已完成(已收到视频 URL):

json
{
  "id": "YOUR_TASK_ID",
  "object": "video.generation.task",
  "model": "doubao-seedance-2.0",
  "status": "succeeded",
  "created": 1719900000,
  "data": [
    {
      "video_url": "https://xxx.volces.com/output-video.mp4",
      "cover_image_url": "https://xxx.volces.com/cover.jpg"
    }
  ],
  "usage": {
    "video_duration": 5
  }
}
💡 推荐轮询间隔:每 3-5 秒一次。状态值:queued → waiting,running → generating,succeeded → done,failed → error

7Python 完整示例

python
import requests
import time

API_BASE = "https://tokenhub.store/api/v1"
API_KEY = "th-your-api-key"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Step 1: Create video generation task
payload = {
    "model": "doubao-seedance-2.0",
    "prompt": "A majestic eagle soaring over snow-capped mountains, golden hour lighting, cinematic aerial shot",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "watermark": False
}

resp = requests.post(f"{API_BASE}/videos/generations", json=payload, headers=headers)
task = resp.json()
task_id = task["id"]
print(f"Task created: {task_id}, status: {task['status']}")

# Step 2: Poll for result
while True:
    resp = requests.get(f"{API_BASE}/videos/generations/{task_id}", headers=headers)
    result = resp.json()
    status = result["status"]
    print(f"Status: {status}")

    if status == "succeeded":
        video_url = result["data"][0]["video_url"]
        duration = result["usage"]["video_duration"]
        print(f"Video ready! Duration: {duration}s")
        print(f"URL: {video_url}")
        break
    elif status == "failed":
        print(f"Failed: {result.get('error', {}).get('message', 'Unknown error')}")
        break

    time.sleep(5)

8JavaScript / Node.js 完整示例

javascript
const API_BASE = "https://tokenhub.store/api/v1";
const API_KEY = "th-your-api-key";

const headers = {
  "Authorization": `Bearer ${API_KEY}`,
  "Content-Type": "application/json"
};

// Step 1: Create task
const createResp = await fetch(`${API_BASE}/videos/generations`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    model: "doubao-seedance-2.0",
    prompt: "A majestic eagle soaring over snow-capped mountains, cinematic aerial shot",
    duration: 5,
    resolution: "720p",
    aspect_ratio: "16:9",
    watermark: false,
  }),
});
const task = await createResp.json();
console.log("Task created:", task.id);

// Step 2: Poll for result
const poll = async () => {
  while (true) {
    const resp = await fetch(`${API_BASE}/videos/generations/${task.id}`, { headers });
    const result = await resp.json();
    console.log("Status:", result.status);

    if (result.status === "succeeded") {
      console.log("Video URL:", result.data[0].video_url);
      console.log("Duration:", result.usage.video_duration, "seconds");
      return result;
    }
    if (result.status === "failed") {
      console.error("Failed:", result.error?.message);
      return result;
    }
    await new Promise(r => setTimeout(r, 5000));
  }
};

await poll();

9图生视频 Python 示例

python
import requests, time

API_BASE = "https://tokenhub.store/api/v1"
headers = {
    "Authorization": "Bearer th-your-api-key",
    "Content-Type": "application/json"
}

# Image-to-Video with a single reference image
payload = {
    "model": "doubao-seedance-2.0",
    "prompt": "The woman in the photo turns to face the camera and smiles warmly, her hair gently blowing in the wind",
    "duration": 5,
    "resolution": "720p",
    "image_url": "https://your-bucket.com/portrait.jpg",
    "watermark": False
}

resp = requests.post(f"{API_BASE}/videos/generations", json=payload, headers=headers)
task_id = resp.json()["id"]
print(f"Task: {task_id}")

# Poll for result
while True:
    r = requests.get(f"{API_BASE}/videos/generations/{task_id}", headers=headers).json()
    if r["status"] == "succeeded":
        print(f"Done: {r['data'][0]['video_url']}")
        break
    elif r["status"] == "failed":
        print(f"Error: {r.get('error', {}).get('message')}")
        break
    time.sleep(5)

10Prompt 提示

基本结构

推荐格式:[主体] + [动作] + [环境/背景] + [镜头/风格]

优秀 Prompt 示例

  • "A young woman walking through a cherry blossom garden, petals falling in slow motion, soft natural lighting, cinematic 35mm film look"
  • "Close-up of hands pouring latte art into a ceramic cup, steam rising, warm cafe ambiance, shallow depth of field"
  • "Aerial drone shot of a winding river through autumn forest, golden and red leaves, morning mist, 4K cinematic"

参考图片/视频提示

  • 在 prompt 中使用“image 1”“image 2”“video 1”“audio 1”来引用你的资源
  • 按时间段指定场景内容(例如:“0-2s: xxx, 2-4s: xxx”)
  • 指定起止帧(例如:“first frame is image 1”,“end frame freezes on image 2”)
  • 指定镜头构图来源(例如:“use video 1 POV throughout”)
  • 指定音频用途(例如:“use audio 1 as background music throughout”)

提示

  • 英文 prompt 通常效果更好;也支持中文
  • 描述越具体、越生动,效果越好
  • 避免过于抽象的描述(例如:“一个不错的视频”)
  • 镜头语言能显著提升效果(慢动作、特写、航拍、跟拍……)

11常见问题

准备开始了吗?

注册 TokenHub,立即开始使用 Seedance 2.0 Video Generation API

© 2026 TokenHub · Powered by ByteDance Seedance 2.0 · support@tokenhub.store