接口说明
视频生成(Seedance)
shell
POST https://api.scnet.cn/api/llm/v1/videos/generations
GET https://api.scnet.cn/api/llm/v1/tasks/{task_id}
POST https://api.scnet.cn/api/llm/v1/tasks
POST https://api.scnet.cn/api/llm/v1/tasks/{task_id}/cancel1.功能介绍
Seedance 视频生成接口用于根据输入的文本、图片、视频、音频等多模态信息创建视频生成任务。视频生成任务为异步任务,提交任务后会返回任务 ID,您需要通过查询任务状态接口获取任务状态和生成视频地址。
调用流程:
- 调用提交生成任务接口,获取任务 ID。
- 使用任务 ID 查询任务状态。
- 任务成功后,从查询响应中的
output.results获取生成视频地址。 - 如需取消排队中或处理中的任务,可调用取消任务接口。
2.提交生成任务
shell
POST https://api.scnet.cn/api/llm/v1/videos/generations2.1 请求参数
Header 参数
| 名称 | 类型 | 必填 | 示例值 | 描述 |
|---|---|---|---|---|
| Content-Type | string | 是 | application/json | \ |
| Authorization | string | 是 | Bearer <API Key> | \ |
| X-MultiModal-Async | string | 是 | true | 视频生成为异步任务,必须传 true。提交后返回任务 ID,需轮询任务状态接口获取生成视频地址。 |
Body 参数
| 名称 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| model | string | 是 | \ | 调用模型的名称。例如:Seedance2.0。 |
| input | object | 是 | \ | 输入给模型用于生成视频的信息。支持文本提示词、图片、参考视频与参考音频。 |
| parameters | object | 否 | \ | 视频生成参数配置,包括音频、比例、时长、水印、分辨率等。 |
input 参数说明
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| prompt | string | 是 | 文本提示词,用来描述期望生成的视频内容。 |
| images | array | 否 | 输入图片地址列表(URL 或 Base64),用于图生视频。如需上传本地图片,请先参考文件上传获取可访问链接。 |
| media | array | 否 | 媒体输入列表,用于首末帧、参考图、参考视频、参考音频等多模态输入。 |
| media[].type | string | 否 | 媒体角色类型。可选值:first_frame(首帧)、last_frame(末帧)、reference_image(参考图)、reference_video(参考视频)、reference_audio(参考音频)。 |
| media[].url | string | 否 | 媒体内容地址(URL 或 Base64)。如需上传本地媒体,请先参考文件上传获取可访问链接。 |
parameters 参数说明
| 名称 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| generate_audio | boolean | 否 | \ | 是否生成与画面同步的声音。true 表示生成有声视频,false 表示生成无声视频。 |
| ratio | string | 否 | \ | 生成视频的宽高比,如 adaptive/16:9/9:16。设置为 adaptive 时由模型根据输入内容自适应。 |
| duration | integer | 否 | \ | 生成视频时长,单位:秒。支持 4~15 秒。 |
| resolution | string | 否 | \ | 生成视频的分辨率,如 480p/720p/1080p。 |
| watermark | boolean | 否 | \ | 生成视频是否包含水印。 枚举值: false: 不含水印。 true: 含有水印。 |
| seed | integer | 否 | \ | 随机种子,取值范围 [0, 2147483647]。 |
| camera_fixed | boolean | 否 | \ | 是否固定摄像头。枚举值:true:固定摄像头。平台会在用户提示词中追加固定摄像头,实际效果不保证。false:不固定摄像头。 |
2.2 响应参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| request_id | string | 是 | 请求唯一标识。可用于请求明细溯源和问题排查。 |
| output | object | 是 | 任务输出信息。 |
| output.task_id | string | 是 | 视频生成任务 ID。提交任务后,需使用该 ID 查询任务状态。 |
| output.task_status | string | 是 | 任务状态。提交成功后通常为 pending。 |
2.3 请求示例
cURL请求示例
shell
curl -X POST 'https://api.scnet.cn/api/llm/v1/videos/generations' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API Key>' \
-H 'X-MultiModal-Async: true' \
--data-raw '{
"model": "Seedance2.0",
"input": {
"prompt": "女孩抱着狐狸,女孩睁开眼,温柔地看向镜头,狐狸友善地抱着,镜头缓缓拉出",
"media": [
{"type": "reference_image", "url": "https://example.com/ref-image.png"},
{"type": "reference_audio", "url": "https://example.com/ref-audio.mp3"}
]
},
"parameters": {
"generate_audio": true,
"ratio": "16:9",
"duration": 5,
"resolution": "720p",
"watermark": false,
"seed": 42,
"camera_fixed": false
}
}'Python请求示例
python
import requests
url = "https://api.scnet.cn/api/llm/v1/videos/generations"
payload = {
"model": "Seedance2.0",
"input": {
"prompt": "女孩抱着狐狸,女孩睁开眼,温柔地看向镜头,狐狸友善地抱着,镜头缓缓拉出",
"media": [
{"type": "reference_image", "url": "https://example.com/ref-image.png"},
{"type": "reference_audio", "url": "https://example.com/ref-audio.mp3"}
]
},
"parameters": {
"generate_audio": True,
"ratio": "16:9",
"duration": 5,
"resolution": "720p",
"watermark": False,
"seed": 42,
"camera_fixed": False
}
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
"X-MultiModal-Async": "true"
}
response = requests.post(url, headers=headers, json=payload)
print(response.text)2.4 响应示例
json
{
"request_id": "93181007-6691-9bf8-810d-c04e37959265",
"output": {
"task_id": "2069672851453161473",
"task_status": "pending"
}
}3.查询任务状态
shell
GET https://api.scnet.cn/api/llm/v1/tasks/{task_id}3.1 请求参数
Header 参数
| 名称 | 类型 | 必填 | 示例值 |
|---|---|---|---|
| Content-Type | string | 是 | application/json |
| Authorization | string | 是 | Bearer <API Key> |
Path 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| task_id | string | 是 | 需要查询的视频生成任务 ID。 |
3.2 响应参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| request_id | string | 是 | 请求唯一标识。可用于请求明细溯源和问题排查。 |
| output | object | 是 | 任务输出信息。 |
| output.task_id | string | 是 | 视频生成任务 ID。 |
| output.task_status | string | 是 | 任务状态。常见值包括 pending、running、succeeded、failed、cancelled。 |
| output.submit_time | string | 否 | 任务提交时间。 |
| output.end_time | string | 否 | 任务结束时间。 |
| output.results | array | 否 | 生成视频的下载地址列表。任务成功后返回。 |
| output.error_code | string | 否 | 错误码。任务失败时返回。 |
| output.error_message | string | 否 | 错误信息。任务失败时返回。 |
| usage | object | 否 | 本次请求的用量信息。 |
| usage.video_count | integer | 否 | 生成视频数量。 |
| usage.video_duration | integer | 否 | 生成视频的时长,单位为秒。 |
| usage.resolution | string | 否 | 生成视频的分辨率档位,如 720p。 |
| usage.ratio | string | 否 | 生成视频的宽高比,如 16:9。 |
| usage.token_usage | object | 否 | token 用量信息,包含 prompt_tokens、completion_tokens、total_tokens。 |
3.3 请求示例
cURL请求示例
shell
curl -X GET 'https://api.scnet.cn/api/llm/v1/tasks/<task_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API Key>'Python请求示例
python
import requests
task_id = "<task_id>"
url = f"https://api.scnet.cn/api/llm/v1/tasks/{task_id}"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>"
}
response = requests.get(url, headers=headers)
print(response.text)3.4 响应示例
json
{
"request_id": "a4205108-eefa-9f6c-a7f4-3509357abbd5",
"output": {
"task_id": "2069672851453161473",
"task_status": "succeeded",
"submit_time": "2026-05-29 10:26:49.775",
"end_time": "2026-05-29 10:27:21.393",
"results": [
"https://example.com/video.mp4"
]
},
"usage": {
"video_count": 1,
"video_duration": 5,
"resolution": "720p",
"ratio": "16:9",
"token_usage": {
"prompt_tokens": 0,
"completion_tokens": 109586,
"total_tokens": 109586
}
}
}4.批量查询任务状态
shell
POST https://api.scnet.cn/api/llm/v1/tasks4.1 请求参数
Header 参数
| 名称 | 类型 | 必填 | 示例值 |
|---|---|---|---|
| Content-Type | string | 是 | application/json |
| Authorization | string | 是 | Bearer <API Key> |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| task_ids | array | 是 | 需要查询的任务 ID 列表,单次最多查询 10 个。 |
4.2 响应参数
响应为数组,数组中每个元素的结构与查询任务状态的响应一致。
4.3 请求示例
cURL请求示例
shell
curl -X POST 'https://api.scnet.cn/api/llm/v1/tasks' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API Key>' \
--data-raw '{
"task_ids": [
"2069672851453161473",
"2069672851453161474"
]
}'4.4 响应示例
json
[
{
"request_id": "a4205108-eefa-9f6c-a7f4-3509357abbd5",
"output": {
"task_id": "2069672851453161473",
"task_status": "succeeded",
"results": [
"https://example.com/video.mp4"
]
},
"usage": {
"video_count": 1,
"video_duration": 5
}
},
{
"request_id": "a4205108-eefa-9f6c-a7f4-3509357abbd6",
"output": {
"task_id": "2069672851453161474",
"task_status": "running"
}
}
]5.取消任务
shell
POST https://api.scnet.cn/api/llm/v1/tasks/{task_id}/cancel仅非终态任务(pending、running 等)可以取消。已处于终态(succeeded、failed、cancelled)的任务无法取消。
5.1 请求参数
Header 参数
| 名称 | 类型 | 必填 | 示例值 |
|---|---|---|---|
| Content-Type | string | 是 | application/json |
| Authorization | string | 是 | Bearer <API Key> |
Path 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| task_id | string | 是 | 需要取消的视频生成任务 ID。 |
5.2 响应参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| request_id | string | 是 | 请求唯一标识。可用于请求明细溯源和问题排查。 |
| output | object | 是 | 任务输出信息。 |
| output.task_id | string | 是 | 被取消的视频生成任务 ID。 |
| output.task_status | string | 是 | 任务状态。取消成功后为 cancelled。 |
5.3 请求示例
cURL请求示例
shell
curl -X POST 'https://api.scnet.cn/api/llm/v1/tasks/<task_id>/cancel' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API Key>'Python请求示例
python
import requests
task_id = "<task_id>"
url = f"https://api.scnet.cn/api/llm/v1/tasks/{task_id}/cancel"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>"
}
response = requests.post(url, headers=headers)
print(response.text)5.4 响应示例
json
{
"request_id": "a4205108-eefa-9f6c-a7f4-3509357abbd5",
"output": {
"task_id": "2069672851453161473",
"task_status": "cancelled"
}
}6.任务状态说明
| 状态 | 描述 |
|---|---|
| pending | 任务等待调度。 |
| running | 任务运行中。 |
| succeeded | 任务成功,可从查询响应中的 output.results 获取生成视频地址。 |
| failed | 任务失败,可从 output.error_code 与 output.error_message 获取失败原因。 |
| cancelled | 任务已取消。 |
7.注意事项
- 视频生成任务为异步任务,提交任务时请求头必须携带
X-MultiModal-Async: true,提交任务后不会立即返回视频地址。 - 多模态输入支持文本、图片、参考视频、参考音频等信息组合,其中文生视频仅传
input.prompt即可。 - 用户如需上传本地多媒体内容,应先参考文件上传获取可访问的媒体链接,再作为入参传递给模型。
- 批量查询任务单次最多查询 10 个任务 ID。