图生视频
Veo 3.1 的 image_to_video:从首帧开始生成带声音的视频,lite 还可以加上尾帧。
Veo 3.1 从 image_urls 的第 1 张图开始生成,prompt 描述接下来发生什么。选 lite 版本时还可以加上尾帧。
variant | image_urls | aspect_ratio | duration |
|---|---|---|---|
standard、fast | 1 张:首帧 | 16:9 或 9:16 | 4、6 或 8 |
lite | 1–2 张:首帧,可以再加 1 张尾帧 | 16:9、9:16 或 auto(跟随首帧) | 4、6 或 8;带尾帧时只能是 8 |
aspect_ratio 请和首帧的方向一致:横图选 16:9,竖图选 9:16(lite 也可以选 auto)。
创建任务
POST
https://api.nanoapi.ai/v1/tasks用所有模型共用的创建任务接口,model 传 "veo-3.1"。
请求头
| 请求头 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <API Key>,见鉴权 |
Content-Type | 是 | application/json |
Idempotency-Key | 否 | 每个新任务一个唯一字符串,建议用 UUID(1–255 个字符),见防止重复创建 |
请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | veo-3.1 |
variant | string | 是 | standard、fast 或 lite,见版本,决定价格 |
mode | string | 是 | image_to_video |
image_urls | string[] | 是 | 首帧;lite 可以再传第 2 张作为尾帧(见上表)。见素材 |
prompt | string | 是 | 描述视频里发生什么,最长 8000 字符,建议用英文 |
resolution | string | 是 | standard、fast:720p、1080p 或 4k;lite:720p。决定价格 |
aspect_ratio | string | 是 | 16:9 或 9:16;lite 还可以传 auto,跟随首帧 |
duration | integer | 是 | 输出时长(秒):4、6 或 8(lite 带尾帧时必须为 8),按此计费,见价格 |
generate_audio | boolean | 否 | 仅 lite 可传:输出视频是否带声音,默认 true,不影响价格。standard、fast 始终带声音,传入时返回 400 invalid_request |
webhook_url | string | 否 | 任务成功或失败时通知该地址:https,最长 2048 字符,不能指向内网、回环或保留地址。见回调 |
fast、只有首帧、1080p、4 秒:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3.1",
"variant": "fast",
"mode": "image_to_video",
"image_urls": ["https://example.com/first_frame.jpg"],
"prompt": "The cat slowly turns its head, looks at the camera and meows, the camera slowly pushes in",
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 4
}'lite 首尾帧(因此 duration 为 8),比例跟随首帧:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3.1",
"variant": "lite",
"mode": "image_to_video",
"image_urls": [
"https://example.com/first_frame.jpg",
"https://example.com/last_frame.jpg"
],
"prompt": "The camera slowly orbits around the cat sitting on the car hood",
"resolution": "720p",
"aspect_ratio": "auto",
"duration": 8
}'响应:200 OK,返回新建的任务(字段说明)。保存 data.id,用它获取结果;任务创建后仍可能失败,见错误。
{
"code": 200,
"message": "success",
"data": {
"object": "task",
"id": "tk_01jbq3v6n9c2x5b8m1q4w7e0r3",
"model": "veo-3.1",
"status": "queued",
"error": null,
"created_at": "2026-11-11T08:30:00Z"
}
}价格
费用 = 输出时长 duration × 所选版本和分辨率的每秒单价正在读取当前价格…
计费秒数即请求的 duration,图片、输出视频是否带声音(generate_audio)都不影响价格。当前单价见 GET /v1/products(prices 里这个 variant 的行),以任务的 billing.frozen 为准;冻结和扣费规则见计费。所有版本的价格见 Veo 3.1 → 价格。
错误
见 Veo 3.1 → 错误。本模式的参数规则见上面的参数表。