xAI
取得 xAI 影片結果
使用 GET /grok/v1/videos/ 輪詢 xAI 影片生成狀態,並在處理完成後取得最終影片 URL。
GET
在你已經取得
request_id 之後,使用這個端點。它會告訴你 xAI 工作是否仍在執行中,並在就緒時回傳最終影片中繼資料。
先檢查這些欄位
- 任務已被接受但結果尚未就緒時,查看
request_id - 使用
status判斷 xAI 工作狀態;持續輪詢直到它變成done - 若有回傳,使用
progress查看完成百分比 - 當轉譯完成時,查看
video.url
輪詢迴圈
1
先建立或編輯影片
先從 建立 xAI 影片 或 建立 xAI 影片編輯 開始,然後複製回傳的
request_id。2
持續輪詢直到 status 為 done
如果回應只回傳
request_id,請等待幾秒後再次輪詢。一旦出現 status,就用它作為停止條件。3
保存完成的檔案
請盡快下載或複製最終的
video.url,因為 xAI 將生成的 URL 文件化為暫時性連結。授權
Bearer token authentication. Use your CometAPI key.
路徑參數
Deferred request id returned by the create or edit endpoint.
回應
200 - application/json
Current xAI video task state.
Returned when the request is accepted but result metadata is not ready yet.
xAI video model id.
Billing metadata. cost_in_usd_ticks reports the cost in provider ticks.
Generated video metadata. Present when the job has completed.
xAI job state. done means the video metadata is ready.
可用選項:
queued, processing, done, failed, expired Completion percentage when returned.
Error details when the job fails.