Skip to content
SuperToken 文档

Veo 3.1 异步任务与示例

Veo 3.1 任务通过 POST /v1/video/tasks 创建。创建使用模型 API Token;查询任务使用资源 API Key。

视频提示词最多 1200 个 Unicode 字符。output.generate_audio 控制成片音轨,省略时默认 true

环境变量

bash
export SUPERTOKEN_BASE_URL="https://api.supertoken.cc"
export SUPERTOKEN_KEY="YOUR_MODEL_API_TOKEN"
export RESOURCE_API_KEY="YOUR_RESOURCE_API_KEY"

Veo Fast 文生视频

Fast 支持 4、6、8 秒和 frame 模式。可以不传图片:

bash
curl -i -sS "$SUPERTOKEN_BASE_URL/v1/video/tasks" \
  -H "Authorization: Bearer $SUPERTOKEN_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: veo-fast-text-20260730-001" \
  -d '{
    "model": "adobe-veo-3.1-fast-720p",
    "operation": "generation",
    "input": {
      "prompt": "清晨的山谷云海,镜头贴近山脊平稳向前推进",
      "reference_mode": "frame"
    },
    "output": {
      "duration": 4,
      "aspect_ratio": "16:9",
      "generate_audio": true
    },
    "client_reference_id": "order-veo-fast-001"
  }'

Veo Fast 首尾帧

input.image 是首帧,input.reference_images[0] 是尾帧:

bash
curl -sS "$SUPERTOKEN_BASE_URL/v1/video/tasks" \
  -H "Authorization: Bearer $SUPERTOKEN_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: veo-fast-frames-20260730-001" \
  -d '{
    "model": "adobe-veo-3.1-fast-1080p",
    "operation": "generation",
    "input": {
      "prompt": "镜头从室外平滑进入室内,保持建筑几何结构稳定",
      "reference_mode": "frame",
      "image": {
        "url": "https://media.example.com/veo/exterior.jpg",
        "name": "start"
      },
      "reference_images": [
        {
          "url": "https://media.example.com/veo/interior.jpg",
          "name": "end"
        }
      ]
    },
    "output": {
      "duration": 6,
      "aspect_ratio": "16:9"
    }
  }'

Fast 不支持 images。多图参考请改用 Veo Standard。

Veo Standard 三图参考

Standard 的 images 固定要求 8 秒、16:9,最多三张图:

bash
curl -sS "$SUPERTOKEN_BASE_URL/v1/video/tasks" \
  -H "Authorization: Bearer $SUPERTOKEN_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: veo-standard-images-20260730-001" \
  -d '{
    "model": "adobe-veo-3.1-standard-720p",
    "operation": "generation",
    "input": {
      "prompt": "使用 @product、@environment 和 @lighting 生成电影感产品展示",
      "reference_mode": "images",
      "reference_images": [
        {
          "url": "https://media.example.com/veo/product.jpg",
          "name": "product"
        },
        {
          "url": "https://media.example.com/veo/environment.jpg",
          "name": "environment"
        },
        {
          "url": "https://media.example.com/veo/lighting.jpg",
          "name": "lighting"
        }
      ]
    },
    "output": {
      "duration": 8,
      "aspect_ratio": "16:9",
      "generate_audio": false
    }
  }'

下面这些 Standard images 组合都会在预扣费前返回 400 invalid_video_parameter

  • duration 为 4 或 6;
  • aspect_ratio9:16
  • 传入第 4 张参考图;
  • 同时传参考视频或参考音频。

Veo Standard 竖屏帧模式

Standard 的 frame 没有 images 的固定组合限制,可以使用 4、6、8 秒和 9:16

bash
curl -sS "$SUPERTOKEN_BASE_URL/v1/video/tasks" \
  -H "Authorization: Bearer $SUPERTOKEN_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: veo-standard-frame-20260730-001" \
  -d '{
    "model": "adobe-veo-3.1-standard-1080p",
    "operation": "generation",
    "input": {
      "prompt": "人物从街角走入霓虹灯下,竖屏构图,平滑跟拍",
      "reference_mode": "frame",
      "image": {
        "url": "https://media.example.com/veo/start.jpg",
        "name": "start"
      }
    },
    "output": {
      "duration": 6,
      "aspect_ratio": "9:16"
    }
  }'

创建响应

创建成功返回 202 AcceptedLocation 和建议轮询间隔:

http
Location: /v1/video/tasks/task_veo_example
Retry-After: 2
json
{
  "id": "task_veo_example",
  "object": "video.task",
  "model": "adobe-veo-3.1-fast-720p",
  "operation": "generation",
  "status": "queued",
  "progress": 0,
  "result": null,
  "error": null,
  "client_reference_id": "order-veo-fast-001",
  "metadata": {},
  "created_at": 1785373200,
  "started_at": null,
  "completed_at": null,
  "updated_at": 1785373200
}

轮询任务

bash
export TASK_ID="task_veo_example"

while true; do
  TASK=$(curl -sS \
    "$SUPERTOKEN_BASE_URL/v1/video/tasks/$TASK_ID" \
    -H "Authorization: Bearer $RESOURCE_API_KEY")

  STATUS=$(printf '%s' "$TASK" | jq -r '.status')
  printf '%s\n' "$TASK" | jq '{id, status, progress, error}'

  case "$STATUS" in
    succeeded|failed) break ;;
  esac

  sleep 2
done

状态为 failed 时读取 error.codeerror.messageerror.retryable。参数类 400 不会创建任务,不应进入轮询。

结果与下载

成功的 Veo 任务会在 result.videos[] 中返回结果 URL:

json
{
  "id": "task_veo_example",
  "object": "video.task",
  "model": "adobe-veo-3.1-fast-720p",
  "operation": "generation",
  "status": "succeeded",
  "progress": 100,
  "result": {
    "videos": [
      {
        "asset_id": "asset_veo_example",
        "index": 0,
        "url": "https://media.example.com/results/video.mp4?token=...",
        "mime_type": "video/mp4",
        "duration_ms": 4000,
        "temporary": true,
        "url_auth": "none"
      }
    ]
  },
  "error": null,
  "created_at": 1785373200,
  "started_at": 1785373202,
  "completed_at": 1785373268,
  "updated_at": 1785373268
}

浏览器可以直接把 url 用作 <video src="...">。下载时不要附加 SuperToken Key:

bash
VIDEO_URL=$(printf '%s' "$TASK" | jq -r '.result.videos[0].url')
curl -L "$VIDEO_URL" --output veo-result.mp4

完整签名 URL 可能过期,也可能包含敏感查询参数。不要把它写入普通访问日志;需要长期保存时请及时转存。

当前 duration_ms 回显已验证的请求时长,不表示 SuperToken 下载结果媒体重新探测了真实时长,也不会触发二次计费。

若返回 url_auth: "resource_api_key",访问该 URL 时应携带资源 API Key。客户端不要根据模型名猜鉴权方式。

列表与批量查询

bash
curl -sS \
  "$SUPERTOKEN_BASE_URL/v1/video/tasks?status=succeeded&operation=generation&limit=20" \
  -H "Authorization: Bearer $RESOURCE_API_KEY" |
jq .
bash
curl -sS "$SUPERTOKEN_BASE_URL/v1/video/tasks/query" \
  -H "Authorization: Bearer $RESOURCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task_ids": [
      "task_veo_example",
      "task_another_example"
    ]
  }' |
jq .

Webhook

账号启用视频 Webhook后,任务成功或失败会发送 video.task.succeededvideo.task.failed。Webhook 的 data.object 与任务查询响应一致。

下一步

SuperToken - 让全球顶级 AI 模型触手可达