Skip to main content
POST
cURL
使用此端點可透過文字指令編輯現有的 MP4。與全新生成請求相比,輸出會更貼近來源片段的時間節奏與構圖。

在你傳送請求之前

  • 提供可存取的 video.url
  • 讓來源片段保持簡短;依 xAI 自身的指引,編輯長度上限約為 8.7 秒
  • 使用聚焦的指令,描述單一明確的變更
  • 儲存回傳的 request_id,因為編輯使用與生成相同的輪詢流程

編輯流程

1

提交編輯請求

傳送來源影片 URL、編輯 Prompt,以及 model: grok-imagine-video
2

輪詢最終結果

呼叫 取得 xAI 影片結果,直到工作完成。
3

儲存編輯後的資產

下載完成的輸出,或將回傳的 URL 移入你自己的儲存流程中。

CometAPI 上的變更

xAI 將影片編輯記錄為與生成相同的非同步生命週期,只是把可選的來源圖片改為來源影片。CometAPI 保留了這個行為與相同的輪詢端點,因此你的編輯工作流程仍然是開始 -> 輪詢 -> 下載。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json
prompt
string
必填

Edit instruction describing the change you want.

範例:

"Add snow to the scene."

video
object
必填

Source video to edit. xAI documents an input limit of about 8.7 seconds.

model
string
預設值:grok-imagine-video

xAI video model id.

範例:

"grok-imagine-video"

output
object

Optional output delivery configuration.

user
string

Optional end-user identifier.

回應

200 - application/json

Request accepted.

request_id
string
必填

Deferred request id used for polling.