AGTCloud API Docs
文件指南API Reference整合與資源更新與幫助
影片生成Gemini Omni

Gemini Omni 1.2 Flash 查詢影片

查詢 Gemini Omni 1.2 Flash 影片互動的狀態和生成結果。

使用建立介面傳回的互動 ID,查詢影片狀態、生成內容和用量。

GET/v1beta/interactions/{id}

授權

bearerAuth
授權Bearer <token>

使用目前平台的 API Key。

傳遞位置: header

路徑參數

id*string

建立介面傳回的互動 ID。

長度1 <= length

回應主體

application/json

application/json

application/json

application/json

application/json

application/json

讀取與儲存影片

HTTP 200 僅表示查詢成功,應檢查任務狀態。 僅在 in_progress 時繼續輪詢;任務完成、失敗或需要額外動作時,應停止原樣輪詢並依狀態處理。影片結果位於 steps 中的 model_output 步驟,尋找其 content 中 type: "video" 的內容並解碼 data。

任務成功後,可使用下載影片直接儲存檔案,也可自行解碼回應中的 Base64。

查詢遇到限流或暫時性錯誤時,可退避後重試。

以下 Python 範例讀取已儲存為 response.json 的成功回應,將影片解碼至本機;BASE64_ENCODED_VIDEO 為文件示意標記,不能用於解碼。

import base64
import json
from pathlib import Path

response = json.loads(Path("response.json").read_text(encoding="utf-8"))
video_index = 0
for step in response.get("steps", []):
    if step.get("type") != "model_output":
        continue
    for item in step.get("content", []):
        if item.get("type") == "video" and item.get("data"):
            Path(f"video-{video_index}.mp4").write_bytes(
                base64.b64decode(item["data"], validate=True)
            )
            video_index += 1

REST 回應不使用 SDK 的 output_video 便利屬性。需要提交新任務時,請使用建立影片。

Google Gemini Omni 查詢互動官方文件檢視上游協定定義與最新欄位變更。