- 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)。仅在同时提供首帧图像时有效。▶reference_images[]
arraymaxItems: 4参考图像(1-4 张,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