logo
平台介绍
快速接入
密钥管理
模型列表
计费规则
音色列表
文本转语音
音色克隆
文生音色
语音识别
多模态理解模型
音乐生成
图片生成
视频生成
视频生成介绍
POST
创建视频生成任务
GET
查询视频生成状态
语音Agent
自定义Agent
常见问题
工作台
立即登录

创建视频生成任务

创建视频生成任务,支持文本生成视频、图生视频等多种模式。

接口概览

  • 接口地址: https://api.senseaudio.cn/v1/video/create
  • 请求方式: POST
  • Content-Type: application/json
  • 鉴权方式: Bearer Token

请求配置

请求头 (Request Headers)

参数名必填说明示例
Authorization是鉴权 Token。格式:Bearer API_KEYBearer sk-123456…
Content-Type是内容类型。固定为 application/jsonapplication/json

请求参数 (Request Body)

参数名类型必填描述
modelstring是模型名称
contentarray是视频内容描述(文本或图片)
durationint是视频时长(秒)
resolutionstring是分辨率,如 "720p", "1080p"
ratiostring是宽高比,如 "16:9", "9:16"
timeoutint否最大超时时间(秒)
provider_specificobject否厂商特定参数(JSON 对象)

content 数组结构

content 数组用于描述视频内容,支持文本、图片两种类型。每个元素包含以下字段:

参数名类型必填描述
typestring是内容类型: "text"、"image"
textstring否当 type 为 "text" 时,填写文本内容(提示词)
urlstring否当 type 为 "image" 时,填写图片 URL(支持 http/https 链接及 data URL)
rolestring否当 type 为 "image" 时,指定图片作用;SenseAudio-Video-1.0 使用 reference,Seedance-Pro-1.5 使用 first_frame、last_frame

模型各个参数说明

模型名支持参数说明不支持参数说明
SenseAudio-Video-1.01. ratio需为合法宽高比格式,如 16:9、9:16
2. resolution可选:720p
3. duration仅支持:10、15 秒
4. content支持:text(必填)、image(可选,最多 1 张,role固定为reference)
不支持 first_frame / last_frame,不支持 provider_specific
Seedance-Pro-1.51. ratio可选:9:16, 16:9, 1:1, 4:3, 3:4
2. resolution可选:720p, 1080p
3. duration可选:2至12秒之间的整数
4. content支持:text(必填)、image(可选,role可为first_frame或last_frame,last_frame需与first_frame同时传入)
5. provider_specific可选:generate_audio(bool,生成音频)、camera_fixed(bool,镜头固定)

各模型代码示例

SenseAudio-Video-1.0 — 文本生成视频

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "SenseAudio-Video-1.0", "content": [ {"type": "text", "text": "黄昏下的海边,海浪轻轻拍打礁石,镜头缓慢推进"} ], "resolution": "720p", "ratio": "16:9", "duration": 10 }'

SenseAudio-Video-1.0 — 参考图生视频

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "SenseAudio-Video-1.0", "content": [ {"type": "text", "text": "一个人在咖啡馆窗边阅读,画面自然运镜"}, {"type": "image", "url": "https://example.com/reference.jpg", "role": "reference"} ], "resolution": "720p", "ratio": "9:16", "duration": 15 }'

Seedance-Pro-1.5 — 文本生成视频

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Seedance-Pro-1.5", "content": [ {"type": "text", "text": "一只可爱的小猫在花园里玩耍"} ], "resolution": "1080p", "ratio": "16:9", "duration": 8, "provider_specific": {"generate_audio": true, "camera_fixed": false} }'

Seedance-Pro-1.5-首帧图生视频

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Seedance-Pro-1.5", "content": [ {"type": "text", "text": "一只可爱的小猫在花园里玩耍"}, {"type": "image", "url": "https://example.com/first.jpg", "role": "first_frame"} ], "resolution": "1080p", "ratio": "16:9", "duration": 8, "provider_specific": {"generate_audio": false, "camera_fixed": true} }'

Seedance-Pro-1.5 — 首尾帧图生视频

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Seedance-Pro-1.5", "content": [ {"type": "text", "text": "一只可爱的小猫在花园里玩耍"}, {"type": "image", "url": "https://example.com/first.jpg", "role": "first_frame"}, {"type": "image", "url": "https://example.com/last.jpg", "role": "last_frame"} ], "resolution": "1080p", "ratio": "16:9", "duration": 8, "provider_specific": {"generate_audio": false, "camera_fixed": true} }'

role字段说明

  1. SenseAudio-Video-1.0 的 image role 固定为 reference
  2. 对 Seedance-Pro-1.5,当使用首帧图生视频时,只上传一张图片,role为 first_frame
  3. 对 Seedance-Pro-1.5,当使用首尾帧图生视频时,需要上传两张图片,首帧图片的role为first_frame,尾帧图片的role为last_frame

provider_specific字段说明

  1. 该字段传入 JSON 对象,仅 Seedance-Pro-1.5 支持
  2. Seedance-Pro-1.5 示例:{"generate_audio": true, "camera_fixed": false},不支持的字段会被过滤

响应结构

参数名类型描述
task_idstring任务 ID,用于查询视频生成状态

响应示例

json
复制
{ "task_id": "task_1234567890" }

代码示例

CURL

bash
复制
curl -X POST "https://api.senseaudio.cn/v1/video/create" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "SenseAudio-Video-1.0", "content": [ { "type": "text", "text": "一只可爱的小猫在花园里玩耍" } ], "resolution": "720p", "ratio": "16:9", "duration": 10 }'

Python

python
复制
import requests API_URL = "https://api.senseaudio.cn/v1/video/create" HEADERS = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } def create_video(content, model="SenseAudio-Video-1.0", **kwargs): data = { "model": model, "content": content, **kwargs } resp = requests.post(API_URL, headers=HEADERS, json=data) if resp.status_code == 200: return resp.json() return None # 文本生成视频 result = create_video( content=[ {"type": "text", "text": "一只可爱的小猫在花园里玩耍"} ], ratio="16:9", duration=10, resolution="720p" ) print(f"任务ID: {result['task_id']}") # 图生视频 result = create_video( content=[ {"type": "text", "text": "一只可爱的小猫在花园里玩耍"}, {"type": "image", "url": "https://example.com/image.jpg", "role": "reference"} ], ratio="16:9", duration=10, resolution="720p" ) print(f"任务ID: {result['task_id']}")

JavaScript

javascript
复制
const axios = require('axios'); const API_URL = 'https://api.senseaudio.cn/v1/video/create'; const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }; async function createVideo(content, model = 'SenseAudio-Video-1.0', options = {}) { const data = { model, content, ...options }; try { const res = await axios.post(API_URL, data, { headers: HEADERS }); return res.data; } catch (err) { console.error('请求失败:', err.message); return null; } } // 文本生成视频 createVideo( [{type: 'text', text: '一只可爱的小猫在花园里玩耍'}], 'SenseAudio-Video-1.0', {ratio: '16:9', duration: 10, resolution: '720p'} ).then(result => console.log(`任务ID: ${result.task_id}`)); // 图生视频 createVideo( [ {type: 'text', text: '一只可爱的小猫在花园里玩耍'}, {type: 'image', url: 'https://example.com/image.jpg', role: 'reference'} ], 'SenseAudio-Video-1.0', {ratio: '16:9', duration: 10, resolution: '720p'} ).then(result => console.log(`任务ID: ${result.task_id}`));

查询任务状态

创建任务后,使用返回的 task_id 使用任务查询文档查询任务进度。

注意事项

  1. 内容描述:content 数组中的 text 类型元素用于描述视频内容,建议清晰描述场景、动作、风格等信息
  2. 图生视频:使用图片作为参考时,在 content 数组中添加 image 类型元素,url 字段填写图片地址
  3. 处理时间:视频生成需要一定时间,建议使用轮询方式查询状态