跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com
ByteDance logo

Seedance 2.0 Mini

Text-to-Video • ByteDance

查看 MarkdownAgent 设置
  • Third-party

字节跳动 Seedance 2.0 系列中小巧、高性价比的视频生成模型。支持文生视频、图生视频、参考视频,以及用作背景音乐的参考音频。非常适合注重速度和成本的大批量工作负载。

模型信息
更多信息链接 ↗
定价在 Cloudflare 仪表板中查看定价 ↗

用法

const response = await env.AI.run(
  'bytedance/seedance-2.0-mini',
  {
    prompt:
      'A cat sitting on a windowsill watching raindrops fall on the glass, cozy interior lighting',
    aspect_ratio: '16:9',
    duration: 5,
    resolution: '720p',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedance-2.0-mini",
  "input": {
    "prompt": "A cat sitting on a windowsill watching raindrops fall on the glass, cozy interior lighting",
    "aspect_ratio": "16:9",
    "duration": 5,
    "resolution": "720p"
  }
}'
{
  "state": "Completed",
  "result": {
    "video": "https://examples.aig.cloudflare.com/bytedance/seedance-2.0-mini/simple-video.mp4"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

示例

图生视频 — 根据参考图像生成视频
const response = await env.AI.run(
  'bytedance/seedance-2.0-mini',
  {
    image: 'https://ark-doc.tos-ap-southeast-1.bytepluses.com/doc_image/r2v_tea_pic1.jpg',
    prompt: 'The scene slowly comes to life with gentle movement',
    aspect_ratio: '16:9',
    duration: 5,
    resolution: '720p',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedance-2.0-mini",
  "input": {
    "image": "https://ark-doc.tos-ap-southeast-1.bytepluses.com/doc_image/r2v_tea_pic1.jpg",
    "prompt": "The scene slowly comes to life with gentle movement",
    "aspect_ratio": "16:9",
    "duration": 5,
    "resolution": "720p"
  }
}'
{
  "state": "Completed",
  "result": {
    "video": "https://examples.aig.cloudflare.com/bytedance/seedance-2.0-mini/image-to-video.mp4"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
带音频的竖屏视频 — 适用于社交媒体的竖屏视频
const response = await env.AI.run(
  'bytedance/seedance-2.0-mini',
  {
    prompt: 'A steaming coffee cup on a marble table, morning light streaming through a window',
    aspect_ratio: '9:16',
    duration: 5,
    resolution: '720p',
    generate_audio: true,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedance-2.0-mini",
  "input": {
    "prompt": "A steaming coffee cup on a marble table, morning light streaming through a window",
    "aspect_ratio": "9:16",
    "duration": 5,
    "resolution": "720p",
    "generate_audio": true
  }
}'
{
  "state": "Completed",
  "result": {
    "video": "https://examples.aig.cloudflare.com/bytedance/seedance-2.0-mini/portrait-video-with-audio.mp4"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

参数

prompt
stringrequiredmaxLength: 2000描述要生成的视频的文本提示词
image
string用于图生视频的参考图像(HTTP(S) URL 或 base64 data URI)
reference_video
string用于风格/运动引导的参考视频(HTTP(S) URL 或 base64 data URI)
last_frame_image
string用于末帧引导的参考图像(HTTP(S) URL 或 base64 data URI)。仅在同时提供首帧图像时有效。
duration
integerrequireddefault: 5minimum: 4maximum: 12视频时长(秒)
resolution
stringrequireddefault: 720penum: 480p, 720p视频分辨率
aspect_ratio
stringrequireddefault: 16:9enum: 16:9, 4:3, 1:1, 3:4, 9:16, 21:9, 9:21视频宽高比。使用图像时将被忽略。
fps
numberdefault: 24const: 24帧率(每秒帧数)
camera_fixed
booleandefault: false是否固定镜头位置
generate_audio
boolean是否随视频一同生成音频
watermark
booleandefault: false是否为输出视频添加水印
seed
integerminimum: -9007199254740991maximum: 9007199254740991用于可复现生成的随机种子
reference_audio
string用作背景音乐的参考音频(HTTP(S) URL 或 base64 data:audio/... URI)。必须同时提供参考图像或视频。
video
stringformat: uri生成视频的 URL

API schema(原始)

输入
输出

这篇文档对您有帮助吗?