Skip to content

Seedance

Seedance 2 支持同步音频、首尾帧控制与多模态参考。

API 接口

操作端点模式
视频生成任务POST /v1/async/videos/generations仅异步

模型

模型 id说明
seedance-2完整画质,最高 4kseconds415
seedance-2-fast更快,最高 720pseconds415
seedance-2-mini最低成本,最高 720pseconds4 / 8 / 10 / 12 / 15。仅允许 n=1

价格

n × seconds × 单价(resolution) 计费。默认 720p

模型480p720p1080p4K
seedance-2-mini4/秒8/秒
seedance-2-fast6/秒13/秒
seedance-28/秒16/秒38/秒78/秒

示例:seedance-2 + 720p + seconds=5 + n=116 × 5 = 80 积分。

请求字段

字段类型必填说明
modelstringseedance-2 / seedance-2-fast / seedance-2-mini
promptstring1–2000 字符
secondsinteger时长(秒),范围因模型而异
resolutionstring480p / 720p(默认)/ 1080p / 4k(视模型支持)
ninteger默认 1,范围 19(mini 仅允许 1
imagestring | string[]图生视频公网 http(s) URL
providerOptionsobject可选模型扩展参数。详见下方 providerOptions

providerOptions

seedance-2 / seedance-2-fast / seedance-2-mini 共用下列字段。

字段类型说明
aspect_ratiostring画幅:21:9 / 16:9 / 4:3 / 1:1 / 3:4 / 9:16 / adaptive
generate_audiobooleantrue 生成同步音频;false 输出无声视频
seedinteger随机种子,用于尽量复现结果
image_with_rolesobject[]带角色的参考图(见下方);与顶层 image 二选一,同时传时优先本字段
video_with_rolesobject[]带角色的参考视频;元素形如 { "url", "role": "reference_video" }
audio_with_rolesobject[]带角色的参考音频;元素形如 { "url", "role": "reference_audio" };不能单独使用,需配合图片或视频参考
metadataobject透传扩展字段(网关不解释)

image_with_roles

每项:{ "url": "<http(s) URL>", "role": "<角色>" }

role说明数量
first_frame首帧最多 1
last_frame尾帧最多 1
reference_image参考图(风格 / 人物等)最多 9

模式互斥:首帧 / 首尾帧 与 参考图模式不要混用。简单图生可用顶层 image;需要首尾帧或显式角色时用 image_with_roles

示例

bash
curl https://api.pixapi.ai/v1/async/videos/generations \
  -H "Authorization: Bearer $PIXAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "seedance-2",
  "prompt": "一只柴犬穿过霓虹雨夜街道",
  "n": 1,
  "seconds": 5,
  "resolution": "720p",
  "providerOptions": {
    "generate_audio": true,
    "aspect_ratio": "16:9"
  }
}'
py
import os
import requests

response = requests.post(
    "https://api.pixapi.ai/v1/async/videos/generations",
    headers={
        "Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
        "Content-Type": "application/json",
    },
    json={
    "model": "seedance-2",
    "prompt": "一只柴犬穿过霓虹雨夜街道",
    "n": 1,
    "seconds": 5,
    "resolution": "720p",
    "providerOptions": {
        "generate_audio": True,
        "aspect_ratio": "16:9"
    }
},
)
response.raise_for_status()
task = response.json()
print(task["id"])
js
const response = await fetch('https://api.pixapi.ai/v1/async/videos/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "model": "seedance-2",
  "prompt": "一只柴犬穿过霓虹雨夜街道",
  "n": 1,
  "seconds": 5,
  "resolution": "720p",
  "providerOptions": {
    "generate_audio": true,
    "aspect_ratio": "16:9"
  }
}),
});

if (!response.ok) {
  throw new Error(await response.text());
}

const task = await response.json();
console.log(task.id);
go
package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  body := []byte(`{
  "model": "seedance-2",
  "prompt": "一只柴犬穿过霓虹雨夜街道",
  "n": 1,
  "seconds": 5,
  "resolution": "720p",
  "providerOptions": {
    "generate_audio": true,
    "aspect_ratio": "16:9"
  }
}`)

  req, err := http.NewRequest(
    "POST",
    "https://api.pixapi.ai/v1/async/videos/generations",
    bytes.NewBuffer(body),
  )
  if err != nil {
    panic(err)
  }
  req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
  req.Header.Set("Content-Type", "application/json")

  resp, err := http.DefaultClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer resp.Body.Close()

  result, _ := io.ReadAll(resp.Body)
  fmt.Println(string(result))
}

响应

返回已提交任务。轮询 GET /v1/tasks/{id} 获取结果。