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-1.1-flash-preview-official",
"prompt": "A red paper boat floating on a calm lake at sunrise",
"duration": 3,
"aspect_ratio": "16:9",
"resolution": "360p"
}'
{
"id": "video_01JZEXAMPLE",
"object": "generation.task",
"model": "gemini-omni-1.1-flash-preview-official",
"status": "queued",
"created_at": 1779247407
}
Gemini Omni Official
Gemini Omni 1.1 影片生成與編輯
使用官方 Gemini Omni 1.1 Flash Preview 生成, 編輯或延長 3-10 秒影片, 支援四種解析度
POST
/
v1
/
videos
/
generations
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-1.1-flash-preview-official",
"prompt": "A red paper boat floating on a calm lake at sunrise",
"duration": 3,
"aspect_ratio": "16:9",
"resolution": "360p"
}'
{
"id": "video_01JZEXAMPLE",
"object": "generation.task",
"model": "gemini-omni-1.1-flash-preview-official",
"status": "queued",
"created_at": 1779247407
}
- 透過
model指定gemini-omni-1.1-flash-preview-official - 支援文生影片, 圖生影片, 參考圖生影片, 影片編輯和影片延長
- 最多支援 10 張參考圖和 3 個輸入影片; 圖片與影片可在同一請求中混用
- 時長 3-10 秒; 解析度支援 360p / 720p / 1080p / 4K
- 非同步任務介面, 提交後使用任務 ID 查詢結果
中國大陸使用者可將範例網域替換為
https://toapis.cn.Authorizations
string
必填
使用 Bearer Token 認證:
Authorization: Bearer YOUR_API_KEY
Body
string
預設值:"gemini-omni-1.1-flash-preview-official"
必填
模型名稱. 使用
gemini-omni-1.1-flash-preview-official.string
必填
影片生成, 編輯或延長的提示詞.
integer
預設值:"6"
影片時長(秒), 整數
3-10. extend 任務時表示續拍長度, 缺省約 10 秒.string
預設值:"16:9"
影片比例,支援:
16:9橫屏9:16直屏
edit 和 extend 任務不傳此欄位.string
預設值:"720p"
影片解析度,支援:
360p720p1080p4K
string[]
可選的參考圖 URL 陣列,最多
10 張. 不傳時為文生影片. 可與 video_list 同時使用,例如續拍時附加參考圖.object[]
可選的輸入影片,最多
3 個. 每一項必須包含 video_url,例如 { "video_url": "https://example.com/input.mp4" }. 支援 HTTPS URL, data URI 和平臺上傳後回傳的影片 URL; 後端下載的單個輸入影片最大 50 MB, 支援 MP4/MOV. 可與 image_urls 同時使用,支援影片加參考圖的混合輸入. edit 和 extend 任務必須提供輸入影片.object
可選的 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 和 extend(或帶輸入影片且未明確指定其他任務)路徑,平臺會省略 aspect_ratio. extend 透過 video_list 輸入來源影片續拍,不能與 previous_interaction_id 同時使用.generateAudio, negativePrompt 和 seed.
Response
string
任務 ID,用於查詢任務狀態。
string
物件類型,通常為
generation.task。string
使用的模型名稱。
string
任務狀態:
queued、in_progress、completed、failed。integer
任務建立時間戳。
string
任務完成後的生成影片 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-1.1-flash-preview-official",
"prompt": "A red paper boat floating on a calm lake at sunrise",
"duration": 3,
"aspect_ratio": "16:9",
"resolution": "360p"
}'
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-1.1-flash-preview-official",
"prompt": "Change the sky to a warm sunset",
"duration": 6,
"resolution": "1080p",
"video_list": [{"video_url": "https://example.com/uploaded-video.mp4"}],
"metadata": {"task": "edit"}
}'
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-1.1-flash-preview-official",
"prompt": "Continue the scene: the subject keeps moving naturally",
"duration": 5,
"video_list": [{"video_url": "https://example.com/uploaded-video.mp4"}],
"metadata": {"task": "extend"}
}'
{
"id": "video_01JZEXAMPLE",
"object": "generation.task",
"model": "gemini-omni-1.1-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"