跳轉到主要內容
POST
/
v1
/
videos
/
generations
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-video-1.5-preview",
    "prompt": "將這張產品圖生成電影感商業視頻,輕微鏡頭推進",
    "images": ["https://example.com/product.jpg"],
    "seconds": "10",
    "aspect_ratio": "16:9"
  }'
{
  "id": "video_abc123def456",
  "object": "generation.task",
  "model": "grok-video-1.5-preview",
  "status": "queued",
  "progress": 0,
  "created_at": 1768380224,
  "metadata": {}
}
  • 僅支持圖生視頻,不支持文生視頻。
  • 必須傳入且僅能傳入 1 張公網參考圖 URL。
  • 支持 10 秒和 15 秒視頻。
  • 畫面比例僅支持 16:99:16
  • 異步任務 API:提交後使用任務 ID 查詢視頻生成狀態。
不要直接傳入 base64 圖片數據。請先使用 上傳圖片接口 上傳本地圖片,再將返回的公網 URL 放入 images

Authorizations

Authorization
string
必填
所有接口均需要 Bearer Token 認證。
Authorization: Bearer YOUR_API_KEY

Body

model
string
預設值:"grok-video-1.5-preview"
必填
固定使用 grok-video-1.5-preview
prompt
string
必填
描述參考圖需要生成的動態效果、鏡頭運動和視覺方向。
images
string[]
必填
傳入且僅傳入 1 個公網圖片 URL。
  • 最少:1
  • 最多:1
  • 支持 URL 協議:http://https://
seconds
string
預設值:"10"
視頻時長。支持值:"10""15"
aspect_ratio
string
預設值:"16:9"
視頻畫面比例。支持值:16:99:16

Pricing

時長價格
10s$0.10 / request
15s$0.15 / request

Response

id
string
用於查詢任務狀態的任務 ID。
object
string
對象類型,固定爲 generation.task
model
string
本次任務使用的模型名。
status
string
任務狀態:queuedin_progresscompletedfailed

創建視頻任務

curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-video-1.5-preview",
    "prompt": "將這張產品圖生成電影感商業視頻,輕微鏡頭推進",
    "images": ["https://example.com/product.jpg"],
    "seconds": "10",
    "aspect_ratio": "16:9"
  }'
{
  "id": "video_abc123def456",
  "object": "generation.task",
  "model": "grok-video-1.5-preview",
  "status": "queued",
  "progress": 0,
  "created_at": 1768380224,
  "metadata": {}
}

查詢任務狀態

使用返回的 id 調用 視頻任務狀態接口