创建视频生成任务
提交视频生成任务,立即返回任务 ID。视频生成为异步操作,需通过
GET /v1/videos/generations/{taskId} 轮询任务状态。
计费方式:提交时按预估时长冻结费用,视频生成成功后按实际用量结算;生成失败则退还冻结金额。
支持多种输入模式(通过 content 数组指定):
- 文生视频:仅传入
type: text的提示词 - 图生视频(首帧/首尾帧):传入图片,
role设为first_frame/last_frame - 多模态参考生视频(Seedance 2.0):传入参考图片(1-9 张)、参考视频(1-3 个)、参考音频(1-3 段)的任意组合
- 有声视频(Seedance 2.0、1.5 pro):设置
generate_audio: true,模型自动生成同步音频
图片 / 媒体引用规范(重要):
- 普通图片:
image_url.url请传 公网可访问的 https URL(如对象存储 / CDN)。上游引擎按 URL 直接拉取,不经过本服务内存。 - 含真人的参考图:必须用
asset://<asset_id>引用一个经过验证的真人素材(先调POST /v1/asset-groups/validate-session完成 H5 真人活体验证,拿到group_id/asset_id)。直接传真人图 URL 或 base64 都会被上游InputImageSensitiveContentDetected.PrivacyInformation拒绝。 - 不要 inline base64:
data:image/...;base64,...这种内联编码会让请求体迅速膨胀到 MB 级。请求体硬上限 5 MB,超过返回413 payload_too_large。需要传图请上传到对象存储后传 URL,或用asset://引用素材库。
Authorization
BearerAuth API 密钥认证(OpenAI 格式)。在 Authorization 请求头中传入:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.net/v1/videos/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "volcengine/doubao-seedance-2-0-260128", "content": [ { "type": "text", "text": "一只猫咪在草地上奔跑,电影质感,慢镜头" } ], "resolution": "720p", "duration": 5 }'{
"id": "550e8400-e29b-41d4-a716-446655440000",
"upstream_id": "string",
"model": "string",
"status": "queued",
"created_at": "2019-08-24T14:15:22Z"
}{
"error": "model field is required",
"type": "invalid_request_error"
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "insufficient balance -- please top up or upgrade your plan",
"type": "billing_error"
}{
"error": "rate limit exceeded",
"type": "rate_limit_error"
}{
"error": "upstream provider error",
"type": "server_error"
}