Gemini Omni Flash 視頻生成
使用 Gemini Omni Flash 生成或編輯視頻,支持文字、最多 10 張參考圖或最多 3 個輸入視頻
中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。
- 通過
model指定gemini-omni-flash-preview-official - 支持文生視頻、圖像/參考圖生視頻和視頻編輯
- 最多支持 10 張參考圖和 3 個輸入視頻;圖片與視頻可在同一請求中混用
- 視頻最長 10 秒;Playground 提供 4 / 6 / 8 / 10 秒預設
- 僅支持
720p分辨率;支持16:9和9:16畫幅 - 異步任務接口,提交後使用任務 ID 查詢結果
本文檔僅適用於 gemini-omni-flash-preview-official. 平台通過 Vertex AI Interactions API 調用它, 而不是 Vertex AI Publisher Model 的 predictLongRunning 接口.
Authorizations
Authorizationstring請求頭必填使用 Bearer Token 認證:
Authorization: Bearer YOUR_API_KEYBody
modelstring請求體必填預設值: gemini-omni-flash-preview-official模型名稱。使用 gemini-omni-flash-preview-official。
promptstring請求體必填視頻生成提示詞。
durationinteger請求體預設值: 6視頻時長(秒),最大爲 10。Playground 提供 4、6、8、10 秒預設。
aspect_ratiostring請求體預設值: 16:9視頻比例,支持:
16:9橫屏9:16豎屏
resolutionstring請求體預設值: 720p視頻分辨率:
720p默認分辨率- 僅支持
720p,不接受 Veo 專屬參數
image_urlsstring[]請求體可選的參考圖 URL 數組,最多 10 張。不傳時爲文生視頻。可與 video_list 同時使用,例如續拍時附加參考圖。
video_listobject[]請求體可選的視頻編輯輸入,最多 3 個。每一項必須包含 video_url,例如 { "video_url": "https://example.com/input.mp4" }。支持 HTTPS URL、data URI 和平台上傳後返回的視頻 URL;後端下載的單個輸入視頻最大 50 MB。可與 image_urls 同時使用,支援影片加參考圖的混合輸入。
metadataobject請求體可選的 Interactions 生成參數。支持 temperature(0.0–2.0)、topP / top_p(0.0–1.0)、candidateCount / candidate_count、previous_interaction_id,以及 task(text_to_video、image_to_video、reference_to_video、edit 或 extend)。省略 task 時,平臺不會擅自預設;由上游根據 prompt 與媒體推斷。對 edit(或帶參考影片且未明確指定非 edit 任務)路徑,平臺會省略 aspect_ratio,因為上游拒絕在 edit 的 response_format 中設定長寬比。extend 透過 video_list 輸入來源影片續拍,不能與 previous_interaction_id 同時使用,同樣省略 aspect_ratio。
Response
idstring任務 ID,用於查詢任務狀態。
objectstring對象類型,通常爲 generation.task。
modelstring使用的模型名稱。
statusstring任務狀態:queued、in_progress、completed、failed。
created_atinteger任務創建時間戳。
video_urlstring任務完成後的生成視頻 URL。
Examples
請求示例
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-flash-preview-official",
"prompt": "一支藍色按壓瓶在純白攝影棚中輕微轉動,商業產品視頻",
"duration": 6,
"aspect_ratio": "9:16",
"resolution": "720p",
"image_urls": ["https://example.com/reference.jpg"]
}'影片延長範例(duration 為續拍秒數,缺省約 10 秒;輸出為來源影片加上續拍片段):
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-flash-preview-official",
"prompt": "延續當前場景和鏡頭運動",
"duration": 5,
"video_list": [{"video_url": "https://example.com/input.mp4"}],
"metadata": {"task": "extend"}
}'響應示例
{
"id": "video_01JZEXAMPLE",
"object": "generation.task",
"model": "gemini-omni-flash-preview-official",
"status": "queued",
"created_at": 1779247407
}查詢任務
提交接口會返回任務 ID。使用通用視頻任務查詢接口獲取狀態和結果:
curl --request GET \
--url https://toapis.com/v1/videos/generations/{task_id} \
--header "Authorization: Bearer YOUR_API_KEY"