您可以使用 Cloud de Confiance 控制台或 Agent Platform API,透過 Gemini Omni Flash 編輯影片。
以下機型支援編輯影片:
按一下即可展開支援的模型
如要瞭解如何撰寫有效的文字提示詞來生成影片,請參閱「影片生成提示詞指南」。
事前準備
-
In the Cloud de Confiance console, on the project selector page, select or create a Cloud de Confiance project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
Enable the Agent Platform API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
設定環境的驗證機制。
選取這個頁面上範例的預計用途分頁:
控制台
使用 Cloud de Confiance 控制台存取 Cloud de Confiance by S3NS 服務和 API 時,您不需要設定驗證機制。
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
安裝 Google Cloud CLI,然後 使用聯合身分登入 gcloud CLI。
詳情請參閱 Cloud de Confiance 驗證說明文件中的「使用 REST 進行驗證」。
使用 Gemini Omni Flash 編輯影片
如要使用 Gemini Omni Flash 編輯影片,請按照下列步驟操作:
REST
影片生成作業可能需要超過一分鐘才能完成。您可以根據工作流程選擇下列幾種互動模式:
- 同步:無狀態:透過單一要求生成影片,不將互動狀態保留在伺服器上。
- 同步:具狀態:將
store設為true,即可保留互動狀態,以便稍後擷取結果或參照互動 ID 進行多輪影片編輯。 - 同步:有狀態的串流:將
store和stream都設為true,即可在模型生成想法時逐步接收,然後接收輸出影片。 - 非同步:將
background設為true,在背景執行影片生成作業,並在稍後使用互動 ID 擷取結果。
儲存和非同步互動資料最多會保留 14 天。
如要進一步瞭解如何使用 Gemini Omni Flash API,請參閱「Interactions API」。
同步:無狀態
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
MODEL_ID:代表要使用的模型 ID 的字串。可接受的值如下:"gemini-omni-flash-preview""gemini-omni-1.1-flash-preview"
-
TEXT_PROMPT:用來引導影片生成的文字提示詞。 -
CLOUD_STORAGE_VIDEO_URI:代表 Cloud Storage bucket 的字串,其中包含輸入影片。例如:"gs://video-bucket/input/"。 -
VIDEO_MIME:代表影片 MIME 類型的字串。可接受的值如下:video/3gppvideo/mp4video/mpegvideo/quicktimevideo/webmvideo/x-flvvideo/x-ms-wmv
-
OUTPUT_RESOLUTION:選用:代表影片輸出解析度的字串。如未提供,輸出內容預設為 720p。
gemini-omni-1.1-flash-preview支援下列值:"360p""720p""1080p""4k"
gemini-omni-flash-preview僅支援"720p"。 -
CLOUD_STORAGE_OUTPUT_URI: 選用:代表 Cloud Storage bucket 的字串,用於儲存輸出影片。如未提供,系統會在回應中傳回影片位元組。 例如:"gs://video-bucket/output/"。
HTTP 方法和網址:
POST https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions
JSON 要求內文:
{
"model": "MODEL_ID",
"input": [
{
"type": "text",
"text": "TEXT_PROMPT"
},
{
"type": "video",
"uri": "CLOUD_STORAGE_VIDEO_URI",
"mime_type": "VIDEO_MIME"
}
],
"response_format": [
{
"type": "video",
"delivery": "uri",
"output": "OUTPUT_RESOLUTION",
"gcs_uri": "CLOUD_STORAGE_OUTPUT_URI"
}
],
"generation_config": {
"video_config": {
"task": "edit"
}
}
}
如要傳送要求,請選擇以下其中一個選項:
curl
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions"
PowerShell
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions" | Select-Object -Expand Content
{
"id":"INTERACTION_ID",
"model":"gemini-omni-flash-preview",
"status":"completed",
"usage":{
"total_tokens":479,
"total_input_tokens":26,
"input_tokens_by_modality":[
{
"modality":"text",
"tokens":26
},
{
"modality":"image",
"tokens":124
}
],
"output_tokens_by_modality": [
{
"modality": "video",
"tokens": 28832
}
],
"total_output_tokens":28832,
"total_thought_tokens":453
},
"steps":[
{
"type":"thought",
"summary":[
{
"type":"text",
"text":"MODEL THOUGHTS"
}
],
},
{
"type":"model_output",
"content":[
{
"type":"video",
"uri":"gs://some/output_path/123.mp4",
"mime_type":"video/mp4"
}
]
}
],
"object":"interaction",
"role":"model",
"created":"2026-05-29T02:17:56Z",
"updated":"2026-05-29T02:17:56Z",
}
同步:有狀態
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
MODEL_ID:代表要使用的模型 ID 的字串。可接受的值如下:"gemini-omni-flash-preview""gemini-omni-1.1-flash-preview"
-
TEXT_PROMPT:用來引導影片生成的文字提示詞。 -
CLOUD_STORAGE_VIDEO_URI:代表 Cloud Storage bucket 的字串,其中包含輸入影片。例如:"gs://video-bucket/input/"。 -
VIDEO_MIME:代表影片 MIME 類型的字串。可接受的值如下:video/3gppvideo/mp4video/mpegvideo/quicktimevideo/webmvideo/x-flvvideo/x-ms-wmv
-
OUTPUT_RESOLUTION:選用:代表影片輸出解析度的字串。如未提供,輸出內容預設為 720p。
gemini-omni-1.1-flash-preview支援下列值:"360p""720p""1080p""4k"
gemini-omni-flash-preview僅支援"720p"。 -
CLOUD_STORAGE_OUTPUT_URI: 選用:代表 Cloud Storage bucket 的字串,用於儲存輸出影片。如未提供,系統會在回應中傳回影片位元組。 例如:"gs://video-bucket/output/"。
HTTP 方法和網址:
POST https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions
JSON 要求內文:
{
"model": "MODEL_ID",
"background": false,
"store": true,
"stream": false,
"input": [
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "TEXT_PROMPT"
},
{
"type": "video",
"uri": "CLOUD_STORAGE_VIDEO_URI",
"mime_type": "VIDEO_MIME"
}
]
}
],
"response_format": [
{
"type": "video",
"delivery": "uri",
"resolution": "OUTPUT_RESOLUTION",
"gcs_uri": "CLOUD_STORAGE_OUTPUT_URI"
}
]
}
如要傳送要求,請選擇以下其中一個選項:
curl
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions"
PowerShell
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions" | Select-Object -Expand Content
{
"id":"INTERACTION_ID",
"model":"gemini-omni-flash-preview",
"status":"completed",
"usage":{
"total_tokens":479,
"total_input_tokens":26,
"input_tokens_by_modality":[
{
"modality":"text",
"tokens":26
},
{
"modality":"image",
"tokens":124
}
],
"output_tokens_by_modality": [
{
"modality": "video",
"tokens": 28832
}
],
"total_output_tokens":28832,
"total_thought_tokens":453
},
"steps":[
{
"type":"thought",
"summary":[
{
"type":"text",
"text":"MODEL THOUGHTS"
}
],
},
{
"type":"model_output",
"content":[
{
"type":"video",
"uri":"gs://some/output_path/123.mp4",
"mime_type":"video/mp4"
}
]
}
],
"object":"interaction",
"role":"model",
"created":"2026-05-29T02:17:56Z",
"updated":"2026-05-29T02:17:56Z",
}
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
INTERACTION_ID:非同步要求的互動 ID。
HTTP 方法和網址:
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID
如要傳送要求,請選擇以下其中一個選項:
curl
執行下列指令:
curl -X GET \
-H "Authorization: Bearer TOKEN" \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID"
PowerShell
執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID" | Select-Object -Expand Content
{
"id":"INTERACTION_ID",
"model":"gemini-omni-flash-preview",
"status":"completed",
"usage":{
"total_tokens":479,
"total_input_tokens":26,
"input_tokens_by_modality":[
{
"modality":"text",
"tokens":26
},
{
"modality":"image",
"tokens":124
}
],
"output_tokens_by_modality": [
{
"modality": "video",
"tokens": 28832
}
],
"total_output_tokens":28832,
"total_thought_tokens":453
},
"steps":[
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "5 second, 9:16 video. Use the image as the first frame."
},
{
"type": "image",
"uri": "gs://some/path",
"mime_type": "image/png"
}
]
},
{
"type":"thought"
"summary":[
{
"type":"text",
"text":"MODEL THOUGHTS"
}
],
},
{
"type":"model_output",
"content":[
{
"type":"video",
"data":"VIDEO DATA",
"mime_type":"video/mp4"
}
]
}
],
"object":"interaction"
"role":"model",
"created":"2026-05-29T02:17:56Z",
"updated":"2026-05-29T02:17:56Z",
}
同步:有狀態的串流
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
MODEL_ID:代表要使用的模型 ID 的字串。可接受的值如下:"gemini-omni-flash-preview""gemini-omni-1.1-flash-preview"
-
TEXT_PROMPT:用來引導影片生成的文字提示詞。 -
CLOUD_STORAGE_VIDEO_URI:代表 Cloud Storage bucket 的字串,其中包含輸入影片。例如:"gs://video-bucket/input/"。 -
VIDEO_MIME:代表影片 MIME 類型的字串。可接受的值如下:video/3gppvideo/mp4video/mpegvideo/quicktimevideo/webmvideo/x-flvvideo/x-ms-wmv
-
OUTPUT_RESOLUTION:選用:代表影片輸出解析度的字串。如未提供,輸出內容預設為 720p。
gemini-omni-1.1-flash-preview支援下列值:"360p""720p""1080p""4k"
gemini-omni-flash-preview僅支援"720p"。 -
CLOUD_STORAGE_OUTPUT_URI: 選用:代表 Cloud Storage bucket 的字串,用於儲存輸出影片。如未提供,系統會在回應中傳回影片位元組。 例如:"gs://video-bucket/output/"。
HTTP 方法和網址:
POST https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions
JSON 要求內文:
{
"model": "MODEL_ID",
"background": false,
"store": true,
"stream": true,
"input": [
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "TEXT_PROMPT"
},
{
"type": "video",
"uri": "CLOUD_STORAGE_VIDEO_URI",
"mime_type": "VIDEO_MIME"
}
]
}
],
"response_format": [
{
"type": "video",
"delivery": "uri",
"resolution": "OUTPUT_RESOLUTION",
"gcs_uri": "CLOUD_STORAGE_OUTPUT_URI"
}
]
}
如要傳送要求,請選擇以下其中一個選項:
curl
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions"
PowerShell
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions" | Select-Object -Expand Content
event: interaction.created
data: {"interaction":{"id":"INTERACTION_ID","status":"in_progress","object":"interaction","model":"gemini-omni-flash-preview"},"event_type":"interaction.created"}
event: interaction.status_update
data: {"interaction_id":"INTERACTION_ID","status":"in_progress","event_type":"interaction.status_update"}
event: step.start
data: {"index":0,"step":{"type":"thought"},"event_type":"step.start"}
event: step.delta
data: {"index":0,"delta":{"content":{"text":"MODEL THOUGHTS","type":"text"},"type":"thought_summary"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.delta
data: {"index":0,"delta":{"content":{"text":"MODEL THOUGHTS","type":"text"},"type":"thought_summary"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.delta
data: {"index":0,"delta":{"signature":"...","type":"thought_signature"},"event_type":"step.delta"}
event: step.stop
data: {"index":0,"event_type":"step.stop"}
event: step.start
data: {"index":1,"step":{"type":"model_output"},"event_type":"step.start"}
event: step.delta
data: {"index":1,"delta":{"mime_type":"video/mp4","uri":"gs://some/output_path/123.mp4","type":"video"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.stop
data: {"index":1,"event_type":"step.stop"}
event: interaction.completed
data: {"interaction":{"id":"INTERACTION_ID","status":"completed","usage":{"total_tokens":17812,"total_input_tokens":21,"input_tokens_by_modality":[{"modality":"text","tokens":21}],"total_output_tokens":17376,"output_tokens_by_modality":[{"modality":"video","tokens":17376}],"total_thought_tokens":415},"created":"2026-08-12T21:26:20Z","updated":"2026-08-12T21:26:20Z","event_id":"EVENT_ID","object":"interaction","model":"gemini-omni-flash-preview"},"event_id":"EVENT_ID","event_type":"interaction.completed"}
event: done
data: [DONE]
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
INTERACTION_ID:要求中的互動 ID。
HTTP 方法和網址:
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID?stream=true
如要傳送要求,請選擇以下其中一個選項:
curl
執行下列指令:
curl -X GET \
-H "Authorization: Bearer TOKEN" \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID?stream=true"
PowerShell
執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID?stream=true" | Select-Object -Expand Content
event: interaction.created
data: {"interaction":{"id":"INTERACTION_ID","status":"in_progress","object":"interaction","model":"gemini-omni-flash-preview"},"event_type":"interaction.created"}
event: interaction.status_update
data: {"interaction_id":"INTERACTION_ID","status":"in_progress","event_type":"interaction.status_update"}
event: step.start
data: {"index":0,"step":{"type":"thought"},"event_type":"step.start"}
event: step.delta
data: {"index":0,"delta":{"content":{"text":"MODEL THOUGHTS","type":"text"},"type":"thought_summary"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.delta
data: {"index":0,"delta":{"content":{"text":"MODEL THOUGHTS","type":"text"},"type":"thought_summary"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.delta
data: {"index":0,"delta":{"signature":"...","type":"thought_signature"},"event_type":"step.delta"}
event: step.stop
data: {"index":0,"event_type":"step.stop"}
event: step.start
data: {"index":1,"step":{"type":"model_output"},"event_type":"step.start"}
event: step.delta
data: {"index":1,"delta":{"mime_type":"video/mp4","uri":"gs://some/output_path/123.mp4","type":"video"},"event_id":"EVENT_ID","event_type":"step.delta"}
event: step.stop
data: {"index":1,"event_type":"step.stop"}
event: interaction.completed
data: {"interaction":{"id":"INTERACTION_ID","status":"completed","usage":{"total_tokens":17664,"total_input_tokens":21,"input_tokens_by_modality":[{"modality":"text","tokens":21}],"total_output_tokens":17376,"output_tokens_by_modality":[{"modality":"video","tokens":17376}],"total_thought_tokens":267},"created":"2026-08-12T21:33:08Z","updated":"2026-08-12T21:33:08Z","event_id":"EVENT_ID","object":"interaction","model":"gemini-omni-flash-preview"},"event_id":"EVENT_ID","event_type":"interaction.completed"}
event: done
data: [DONE]
非同步
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
MODEL_ID:代表要使用的模型 ID 的字串。可接受的值如下:"gemini-omni-1.1-flash-preview""gemini-omni-flash-preview"
-
TEXT_PROMPT:用來引導影片生成的文字提示詞。 -
CLOUD_STORAGE_VIDEO_URI:代表 Cloud Storage bucket 的字串,其中包含輸入影片。例如:"gs://video-bucket/input/"。 -
VIDEO_MIME:代表影片 MIME 類型的字串。可接受的值如下:video/3gppvideo/mp4video/mpegvideo/quicktimevideo/webmvideo/x-flvvideo/x-ms-wmv
-
OUTPUT_RESOLUTION:選用:代表影片輸出解析度的字串。如未提供,輸出內容預設為 720p。
gemini-omni-1.1-flash-preview支援下列值:"360p""720p""1080p""4k"
gemini-omni-flash-preview僅支援"720p"。 -
CLOUD_STORAGE_OUTPUT_URI: 選用:代表 Cloud Storage bucket 的字串,用於儲存輸出影片。如未提供,系統會在回應中傳回影片位元組。 例如:"gs://video-bucket/output/"。
HTTP 方法和網址:
POST https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions
JSON 要求內文:
{
"model": "MODEL_ID",
"input": [
{
"background": true,
"type": "text",
"text": "TEXT_PROMPT"
},
{
"type": "video",
"uri": "CLOUD_STORAGE_VIDEO_URI",
"mime_type": "VIDEO_MIME"
}
],
"response_format": [
{
"type": "video",
"delivery": "uri",
"resolution": "OUTPUT_RESOLUTION",
"gcs_uri": "CLOUD_STORAGE_OUTPUT_URI"
}
],
"generation_config": {
"video_config": {
"task": "edit"
}
}
}
如要傳送要求,請選擇以下其中一個選項:
curl
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions"
PowerShell
將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions" | Select-Object -Expand Content
{
"id":"INTERACTION_ID",
"status":"in_progress",
"object":"interaction"
}
使用任何要求資料之前,請先修改下列項目的值:
-
PROJECT_ID:代表 Cloud de Confiance by S3NS 專案 ID 的字串。 -
INTERACTION_ID: 非同步要求的互動 ID。
HTTP 方法和網址:
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID
如要傳送要求,請選擇以下其中一個選項:
curl
執行下列指令:
curl -X GET \
-H "Authorization: Bearer TOKEN" \
"https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID"
PowerShell
執行下列指令:
$headers = @{ "Authorization" = "Bearer TOKEN" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/global/interactions/INTERACTION_ID" | Select-Object -Expand Content
{
"id":"INTERACTION_ID",
"model":"gemini-omni-flash-preview",
"status":"completed",
"usage":{
"total_tokens":479,
"total_input_tokens":26,
"input_tokens_by_modality":[
{
"modality":"text",
"tokens":26
},
{
"modality":"image",
"tokens":124
}
],
"output_tokens_by_modality": [
{
"modality": "video",
"tokens": 28832
}
],
"total_output_tokens":28832,
"total_thought_tokens":453
},
"steps":[
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "5 second, 9:16 video. Use the image as the first frame."
},
{
"type": "image",
"uri": "gs://some/path",
"mime_type": "image/png"
}
]
},
{
"type":"thought"
"summary":[
{
"type":"text",
"text":"MODEL THOUGHTS"
}
],
},
{
"type":"model_output",
"content":[
{
"type":"video",
"data":"VIDEO DATA",
"mime_type":"video/mp4"
}
]
}
],
"object":"interaction"
"role":"model",
"created":"2026-05-29T02:17:56Z",
"updated":"2026-05-29T02:17:56Z",
}