Submit Video Generation
提交视频生成任务。视频生成耗时较长(通常 30 秒到几分钟,取决于模型与时长),因此采用异步任务模式: 1. 调用本接口提交任务,成功响应 `202 Accepted`,返回 `task_id`。 2. 客户端使用 `task_id` 调用 `GET /v1/videos/generations/{task_id}` 轮询状态。 3. 当 `status` 变为 `completed` 时,从响应中读取视频 `url`。 **建议**:轮询间隔不少于 3 秒;不要为整个生成过程设置 HTTP 超时——仅对单次提交/轮询请求设置短超时(如 30 秒)。 **参考图说明**:`image_url` / `image_urls` 字段支持 HTTP(S) URL,单图不超过 20MB。提交后 Router One 会代为下载并安全转存,因此即使图片来自用户上传的临时 URL 也可使用。
使用 API Key 进行认证。在 Router One 控制台获取你的 API Key,格式为 sk-xxx。
In: header
模型 ID。需选择支持视频生成能力的模型,可在控制台模型市场查询。
视频生成的文本提示词,描述画面内容、镜头运动、风格等。
视频时长(秒)。可选值取决于所选模型,常见为 4、5、6、8 秒。
视频分辨率。常用值:720p、1080p。具体支持范围取决于所选模型。
视频宽高比。16:9 适合横屏,9:16 适合竖屏短视频,1:1 适合社交方图。
"16:9" | "9:16" | "1:1"反向提示词,描述希望避免出现的元素。可选。
参考图 URL(图生视频场景)。必须为 HTTP(S) 可访问地址,单图不超过 20MB。Router One 会代为下载并安全转存。
uri多参考图 URL 列表,最多 3 张。每张约束同 image_url。
items <= 3模型特定的参考输入标识。仅当所选模型明确要求时使用。
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.router.one/v1/videos/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "video-default", "prompt": "海浪轻拍沙滩,黄昏的阳光洒在水面上,慢镜头", "duration": 5, "size": "1080p", "aspect_ratio": "16:9" }'{
"task_id": "v_8f3a92c1d4e74b6ea0b5f1d29c7e8a01",
"status": "pending"
}{
"error": {
"message": "Failed to fetch reference image: exceeds 20MB limit",
"type": "invalid_request_error",
"code": "reference_image_invalid"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"code": "invalid_api_key"
}
}{
"error": {
"message": "Insufficient balance",
"type": "billing_error",
"code": "insufficient_balance"
}
}{
"error": {
"message": "string",
"type": "string",
"code": "string"
}
}{
"error": {
"message": "Upstream provider error",
"type": "api_error",
"code": "upstream_error"
}
}