获取视频生成操作状态
curl --request GET \
--url https://api.tokenops.ai/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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/global/publishers/google/models/veo-3.1-fast-generate-001/operations/operation-123456789",
"done": true,
"response": {
"generatedVideos": [
{
"uri": "https://my-bucket/generated-videos/video-123.mp4",
"videoBytes": "aSDinaTvuI8gbWludGxpZnk=",
"mimeType": "video/mp4",
"createTime": "2026-07-15T00:00:00Z"
}
],
"generateVideoResponse": {
"generatedSamples": [
{
"video": {
"uri": "https://generativelanguage.googleapis.com/v1beta/files/video-123",
"encodedVideo": "aSDinaTvuI8gbWludGxpZnk=",
"encoding": "video/mp4"
},
"encoding": "video/mp4"
}
]
}
}
}{
"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://api.tokenops.ai/v1beta/projects/{project_id}/locations/{location}/publishers/{publisher}/models/{model}/operations/{operation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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://api.tokenops.ai/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/global/publishers/google/models/veo-3.1-fast-generate-001/operations/operation-123456789",
"done": true,
"response": {
"generatedVideos": [
{
"uri": "https://my-bucket/generated-videos/video-123.mp4",
"videoBytes": "aSDinaTvuI8gbWludGxpZnk=",
"mimeType": "video/mp4",
"createTime": "2026-07-15T00:00:00Z"
}
],
"generateVideoResponse": {
"generatedSamples": [
{
"video": {
"uri": "https://generativelanguage.googleapis.com/v1beta/files/video-123",
"encodedVideo": "aSDinaTvuI8gbWludGxpZnk=",
"encoding": "video/mp4"
},
"encoding": "video/mp4"
}
]
}
}
}{
"error": {
"code": 123,
"message": "<string>",
"details": [
{}
]
}
}查询长时间运行的视频生成任务的状态和结果。
当原始视频模型名称包含
/ 时,operation resource name 会保留完整模型标识,例如
.../models/google/veo-3.1-generate-preview/operations/{operation_id}。
完成后的响应同时保留两套兼容字段:已有客户可以继续读取
response.generatedVideos,Google 官方 SDK 读取
response.generateVideoResponse.generatedSamples[].video。新增 Google SDK 字段不会删除、
重命名或重组已有 TokenOps 响应字段。
官方 Google SDK 可以直接轮询这个 GET 接口。即使 SDK 为 GET 请求保留
Content-Type: application/json 且不发送 body,Router 也会正常处理,无需客户删除该请求头。Authorizations
TokenOPS.AI API密钥认证。在 Authorization HTTP Header 中包含您的 API-Key,格式为 Bearer {API_KEY}
Path Parameters
项目ID
Example:
"my-project"
地理位置
Example:
"us-central1"
发布者
Example:
"google"
完整 TokenOps 模型名称;可包含斜杠分段,例如 google/veo-3.1-generate-preview。
Example:
"veo-3.1-generate-preview"
操作ID,从predictLongRunning接口返回的操作名称中提取
Example:
"projects/my-project/locations/us-central1/operations/operation-123456789"