APIMaster.ai

Grok Imagine Video 1.5 API

透過 APIMaster 呼叫 Grok Imagine Video 1.5,進行文字轉影片與圖片轉影片生成。

Grok Imagine Video 1.5

使用 APIMaster 的非同步影片 API 搭配 grok-imagine-video-1.5,進行文字轉影片與圖片轉影片生成。

基礎 URL:https://apimaster.ai/v1 (https://apimaster.ai/v1)。使用 POST https://apimaster.ai/v1/videos/generations 建立任務。

提交任務

POST https://apimaster.ai/v1/videos/generations

欄位 類型 必填 說明
model 字串 是 grok-imagine-video-1.5
prompt 字串 是 影片描述,使用英文或中文
aspect_ratio 字串 否 長寬比,例如 16:9、9:16 或 1:1;預設 16:9
duration 整數 否 影片長度(秒);預設為 6
resolution 字串 否 480p、720p 或其他目前可用的解析度;預設 720p
image_urls 字串[] 否 可公開存取的 HTTP(S) 參考圖片 URL

文字轉影片

curl -s "https://apimaster.ai/v1/videos/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video-1.5",
    "prompt": "A dog running on a sunny beach, cinematic slow motion",
    "aspect_ratio": "16:9",
    "duration": 6,
    "resolution": "720p"
  }'

圖片轉影片

curl -s "https://apimaster.ai/v1/videos/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video-1.5",
    "prompt": "Animate the scene naturally with a gentle camera push-in",
    "image_urls": ["https://example.com/start.png"],
    "aspect_ratio": "16:9",
    "duration": 10,
    "resolution": "720p"
  }'

提交回應包含任務 ID:

{
  "code": 200,
  "data": [{"task_id": "task_xxxxxxxx", "status": "submitted"}]
}

檢查任務狀態

GET https://apimaster.ai/v1/videos/{task_id}

curl -s "https://apimaster.ai/v1/videos/task_xxxxxxxx" \
  -H "Authorization: Bearer YOUR_API_KEY"

完成後,回應會包含影片 URL:

{
  "id": "task_xxxxxxxx",
  "status": "completed",
  "progress": "100%",
  "url": "https://apimaster.ai/v1/videos/task_xxxxxxxx/content"
}

下載

GET https://apimaster.ai/v1/videos/{task_id}/content

curl -L "https://apimaster.ai/v1/videos/task_xxxxxxxx/content" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o output.mp4

限制與錯誤

  • 低於 6 秒的長度會標準化為 6 秒;可用的最大長度與解析度由目前的模型卡與回應決定。
  • 每個 image_urls 項目都必須是公開的 HTTP(S) URL。
  • 401 表示 API 金鑰無效,402 表示餘額不足,429 表示受到速率限制。
  • 若任務失敗,請先閱讀狀態回應中的錯誤,再嘗試下載。