Videogenerierung (CogVideoX)
CogVideoX KI-Videogenerierungsmodell mit Unterstützung für Text-zu-Video.
API-Endpunkte
POST
/videos/generationsVideogenerierungsaufgabe erstellen
Anfrageparameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
model | string | Erforderlich | Modellname: CogVideoX |
prompt | string | Erforderlich | Videobeschreibungstext |
Anfrage-Beispiel
Anfrage-Beispiel
{
"model": "CogVideoX",
"prompt": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}Antwort-Beispiel
Antwort-Beispiel
{
"id": "video-123",
"created": 1677652288,
"model": "CogVideoX",
"task_status": "processing",
"video_url": null
}Code-Beispiele
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": "一只橘猫在花园里追逐蝴蝶,阳光明媚,慢动作镜头"
}'