视频生成 (CogVideoX)

CogVideoX AI 视频生成模型,支持文生视频。

API 端点

POST/videos/generations

创建视频生成任务

请求参数

参数名类型必填说明
modelstring必填模型名称:CogVideoX
promptstring必填视频描述文本

请求示例

请求示例
{
  "model": "CogVideoX",
  "prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}

响应示例

响应示例
{
  "id": "video-123",
  "created": 1677652288,
  "model": "CogVideoX",
  "task_status": "processing",
  "video_url": null
}

代码示例

import requests

url = "https://your-proxy-domain.com/v1/videos/generations"
headers = {
    "Authorization": "Bearer your-api-key",
    "Content-Type": "application/json"
}

data = {
    "model": "CogVideoX",
    "prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}

response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)

# 轮询检查视频生成状态
task_id = result.get("id")
# 使用 task_id 查询生成结果