Video Generation (CogVideoX)
CogVideoX AI video generation model supporting text-to-video.
API Endpoints
POST
/videos/generationsCreate video generation task
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model name: CogVideoX |
prompt | string | Required | Video description text |
Request Example
Request Example
{
"model": "CogVideoX",
"prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}Response Example
Response Example
{
"id": "video-123",
"created": 1677652288,
"model": "CogVideoX",
"task_status": "processing",
"video_url": null
}Code Examples
Python
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 查询生成结果JavaScript
const response = await fetch('https://your-proxy-domain.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'CogVideoX',
prompt: '一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头'
})
});
const result = await response.json();
console.log(result);
// 轮询检查视频生成状态
const taskId = result.id;
// 使用 taskId 查询生成结果cURL
curl https://your-proxy-domain.com/v1/videos/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key" \
-d '{
"model": "CogVideoX",
"prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}'