查询视频生成任务
curl --request GET \
--url https://kaienapi.com/v1/video/generations/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/video/generations/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/video/generations/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/video/generations/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}查询视频生成任务
查询通用视频生成任务的状态和结果。
查询顺序
- 通过
POST /v1/video/generations提交视频任务。 - 保存创建接口返回的任务 ID。
- 按固定间隔调用本接口查询状态。
- 任务结束后,从响应中读取视频 URL、文件信息或错误原因。
轮询策略
前端应设置轮询间隔和停止条件。保存任务 ID、状态、创建时间和最终结果,用户刷新页面后仍能查看历史记录。
错误定位
- 404:确认
task_id是否来自创建接口,且没有传错环境。 - 长时间处理中:延长轮询间隔,并设置超时提示。
- 失败无结果:展示接口返回的错误原因,用户据此调整 prompt、尺寸或参考图。
GET
/
v1
/
video
/
generations
/
{task_id}
查询视频生成任务
curl --request GET \
--url https://kaienapi.com/v1/video/generations/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/video/generations/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/video/generations/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/video/generations/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}