비디오 생성 (CogVideoX)
CogVideoX AI 비디오 생성 모델로 텍스트-비디오 변환을 지원합니다.
API 엔드포인트
POST
/videos/generations비디오 생성 작업 생성
요청 파라미터
| 파라미터 | 유형 | 필수 | 설명 |
|---|---|---|---|
model | string | 필수 | 모델명: CogVideoX |
prompt | string | 필수 | 비디오 설명 텍스트 |
요청 예시
요청 예시
{
"model": "CogVideoX",
"prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}응답 예시
응답 예시
{
"id": "video-123",
"created": 1677652288,
"model": "CogVideoX",
"task_status": "processing",
"video_url": null
}코드 예시
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": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}'