获取视频生成操作状态
curl --request GET \
--url https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_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://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_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))
}HttpResponse<String> response = Unirest.get("https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"name": "projects/my-project/locations/us-central1/operations/operation-123456789",
"metadata": {},
"done": false,
"error": {
"code": 123,
"message": "<string>",
"details": [
{}
]
},
"response": {
"generatedVideos": [
{
"uri": "https://my-bucket/generated-videos/video-123.mp4",
"videoBytes": "aSDinaTvuI8gbWludGxpZnk=",
"mimeType": "video/mp4",
"createTime": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": 123,
"message": "<string>",
"details": [
{}
]
}
}视频生成
getGenerateVideosOperation
查询视频生成任务的状态和结果。
GET
/
v1beta
/
projects
/
{project_id}
/
locations
/
{location}
/
publishers
/
{publisher}
/
models
/
{model}
/
operations
/
{operation_id}
获取视频生成操作状态
curl --request GET \
--url https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_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://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_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))
}HttpResponse<String> response = Unirest.get("https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://model-api.skyengine.com.cn/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"name": "projects/my-project/locations/us-central1/operations/operation-123456789",
"metadata": {},
"done": false,
"error": {
"code": 123,
"message": "<string>",
"details": [
{}
]
},
"response": {
"generatedVideos": [
{
"uri": "https://my-bucket/generated-videos/video-123.mp4",
"videoBytes": "aSDinaTvuI8gbWludGxpZnk=",
"mimeType": "video/mp4",
"createTime": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": 123,
"message": "<string>",
"details": [
{}
]
}
}查询长时间运行的视频生成任务的状态和结果。
Authorizations
ModelHub API密钥认证。在 Authorization HTTP Header 中包含您的 API-Key,格式为 Bearer {API_KEY}
Path Parameters
项目ID
Example:
"my-project"
地理位置
Example:
"us-central1"
发布者
Example:
"google"
模型名称
Example:
"veo-3.1-generate-preview"
操作ID,从predictLongRunning接口返回的操作名称中提取
Example:
"projects/my-project/locations/us-central1/operations/operation-123456789"

