创建视频任务 · cogvideo-short
/v1/videos创建一个异步视频任务,按条计费,失败退款。保存任务 ID;客户端超时后先检查原任务,避免重复生成。
异步 · 提交后查询任务 · 先返回任务 ID;在调试面板查询状态,完成后获取结果。
鉴权
使用客户 API Key。 获取与配置 →
Authorization: Bearer YOUR_API_KEY选择模型
查看该模型的能力与限制 →请求参数
拒绝存在冲突的别名或 metadata。单图与多参考图输入互斥;参考图模式使用 fast/pro,时长为 3–10 秒。
- 不能同时提供 input_reference, image_url.
- 当 model = "cogvideo-basic": seconds: 1–5 或 ^[1-5]$;duration: 1–5 或 ^[1-5]$;不能 提供 reference_images;不能 提供 metadata,且 提供 metadata.reference_images.
- 当 model = "cogvideo-short": seconds 仅接受 8, "8";duration 仅接受 8, "8";size 必须为 "720x1280";resolution 必须为 "720p";aspect_ratio 必须为 "9:16";不能 提供 input_reference;不能 提供 image_url;不能 提供 reference_images;不能 提供 metadata,且 提供 metadata.reference_images;否则 size 仅接受 "1920x1080", "1080x1920", "1080x1080", "1440x1080", "1080x1440";resolution 必须为 "1080p".
modelstring必填本站公开调用名称,具体能力与限制见指南。
"cogvideo-fast""cogvideo-pro""cogvideo-basic""cogvideo-short"promptstring必填必填,不能为空白,最多 4096 个 Unicode 字符。
最少字符: 1 · 最多字符: 4096 · 匹配规则: "\\S"
secondsoneOf整数或整数字符串。fast/pro/basic 默认 5 秒,short 固定 8 秒;basic 最多 5 秒,参考生视频至少 3 秒。
展开结构
任选一种结构 · 1
integer
最小值: 1 · 最大值: 10
任选一种结构 · 2
string
匹配规则: "^(10|[1-9])$"
durationoneOfseconds 的兼容名称,两种写法同时出现时必须一致。
展开结构
任选一种结构 · 1
integer
最小值: 1 · 最大值: 10
任选一种结构 · 2
string
匹配规则: "^(10|[1-9])$"
sizestringfast/pro/basic 仅接受 1080p 尺寸,short 仅接受 720x1280;具体枚举见指南。
"1920x1080""1080x1920""1080x1080""1440x1080""1080x1440""720x1280"resolutionstringfast/pro/basic 为 1080p,short 为 720p。
"1080p""720p"aspect_ratiostring画面比例;图片默认 1:1,普通视频默认 16:9,short 固定 9:16。
"16:9""9:16""1:1""4:3""3:4"input_referencestring单张参考图片 URL / data URL;multipart 使用一个文件,最多 20 MiB。
匹配规则: "^(https?://|data:image/)"
image_urlstring单张 HTTP(S) 图片 URL 或图片 Base64 data URL。
匹配规则: "^(https?://|data:image/)"
reference_imagesarray非空参考图 URL / data URL 数组;与单图输入互斥。
最少条数: 1
展开结构
string — HTTP(S) 图片地址或 Base64 图片 Data URL。
匹配规则: "^(https?://|data:image/)"
generation_modestring仅参考生视频使用,默认 pro_ad。
"speed""pro""pro_ad"metadataobject视频扩展参数对象;multipart 表单使用 JSON 编码字符串。
展开结构
modestring必须与提供的图片输入匹配。
"text_to_video""image_to_video""reference_to_video"resolutionstring"1080p""720p"aspect_ratiostring"16:9""9:16""1:1""4:3""3:4"reference_imagesarray最少条数: 1
展开结构
string — HTTP(S) 图片地址或 Base64 图片 Data URL。
匹配规则: "^(https?://|data:image/)"
generation_modestring仅用于参考图模式。
"speed""pro""pro_ad"默认: "pro_ad"
不接受未列出的字段。
ninteger每次仅生成一个产物。
固定值: 1 · 默认: 1
sample_countinteger仅接受 1,不支持多产物。
固定值: 1 · 默认: 1
同时满足的规则 · 1
- 不能同时提供 input_reference, image_url.
object
条件约束(JSON Schema)
{
"not": {
"required": [
"input_reference",
"image_url"
]
}
}同时满足的规则 · 2
- 当 model = "cogvideo-basic": seconds: 1–5 或 ^[1-5]$;duration: 1–5 或 ^[1-5]$;不能 提供 reference_images;不能 提供 metadata,且 提供 metadata.reference_images.
object
条件约束(JSON Schema)
{
"if": {
"properties": {
"model": {
"const": "cogvideo-basic",
"type": "string"
}
}
},
"then": {
"properties": {
"seconds": {
"oneOf": [
{
"type": "integer",
"minimum": 1,
"maximum": 5
},
{
"type": "string",
"pattern": "^[1-5]$"
}
]
},
"duration": {
"oneOf": [
{
"type": "integer",
"minimum": 1,
"maximum": 5
},
{
"type": "string",
"pattern": "^[1-5]$"
}
]
}
},
"not": {
"anyOf": [
{
"required": [
"reference_images"
]
},
{
"required": [
"metadata"
],
"properties": {
"metadata": {
"required": [
"reference_images"
]
}
}
}
]
}
}
}同时满足的规则 · 3
- 当 model = "cogvideo-short": seconds 仅接受 8, "8";duration 仅接受 8, "8";size 必须为 "720x1280";resolution 必须为 "720p";aspect_ratio 必须为 "9:16";不能 提供 input_reference;不能 提供 image_url;不能 提供 reference_images;不能 提供 metadata,且 提供 metadata.reference_images;否则 size 仅接受 "1920x1080", "1080x1920", "1080x1080", "1440x1080", "1080x1440";resolution 必须为 "1080p".
object
条件约束(JSON Schema)
{
"if": {
"properties": {
"model": {
"const": "cogvideo-short",
"type": "string"
}
}
},
"then": {
"properties": {
"seconds": {
"enum": [
8,
"8"
]
},
"duration": {
"enum": [
8,
"8"
]
},
"size": {
"const": "720x1280",
"type": "string"
},
"resolution": {
"const": "720p",
"type": "string"
},
"aspect_ratio": {
"const": "9:16",
"type": "string"
}
},
"not": {
"anyOf": [
{
"required": [
"input_reference"
]
},
{
"required": [
"image_url"
]
},
{
"required": [
"reference_images"
]
},
{
"required": [
"metadata"
],
"properties": {
"metadata": {
"required": [
"reference_images"
]
}
}
}
]
}
},
"else": {
"properties": {
"size": {
"enum": [
"1920x1080",
"1080x1920",
"1080x1080",
"1440x1080",
"1080x1440"
],
"type": "string"
},
"resolution": {
"const": "1080p",
"type": "string"
}
}
}
}不接受未列出的字段。
响应
任务已接受。保存 id 并查询进度,最终是否成功以任务状态为准。
Content-Type application/json
idstring必填objectstring必填固定值: "video"
statusstring必填unknown 表示无法识别的任务状态,不能当作已经完成。
"queued""in_progress""completed""failed""unknown"progressnumber必填created_atinteger必填errorobject展开结构
codestring固定值: "video_generation_failed"
messagestring