跳轉到主要內容
POST
使用此端點從文字、來源圖片或參照輸入啟動 Grok 影片工作。它會立即傳回 request_id,因此請將其視為非同步工作流程的第一步。 一律明確傳送 model: grok-imagine-video-1.5。此處記錄的 1.5 請求形式需要 model 和 prompt。

選擇輸入模式

若使用資料 URI,請使用 data:image/png;base64,<BASE64_IMAGE_DATA>。每個 reference_images 項目都使用相同的 url 欄位。參照音訊項目使用預設的 voice_id,例如 eve。在 Prompt 中,<IMAGE_0> 和 <AUDIO_0> 等標籤可識別對應的參照。

從小型請求開始

  • 使用 model: grok-imagine-video-1.5
  • 首次請求時,請將 duration 保持為 1,並將 resolution 保持為 480p
  • 明確指定 prompt,以確保場景和動作清楚明確
  • 在合併參照圖片和語音之前,請一次新增一種輸入模式

時長與解析度

產生的影片包含音軌。當您的應用程式依賴特定輸出形式時,請明確設定 duration、resolution 和 aspect_ratio。

工作流程

1

建立工作

傳送模型、Prompt 和任何輸入,然後儲存傳回的 request_id。
2

輪詢完成狀態

呼叫 取得 xAI 影片結果 直到頂層 status 變為 done、failed 或 expired。準備工作中繼資料時,初始回應可能僅包含回傳的 request_id。
3

保存輸出

若在暫時交付期限過後仍需要最終 video.url,請將其複製到您自己的儲存空間。

授權

Authorization
string
header
必填

Use your CometAPI API key as the bearer value.

主體

application/json
model
enum<string>
必填

The Grok video model ID. Send this field explicitly so the request uses Grok Imagine Video 1.5.

可用選項:
grok-imagine-video-1.5
範例:

"grok-imagine-video-1.5"

prompt
string
必填

A description of the scene, motion, and audio. Reference-to-video prompts can identify inputs with tags such as <IMAGE_0> and <AUDIO_0>.

Minimum string length: 1
範例:

"A paper boat glides across a quiet pond at sunrise."

duration
integer
預設值:8

The output duration in seconds. Use an integer from 1 through 15.

必填範圍: 1 <= x <= 15
aspect_ratio
enum<string>

The output aspect ratio. Text-to-video uses 16:9 when omitted. Image-to-video uses the source image's aspect ratio when omitted.

可用選項:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
範例:

"16:9"

resolution
enum<string>
預設值:480p

The output resolution. Reference-to-video requests support 480p and 720p; text-to-video and image-to-video also support 1080p.

可用選項:
480p,
720p,
1080p
image
object

The source image for image-to-video. Do not combine this field with reference_images or reference_audios.

reference_images
object[]

Visual references for reference-to-video. Each item accepts a public image URL or image data URI. Do not combine this field with image.

Required array length: 1 - 7 elements
reference_audios
object[]

Preset voice references for reference-to-video. Do not combine this field with image.

Required array length: 1 - 3 elements

回應

200 - application/json

Request accepted.

request_id
string
必填

The deferred request ID used to poll GET /grok/v1/videos/{request_id}.

最後修改於 2026年8月21日