88API88API
使用指南AI 應用API 文件幫助支援
影片(Video)

影片 API 使用示例

本頁提供當前已正式開放的 Veo 影片模型呼叫示例。完整引數說明請先閱讀 Veo 影片 API

橫屏文生影片

curl --request POST 'https://88api.ai/v1/videos' \
  --header 'Authorization: Bearer sk-xxxx' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "veo-3.1-fast-1080p-8s",
    "prompt": "紅色玻璃球在白色地面上緩慢滾動,柔和影棚光,固定鏡頭",
    "size": "1920x1080",
    "duration": 8
  }'

豎屏文生影片

curl --request POST 'https://88api.ai/v1/videos' \
  --header 'Authorization: Bearer sk-xxxx' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "veo-3.1-1080p-8s",
    "prompt": "雨夜街頭,一位行人撐傘走過霓虹燈牌,電影感,鏡頭緩慢跟隨",
    "size": "1080x1920",
    "duration": 8
  }'

提交成功後儲存響應中的 id,然後查詢任務狀態:

curl 'https://88api.ai/v1/videos/task_xxxxxxxxxxxxxxxxxxxxxxxx' \
  --header 'Authorization: Bearer sk-xxxx'

單圖生影片

curl --request POST 'https://88api.ai/v1/videos' \
  --header 'Authorization: Bearer sk-xxxx' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "veo-3.1-1080p-8s",
    "prompt": "保持主體外觀一致,鏡頭緩慢推進,背景自然移動",
    "size": "1920x1080",
    "duration": 8,
    "images": [
      "https://example.com/reference.jpg"
    ]
  }'

首尾幀影片

curl --request POST 'https://88api.ai/v1/videos' \
  --header 'Authorization: Bearer sk-xxxx' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "veo-3.1-fast-1080p-8s",
    "prompt": "從首幀自然過渡到尾幀,主體一致,鏡頭運動平穩",
    "size": "1920x1080",
    "duration": 8,
    "images": [
      "https://example.com/first-frame.jpg",
      "https://example.com/last-frame.jpg"
    ]
  }'

PowerShell 完整輪詢示例

$baseUrl = "https://88api.ai"
$apiKey = "sk-xxxx"
$headers = @{ Authorization = "Bearer $apiKey" }

$body = @{
  model = "veo-3.1-fast-1080p-8s"
  prompt = "清晨的海岸線,海浪緩慢拍打沙灘,電影感航拍"
  size = "1920x1080"
  duration = 8
} | ConvertTo-Json

$task = Invoke-RestMethod `
  -Method Post `
  -Uri "$baseUrl/v1/videos" `
  -Headers $headers `
  -ContentType "application/json" `
  -Body $body

$state = $null
do {
  Start-Sleep -Seconds 8
  $state = Invoke-RestMethod `
    -Method Get `
    -Uri "$baseUrl/v1/videos/$($task.id)" `
    -Headers $headers
} while ($state.status -in @("queued", "processing", "pending", "in_progress"))

if ($state.status -eq "completed") {
  $videoUrl = $state.video_url.Replace('\u0026', '&')
  Invoke-WebRequest -Uri $videoUrl -OutFile "veo-result.mp4"
} else {
  throw ($state.error | ConvertTo-Json -Compress)
}

最佳實踐

  1. 使用詳細提示詞描述主體、動作、鏡頭、光線和風格。
  2. 當前公開模型固定生成 8 秒,請傳入 duration: 8
  3. 圖生影片最多傳 2 張圖片:第 1 張為首幀,第 2 張為尾幀。
  4. 只有網路請求明確未送達伺服器時才重試提交;不要因等待時間較長而重複建立任務。
  5. video_url 是臨時簽名地址,生成成功後應儘快下載並轉存。