xAI
影片生成
使用 CometAPI POST /grok/v1/videos/generations 搭配 Grok 建立影片,透過 prompt 將輸入圖片製作成動畫,並透過 request_id 輪詢結果。
POST
使用此端點可從文字,或從文字加上一張來源圖片,啟動一個 Grok 影片任務。它會立即回傳Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
request_id,因此請將其視為非同步工作流程的第一步。
從小型請求開始
- 使用
model: grok-imagine-video - 首次請求時,將
duration維持為1,並將resolution設為480p - 只有在你想要圖片轉影片時才加入
image.url - 如果你傳送 base64,請將文件與 OpenAPI 範例格式維持為
data:image/png;base64,<BASE64_IMAGE_DATA>
任務流程
輪詢完成狀態
呼叫 取得影片生成結果,直到巢狀 provider 狀態變為
done。授權
Bearer token authentication. Use your CometAPI key.
主體
application/json
Prompt for the video job.
範例:
"A candle flickers on a wooden table."
Output aspect ratio.
可用選項:
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. xAI documents a range of 1 to 15 seconds.
Optional source image for image-to-video.
xAI video model id.
範例:
"grok-imagine-video"
Output resolution.
可用選項:
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
回應
200 - application/json
Request accepted.
Deferred request id used for polling.