Skip to content

视频 stream 与后台调用 ​

POST /v1/responses

stream:true 返回进度和最终视频链接,以 response.completed 结束;background:true 返回 resp_ ID 供后续查询。流中没有实时视频帧。

调用指南与限制

在线调试 ​

填写自己的 API Key 和请求参数后发送。生成请求会正常计费;Key 仅用于本次调试,不保存到浏览器。

application/json ​

Use stream=true or background=true for long video requests. Video-specific fields are site extensions; no chat/completions protocol.

参数类型必填默认值 / 可选值说明
modelstring是cogvideo-fast, cogvideo-pro, cogvideo-basic, cogvideo-short本站公开调用名称,具体能力与限制见指南。
promptstring否—必填,不能为空白,最多 4096 个 Unicode 字符。
secondsinteger / string否—整数或整数字符串。fast/pro/basic 默认 5 秒,short 固定 8 秒;basic 最多 5 秒,参考生视频至少 3 秒。
durationinteger / string否—seconds 的兼容名称,两种写法同时出现时必须一致。
sizestring否1920x1080, 1080x1920, 1080x1080, 1440x1080, 1080x1440, 720x1280fast/pro/basic 仅接受 1080p 尺寸,short 仅接受 720x1280;具体枚举见指南。
resolutionstring否1080p, 720pfast/pro/basic 为 1080p,short 为 720p。
aspect_ratiostring否16:9, 9:16, 1:1, 4:3, 3:4画面比例;图片默认 1:1,普通视频默认 16:9,short 固定 9:16。
input_referencestring否—单张参考图片 URL / data URL;multipart 使用一个文件,最多 20 MiB。
image_urlstring否—单张 HTTP(S) 图片 URL 或图片 Base64 data URL。
reference_imagesarray否—非空参考图 URL / data URL 数组;与单图输入互斥。
generation_modestring否speed, pro, pro_ad仅参考生视频使用,默认 pro_ad。
metadataobject否—视频扩展参数对象;multipart 表单使用 JSON 编码字符串。
ninteger否1每次仅生成一个产物。
sample_countinteger否1仅接受 1,不支持多产物。
inputstring / array否—提示词文本或由 input_text/input_image 等内容组成的消息数组,与 prompt 互斥。
streamboolean否falsetrue 返回视频任务进度和最终视频链接。
backgroundboolean否falsetrue 时立即返回 Response ID,之后查询结果。
storeboolean否—宿主接受的 Responses 协议字段。

请求示例 ​

json
{
  "model": "cogvideo-fast",
  "input": "红色纸船在池塘上缓缓漂浮",
  "seconds": "5",
  "stream": true
}

响应 ​

StatusDescription
200Response envelope or Responses SSE; inspect the terminal response status, not HTTP status alone.
400Unsupported or conflicting parameters.
401Missing or invalid customer API Key.
429Capacity or rate limit exceeded.