# Seedance 2.5 Flash API 字节跳动 Seedance 2.5 Flash 视频生成模型的完整 API 参考文档。 ## 模型版本 此 API 支持以下三个模型版本: | 模型 | ID | 说明 | |-------|----|-------------| | **Seedance 2.5 Flash Text to Video** | `seedance-v2.5-flash-text-to-video` | 高质量文生视频 | | **Seedance 2.5 Flash Image to Video** | `seedance-v2.5-flash-image-to-video` | 根据首帧或首尾帧生成视频 | | **Seedance 2.5 Flash Reference to Video** | `seedance-v2.5-flash-reference-to-video` | 以参考图像、视频和音频为依据生成视频 | ## 快速对比 | 功能 | 文生视频 | 图生视频 | 参考素材生成视频 | |---------|---------------|----------------|--------------------| | 时长范围 | 4–30 秒 | 4–30 秒 | 4–30 秒 | | 分辨率选项 | 480p、720p | 480p、720p | 480p、720p | | 宽高比 | 可选(默认 16:9) | 不支持 | 可选(默认 16:9) | | 必需素材 | 无 | 首帧图像 | 无 | | 可选素材 | 无 | 尾帧图像 | 图像、视频和音频 | ### 支持的宽高比 文生视频和参考素材生成视频支持以下宽高比: `21:9`, `16:9`, `9:16`, `1:1`, `4:3`, `3:4` 图生视频不支持 `aspect_ratio` 参数。 ### 分辨率选项 | 分辨率 | 说明 | |------------|-------------| | `480p` | 标清 | | `720p` | 高清 | ## Seedance 2.5 Flash Text to Video ### 接口地址 ``` POST /api/v1/video/task ``` ### 请求参数 #### 必填参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"seedance-v2.5-flash-text-to-video"` | | `prompt` | string | 视频生成提示词,最多 5000 个字符 | | `resolution` | string | 输出分辨率为 `"480p"` 或 `"720p"`,无默认值 | | `duration` | integer | 视频时长为 4–30 秒,按整秒指定,步长为 1 秒,无默认值 | #### 可选参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `aspect_ratio` | string | 视频宽高比,可选 `"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"`。默认为 `"16:9"` | | `sound` | boolean | 是否生成声音。默认为 `true`,设为 `false` 则生成无声视频 | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'seedance-v2.5-flash-text-to-video', prompt: 'A golden retriever running through a sunlit meadow', resolution: '720p', duration: 8, aspect_ratio: '16:9', sound: true }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Seedance 2.5 Flash Image to Video ### 请求参数 #### 必填参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"seedance-v2.5-flash-image-to-video"` | | `prompt` | string | 视频生成提示词,最多 5000 个字符 | | `resolution` | string | 输出分辨率为 `"480p"` 或 `"720p"`,无默认值 | | `duration` | integer | 视频时长为 4–30 秒,按整秒指定,步长为 1 秒,无默认值 | | `image_url` | string | 首帧图像 URL,详见下文的素材限制。输出视频沿用该图像的宽高比 | #### 可选参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `image_end_url` | string | 可选的尾帧图像 URL,详见下文的素材限制。建议使用与首帧相同的宽高比 | | `sound` | boolean | 是否生成声音。默认为 `true`,设为 `false` 则生成无声视频 | > 图生视频模型不支持 `aspect_ratio`,请勿在请求中传入该参数。 ### 请求示例 ```javascript { model_name: 'seedance-v2.5-flash-image-to-video', image_url: 'https://example.com/first-frame.jpg', image_end_url: 'https://example.com/last-frame.jpg', prompt: 'Camera slowly pulls back to reveal the full landscape', resolution: '720p', duration: 8, sound: true } ``` ## Seedance 2.5 Flash Reference to Video ### 请求参数 #### 必填参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"seedance-v2.5-flash-reference-to-video"` | | `prompt` | string | 视频生成提示词,最多 5000 个字符。可编写不含占位符的普通提示词,也可使用 @ (AT) 引用功能,通过 `<<>>`、`<<>>` 和 `<<>>` 明确引用相应素材数组中的条目 | | `resolution` | string | 输出分辨率为 `"480p"` 或 `"720p"`,无默认值 | | `duration` | integer | 视频时长为 4–30 秒,按整秒指定,步长为 1 秒,无默认值 | #### 参考素材 所有参考素材均为可选项。可以只提供图像、只提供视频、只提供音频,也可以不提供任何参考素材。无需参考素材时,建议使用文生视频模型。 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `images` | string[] | 0–10 个参考图像 URL,按数组顺序引用,详见下文的素材限制 | | `videos` | string[] | 0–5 个 MP4 或 MOV 格式的参考视频 URL。每段视频时长须为 2–30 秒,合计不得超过 30 秒,详见下文的素材限制。计费时先将参考视频总时长四舍五入到整秒(满半秒进一),再加上输出视频时长 | | `audios` | string[] | 0–5 个 WAV 或 MP3 格式的参考音频 URL。每段音频时长须为 2–30 秒,大小不得超过 15 MB,总时长不得超过 30 秒 | #### @ (AT) 引用占位符 @ (AT) 引用功能通过带编号的 `<<<...>>>` 占位符在提示词中指定参考素材。每类素材单独从 `1` 开始编号,顺序与对应数组一致: | 占位符 | 引用的值 | |-------------|------------------| | `<<>>` | `images[0]` | | `<<>>` | `images[1]` | | `<<>>` | `videos[0]` | | `<<>>` | `audios[0]` | 例如,第一张图像用作角色参考、第二张用作场景参考时,可在 `prompt` 中使用 `<<>>` 指定角色,使用 `<<>>` 指定场景。每个占位符都必须指向对应数组中实际存在的条目。 #### 可选参数 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `aspect_ratio` | string | 视频宽高比,可选 `"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"`。默认为 `"16:9"` | | `sound` | boolean | 是否生成声音。默认为 `true`,设为 `false` 则生成无声视频 | ### 请求示例 ```javascript { model_name: 'seedance-v2.5-flash-reference-to-video', prompt: 'Use image one for the subject, video one for the movement, and audio one for the atmosphere', resolution: '720p', duration: 8, aspect_ratio: '16:9', sound: true, images: ['https://example.com/subject-reference.jpg'], videos: ['https://example.com/motion-reference.mp4'], audios: ['https://example.com/atmosphere-reference.mp3'] } ``` ### 使用 @ (AT) 引用的参考素材生成视频请求示例 ```javascript { model_name: 'seedance-v2.5-flash-reference-to-video', prompt: 'Place the explorer from <<>> in the environment from <<>>, following the camera movement in <<>> and speaking with the reference voice from <<>>', resolution: '720p', duration: 10, aspect_ratio: '16:9', sound: true, images: [ 'https://example.com/explorer-reference.jpg', 'https://example.com/environment-reference.png' ], videos: ['https://example.com/camera-movement-reference.mp4'], audios: ['https://example.com/voice-reference.mp3'] } ``` ## 素材限制 以下限制适用于本页模型使用的首帧图像、尾帧图像及参考素材。 | 素材 | 格式 | 限制 | |-------|---------|--------| | 图像 | JPEG, PNG, WEBP, BMP, TIFF, GIF, HEIC, HEIF | 单张须小于 30 MB,宽和高均须在 300–6000 像素之间,宽高比须在 0.4–2.5 之间 | | 视频 | MP4, MOV | 每段最多 200 MB,宽和高均须在 300–6000 像素之间,宽高比须在 0.4–2.5 之间,帧率须为 24–60 FPS,总像素数须在 407696–8295044 之间 | | 音频 | WAV, MP3 | 每段最多 15 MB | 参考音频与参考视频的总时长分别计算,每类最多 30 秒。各类素材的数量也独立计算:最多可提供 10 张图像、5 段视频和 5 段音频。 所有模型都必须指定 `resolution` 和 `duration`,这两个参数均无默认值。文生视频和参考素材生成视频在省略 `aspect_ratio` 时均使用 `16:9`。声音开关默认为 `true`,设为 `false` 即可生成无声视频。 ## 响应格式 ### 初始响应 所有模型都会返回 `task_id`,供轮询时使用: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### 轮询响应 轮询 `GET /api/v1/video/{taskId}` 以查询任务状态: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "videos": [ { "url": "https://example.com/generated-video.mp4" } ] } } } ``` ### 状态值 - `submitted`:任务已受理,正在等待处理 - `processing`:正在生成视频 - `succeed`:视频生成完成 - `failed`:视频生成失败 ## 处理时间 处理时间取决于视频时长、分辨率和当前排队情况。 每隔 5–10 秒轮询一次,查询任务状态。 ## 最佳实践 1. **必填参数**:始终提供 `prompt`、`resolution` 和 `duration`。对于文生视频和参考素材生成视频,`aspect_ratio` 为可选参数,默认为 `16:9` 2. **图生视频宽高比**:图生视频请求中请勿传入 `aspect_ratio` 3. **参考视频**:视频为可选项,每段视频的时长和视频总时长均须符合本文规定的限制 4. **参考图像**:图像为可选项,可独立于视频和音频提供。最多可提交 10 个受支持格式的图像 URL 5. **参考音频**:每段音频须为 2–30 秒,大小不得超过 15 MB,总时长不得超过 30 秒 6. **参考素材顺序**:按预期的引用顺序排列 `images`、`videos` 和 `audios` 中的条目,并在提示词中按相同顺序引用 7. **声音**:省略 `sound` 即可使用默认值 `true`,设为 `false` 可关闭声音生成