跳到导航

Gemini Omni 1.1 Flash

用文字、首帧、首尾帧,或最多 10 张参考图加 3 段参考视频,生成 3~10 秒、720p、1080p 或 4K 的有声视频。

  • 异步:创建调用返回任务 ID,任务成功后即可获得视频。
  • 一个模型 ID 四种输入:纯文字、一张首帧、images 中的首帧和尾帧,或最多 10 张 reference_images 加最多 3 段可选的 reference_videos。帧和参考不能同时使用。
  • 片段长度 3 到 10 秒,画幅 16:9 或 9:16;duration 为整数秒。
  • 每个视频都自带声音。没有关闭声音的开关,也不接受参考音频。
  • 按所选分辨率和请求的秒数计费。失败的任务不收费。
POST/v1/videos/tasks试一试

在调试窗口里打开本模型,填入你的 BeatAPI API 密钥即可创建任务。调用是真实的,费用从你自己的余额中扣除。

接口与鉴权

POST https://api.beatapi.io/v1/videos/tasks

Authorization string 必需

你的 BeatAPI API 密钥,以 Bearer <BEATAPI_API_KEY> 形式发送。在控制台创建密钥。密钥只能保存在你的服务端,不要放进浏览器或移动端应用。

请求体使用 JSON,并设置 Content-Type: application/json。Idempotency-Key 为可选:每个逻辑请求发送一个唯一值(最长 255 个字符),仅在重试完全相同的请求体时复用。24 小时内,用相同的键和请求体重试会再次返回第一次的响应,并带上 Idempotent-Replayed: true;相同的键搭配不同的请求体则返回 409 idempotency_conflict。非 2xx 的响应不会被保存,因此 400 或 402 之后的重试会重新执行。

请求流程

1

创建任务

向接口 POST 下方的参数。返回 201 表示任务已被接受,其价格已从你的余额中预留;任务在后台运行。保存 data.id。

2

等待任务完成

调用 GET /v1/tasks/{task_id},两次调用之间等待 data.poll_after_seconds 秒(图片 5 秒,视频 8 秒),直到 status 为 succeeded 或 failed。也可以为 task.succeeded 和 task.failed 注册 Webhook;仍需保留轮询作为兜底,因为因处理超时而终止的任务不会发送事件。

3

保存结果

状态为 succeeded 时,下载每个 data.output.media[].url 并保存你需要的文件;BeatAPI 不承诺结果链接的保留时长。状态为 failed 时,读取 data.error_code 和 data.error_message:预扣的金额已退回你的余额,data.retryable 表示再次发送相同请求是否可能成功。

输入模式

模式必填输入说明
文生视频model、prompt不要发送 images、reference_images 和 reference_videos。
首帧model、prompt、images(1 个链接)视频从这张图开始。
首尾帧model、prompt、images(2 个链接)第一个链接是开头画面,第二个是结尾画面,顺序不能颠倒。
参考图和参考视频model、prompt、reference_images(1 到 10 个链接)可再加最多 3 段 reference_videos;发送参考视频时至少要有一张参考图。不能与 images 同时使用。

请求参数

model string 必需

要运行的模型。

取值:gemini-omni-1.1-flash

取值有误时

  • 缺失:"model" is required
  • 向此端点发送了图片模型:"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint

prompt string 必需

视频中发生的内容:动作、镜头、场景,以及想要的台词或声音。

长度:1–5000 个字符

  • 长度按字符计算(一个中日韩文字算一个字符)。
  • 使用参考素材时,在提示词里说明每份参考要取什么,例如“第一张参考图里的女生”或“参考视频的运镜”。

取值有误时

  • 缺失:"prompt" is required
  • 为空或超出长度上限:"prompt" has an unsupported length
  • 不是字符串:"prompt" must be a string

images string[] 可选

画面帧:一个链接是首帧,两个链接依次是首帧和尾帧。可选:文生视频或发送参考素材时不要传。

数量:1–2
每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是公开的 https:// URL。
  • 只想让视频参考、而不是从它开始或以它结束的图片,请放进 reference_images。

取值有误时

  • 超过 2 个链接:"images" accepts at most 2 items
  • 空数组:"images" requires at least 1 item
  • 不是数组:"images" must be an array
  • 不是 https:// 链接:"images[0]" must be a public HTTPS URL
  • 与 reference_images 或 reference_videos 同时发送:Cannot combine "images" with reference inputs in one task

reference_images string[] 可选

视频要用到的 1 到 10 张人物、产品、风格或场景图片。

数量:1–10
每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是公开的 https:// URL。
  • 发送 reference_videos 时必须同时发送。

取值有误时

  • 超过 10 个链接:"reference_images" accepts at most 10 items
  • 空数组:"reference_images" requires at least 1 item
  • 不是数组:"reference_images" must be an array
  • 与 images 同时发送:Cannot combine "images" with reference inputs in one task

reference_videos string[] 可选

1 到 3 段视频,新视频参照其中的动作、运镜或主体。

数量:1–3
每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是指向 MP4、MOV 或 WebM 文件的公开 https:// URL。
  • 只能和至少一个 reference_images 链接一起发送。
  • 参考视频不影响价格:只按新视频的秒数计费。

取值有误时

  • 没有同时发送 reference_images:Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"
  • 超过 3 个链接:"reference_videos" accepts at most 3 items
  • 与 images 同时发送:Cannot combine "images" with reference inputs in one task

duration integer 可选默认值: 5

视频长度,单位为秒,须为整数。

默认值:5
范围:3–10

  • 省略时使用 5 并按其计费。
  • 按秒计费(见“计费”),因此这是影响价格的主要因素。

取值有误时

  • 超出 3~10、不是整数,或以字符串发送:"duration" is outside its supported range

aspect_ratio string 可选默认值: 16:9

视频画幅:横屏 16:9 或竖屏 9:16。

可选值:16:9, 9:16
默认值:16:9

  • 省略时使用 16:9。
  • 发送画面帧时同样生效:请选择与首帧一致的画幅。

取值有误时

  • 不在列表中的取值:"aspect_ratio" must be one of: [16:9 9:16]

resolution string 可选默认值: 720p

输出分辨率。每升一档,每秒单价更高。

可选值:720p, 1080p, 4k
默认值:720p

  • 省略时使用 720p。
  • 4k 和 4K 是同一档。

取值有误时

  • 不在列表中的取值(例如 480p 或 720P):"resolution" must be one of: [720p 1080p 4k 4K]

网关还会在创建任务之前检查以下组合:

  • images 不能与参考素材字段同时使用。
  • images 是画面帧:一张为首帧,两张依次为首帧和尾帧。
  • 发送 reference_videos 时,reference_images 至少要有一张图片。
  • 没有声音开关;不接受参考音频。

输入素材限制

网关会在创建任务之前读取每一项输入,超出这些限制的输入会被拒绝,并返回点名该输入的 400 bad_request。不扣费。

素材创建任务前检查的限制
图片每个不超过 20 MB
视频每个不超过 64 MB
  • 创建任务前,网关会检查每个链接文件的大小。超出上限的文件会以 400 拒绝并指明是哪一个,例如 images[0] is 25.0 MB; this model takes images up to 20 MB.,不会扣费。
  • 链接所在主机返回 4xx 错误或文件为空时,同样会被拒绝:<field>[<n>] could not be downloaded: <reason>.
  • 任务创建后模型无法使用某个链接时,任务会失败,通常为 bad_request,并全额退款。
  • 只有本地文件?先用 POST /v1/files 上传,再传入返回的 data.url。

此模型不接受的字段

发送以下字段会在扣费前被拒绝,而不是被忽略:

  • reference_audios、generate_audio、seed、quality、sound、task_type、output_format、watermark 以及其他视频模型的字段 → field "generate_audio" is not supported by model gemini-omni-1.1-flash(字段名为你发送的那个)。声音每次都会生成,没有可切换的开关。
  • 视频端点完全不认识的字段 → unknown field: <name>。

请求示例

curl --request POST \
--url https://api.beatapi.io/v1/videos/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash",
"prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
"duration": 5,
"aspect_ratio": "16:9",
"resolution": "720p"
}'

文生视频

只用文字生成 5 秒、720p 的横屏片段。

curl --request POST \
--url https://api.beatapi.io/v1/videos/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash",
"prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
"duration": 5,
"aspect_ratio": "16:9",
"resolution": "720p"
}'

首帧

从一张图开始,生成 5 秒、720p 的片段。

curl --request POST \
--url https://api.beatapi.io/v1/videos/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash",
"prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
"images": [
"https://cdn.beatapi.io/samples/neon-singer.png"
],
"duration": 5,
"resolution": "720p"
}'

首尾帧

从第一张图过渡到第二张图,生成 8 秒、1080p 的片段。

curl --request POST \
--url https://api.beatapi.io/v1/videos/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash",
"prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
"images": [
"https://cdn.beatapi.io/samples/neon-singer.png",
"https://cdn.beatapi.io/samples/smart-bottle.png"
],
"duration": 8,
"aspect_ratio": "16:9",
"resolution": "1080p"
}'

参考图和一段参考视频

两张参考图加一段参考视频,生成 8 秒、720p 的竖屏片段。

curl --request POST \
--url https://api.beatapi.io/v1/videos/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash",
"prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
"reference_images": [
"https://cdn.beatapi.io/samples/neon-singer.png",
"https://cdn.beatapi.io/samples/smart-bottle.png"
],
"reference_videos": [
"https://your-cdn.example.com/clips/source.mp4"
],
"duration": 8,
"aspect_ratio": "9:16",
"resolution": "720p"
}'

响应

创建任务(201)

任务对象。任务成功之前 output 为 null。标注“运行中”的字段会在任务结束后消失。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "video",
"capability_id": "gemini-omni-1.1-flash",
"capability_version": 1,
"media_type": "video",
"model": "gemini-omni-1.1-flash",
"status": "queued",
"stage": "queued",
"created_at": 1791993600,
"updated_at": 1791993600,
"completed_at": null,
"poll_after_seconds": 8,
"output": null,
"usage": {
"credits_reserved": 0.3,
"credits_settled": 0,
"credits_refunded": 0,
"credits_charged": 0.3,
"billable_duration_seconds": 5
},
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": null,
"error_message": null
}
}
字段类型说明
data.idstring任务 ID:task_ 后接 32 位字母和数字。用于轮询以及匹配 Webhook 事件。
data.objectstring固定为 task。
data.task_kindstringimage 或 video。
data.capability_idstring你发送的模型 ID。
data.capability_versioninteger模型的契约版本,当前为 1。
data.media_typestringimage 或 video。
data.modelstring你发送的模型 ID(与 capability_id 相同)。
data.statusstringqueued、processing、succeeded 或 failed。只有后两个是终态。
data.stagestring与 status 相同;为旧版客户端保留。
data.created_atinteger任务创建时间,Unix 秒。
data.updated_atinteger最后一次变更时间,Unix 秒。
data.completed_atinteger | null任务结束时间,Unix 秒;运行中为 null。
data.poll_after_secondsinteger运行中:下一次轮询前需要等待的秒数(图片 5,视频 8)。
data.typical_secondsobject运行中且近期样本足够时出现:在最近的 window 内,根据 samples 个任务统计的完成时间 p50 和 p90,单位为秒。
data.outputobject | null任务结果;status 为 succeeded 之前为 null。见下方输出字段。
data.usage.credits_reservednumber创建任务时从你的余额中预扣的美元金额。
data.usage.credits_chargednumber该任务的费用(美元);失败的任务为 0。
data.usage.credits_settlednumber最终结算扣除的美元金额;任务成功时设置,否则为 0。
data.usage.credits_refundednumber退回你余额的美元金额;失败的任务在退款记录完成后等于预扣金额。
data.usage.billable_duration_secondsinteger仅视频:计价所依据的秒数。模型未上报时长时不出现。
data.request_idstring请求 ID。联系支持时请附上。
data.error_codestring | null失败码;任务未失败时为 null。
data.error_messagestring | null出了什么问题以及该改什么;任务未失败时为 null。

任务完成

GET /v1/tasks/{task_id} 返回 HTTP 200 和 status: "succeeded",结果在 data.output 中。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "video",
"capability_id": "gemini-omni-1.1-flash",
"capability_version": 1,
"media_type": "video",
"model": "gemini-omni-1.1-flash",
"status": "succeeded",
"stage": "succeeded",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": {
"media": [
{
"type": "video",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.mp4",
"mime_type": "video/mp4"
}
],
"r2_url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.mp4"
},
"usage": {
"credits_reserved": 0.3,
"credits_settled": 0.3,
"credits_refunded": 0,
"credits_charged": 0.3,
"billable_duration_seconds": 5
},
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": null,
"error_message": null
}
}

输出字段

字段类型说明
output.mediaobject[]生成的文件;此模型为一个带声音的视频。
output.media[].typestring固定为 video。
output.media[].urlstring已存储视频的 HTTPS 链接。请下载并自行保存;不承诺保留期限。
output.media[].mime_typestringvideo/mp4。
output.r2_urlstring同一个视频 URL,供旧客户端使用。请改读 media。

任务失败

失败的任务在 GET /v1/tasks/{task_id} 上仍然是 HTTP 200:失败信息在响应体里。预扣金额会全额退回,因此不会扣费。

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "video",
"capability_id": "gemini-omni-1.1-flash",
"capability_version": 1,
"media_type": "video",
"model": "gemini-omni-1.1-flash",
"status": "failed",
"stage": "failed",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": null,
"usage": {
"credits_reserved": 0.3,
"credits_settled": 0,
"credits_refunded": 0.3,
"credits_charged": 0,
"billable_duration_seconds": 5
},
"retryable": true,
"request_id": "req_5f0c2a9e4b7d4e31",
"error_code": "processing_failed",
"error_message": "The task failed during processing on our side. Retry; a failed task is refunded."
}
}
字段类型说明
data.error_codestringbad_request 和 content_policy_violation(需修改请求)之一,或 processing_unavailable、processing_timeout、processing_failed 和 result_transfer_failed(稍后重试)之一。见错误码。
data.error_messagestring一句话,指出问题和处理方式。
data.retryableboolean仅在任务失败时出现:为 true 表示再次发送相同请求可能成功。
data.usageobject退款记录完成后(通常就在任务失败的那一刻):credits_charged 和 credits_settled 为 0;credits_refunded 等于 credits_reserved。

完整示例

创建任务,按服务端给出的轮询提示等待,然后打印结果链接。请在环境变量中设置 BEATAPI_API_KEY 并安装 requests。

import os
import time
import uuid
import requests
API = "https://api.beatapi.io"
HEADERS = {"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"}
def create_task(body: dict) -> dict:
# One Idempotency-Key per logical request: a retry with the same key cannot create a second task.
headers = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
for attempt in range(3):
response = requests.post(f"{API}/v1/videos/tasks", headers=headers, json=body, timeout=60)
if response.status_code in (429, 503) and attempt < 2:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
break
try:
payload = response.json()
except ValueError: # an edge error page is not JSON
response.raise_for_status()
raise
if not response.ok:
error = payload["error"]
raise RuntimeError(f"{response.status_code} {error['code']}: {error['message']} (request_id={error.get('request_id')})")
return payload["data"]
def wait_for_task(task_id: str, timeout_seconds: int = 1800) -> dict:
deadline = time.monotonic() + timeout_seconds
while time.monotonic() < deadline:
response = requests.get(f"{API}/v1/tasks/{task_id}", headers=HEADERS, timeout=30)
if response.status_code == 429 or response.status_code >= 500:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
response.raise_for_status()
task = response.json()["data"]
if task["status"] in ("succeeded", "failed"):
return task
time.sleep(task.get("poll_after_seconds", 5))
raise TimeoutError(f"task {task_id} is still running; keep polling later")
task = create_task({
"model": "gemini-omni-1.1-flash",
"prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
"duration": 5,
"aspect_ratio": "16:9",
"resolution": "720p"
})
print("created", task["id"])
task = wait_for_task(task["id"])
if task["status"] == "failed":
raise SystemExit(f"{task['error_code']}: {task['error_message']}")
for item in task["output"]["media"]:
print(item["url"])

计费

  • 价格由分辨率和请求的秒数(duration,省略时为 5)决定。1080p 每秒单价高于 720p,4K 又高于 1080p。输入方式、aspect_ratio 以及帧或参考素材的数量不影响价格。
  • 下表为 8 秒片段的价格;其他长度按同一分辨率的每秒单价计算。
  • 价格在创建任务时预留;data.usage.billable_duration_seconds 显示计费所依据的秒数。
  • 失败的任务(包括提交后被内容审核拒绝的任务)全额退款。

当前牌价,与价格页一致。享有协商折扣的账户实付更低;任务的 data.usage 始终显示实际扣费金额。

选项牌价(美元)
8 秒 · 720p$0.48
8 秒 · 1080p$0.72
8 秒 · 4K$1.44

常见错误

错误或现象原因处理方式
400 Cannot combine "images" with reference inputs in one task同一请求里既有 images 中的帧,又有 reference_images 或 reference_videos 中的参考素材。帧放在 images,或者只发参考素材,二选一。
400 Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"发送了参考视频,但没有任何参考图。在 reference_images 中至少加入一个链接。
400 "images" accepts at most 2 items帧超过两张。只发首帧,或首帧加尾帧;其他图片放进 reference_images。
400 "reference_images" accepts at most 10 items参考图超过 10 张。最多发送 10 张。
400 "duration" is outside its supported range小于 3、大于 10、是小数,或是字符串。发送 3 到 10 之间的整数,例如 8。
400 "resolution" must be one of: [720p 1080p 4k 4K]480p,或 720P 这样的大写写法。发送 720p、1080p 或 4k。
400 "aspect_ratio" must be one of: [16:9 9:16]1:1、21:9 或其他此模型不提供的比例。发送 16:9 或 9:16。
400 field "reference_audios" is not supported by model gemini-omni-1.1-flash参考音频、generate_audio 以及其他视频模型的字段都会被拒绝。删除该字段。每个视频都会自动生成声音。
任务 failed,错误为 bad_request模型无法获取或使用某个链接(私有或已过期的链接、类型不对的文件)。使用指向真实图片或视频的公开 HTTPS 链接,或用 POST /v1/files 上传。失败的任务已退款。
任务 failed,错误为 content_policy_violation提示词、输入素材或生成结果被内容审核拒绝。修改提示词或输入素材。原样重试仍会失败;不会扣费。
402 insufficient_credits余额低于该请求预留的价格;4K 长片段最贵。充值、缩短 duration,或使用更低的 resolution。

HTTP 错误速查

任务生成之前的错误会以非 2xx 响应返回,不扣费。请根据 error.code 或 error.retryable 判断处理方式;message 会指出问题所在。完整列表和重试策略见错误码。

{
"error": {
"code": "bad_request",
"message": "\"prompt\" is required",
"retryable": false,
"request_id": "req_5f0c2a9e4b7d4e31"
}
}
HTTP 状态码error.code处理方式
400bad_request, content_policy_violation修改请求;message 会点名出错的字段。不要原样重试。
401missing_api_key, invalid_api_key(旧版客户端可能看到 unauthorized)以 Authorization: Bearer <key> 发送有效的密钥。
402insufficient_credits充值,或提高密钥的额度,然后重新发送。
403forbidden该密钥或账户不能使用此模型(例如免费额度只覆盖部分模型)。不要原样重试。
404not_found在 GET /v1/tasks/{task_id} 上:该任务在此密钥所属账户下不存在。请检查 ID。
409idempotency_conflict换一个新的 Idempotency-Key,或等待使用该键的第一个请求完成。
429rate_limit_exceeded等待 Retry-After 秒(也见 error.retry_after_seconds)后重试。
500internal_error退避重试;若持续出现,请带上 request_id 联系支持。
503processing_unavailable, processing_timeout, processing_failed, result_transfer_failed未扣费。使用指数退避重试。

身份验证

AuthorizationBearer

通过 Authorization: Bearer <BEATAPI_API_KEY> 发送 API 密钥。

请求头

Idempotency-Keystring可选<=255 characters

请求体使用 JSON,并设置 Content-Type: application/json。Idempotency-Key 为可选:每个逻辑请求发送一个唯一值(最长 255 个字符),仅在重试完全相同的请求体时复用。24 小时内,用相同的键和请求体重试会再次返回第一次的响应,并带上 Idempotent-Replayed: true;相同的键搭配不同的请求体则返回 409 idempotency_conflict。非 2xx 的响应不会被保存,因此 400 或 402 之后的重试会重新执行。

请求

This endpoint expects an object.
modelenum必需

要运行的模型。

取值:gemini-omni-1.1-flash

取值有误时

  • 缺失:"model" is required
  • 向此端点发送了图片模型:"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint
允许的值:
promptstring必需1-5000 characters

视频中发生的内容:动作、镜头、场景,以及想要的台词或声音。

长度:1–5000 个字符

  • 长度按字符计算(一个中日韩文字算一个字符)。
  • 使用参考素材时,在提示词里说明每份参考要取什么,例如“第一张参考图里的女生”或“参考视频的运镜”。

取值有误时

  • 缺失:"prompt" is required
  • 为空或超出长度上限:"prompt" has an unsupported length
  • 不是字符串:"prompt" must be a string
aspect_ratioenum可选默认为 16:9

视频画幅:横屏 16:9 或竖屏 9:16。

可选值:16:9, 9:16

默认值:16:9

  • 省略时使用 16:9。
  • 发送画面帧时同样生效:请选择与首帧一致的画幅。

取值有误时

  • 不在列表中的取值:"aspect_ratio" must be one of: [16:9 9:16]
允许的值:
durationinteger可选3-10默认为 5

视频长度,单位为秒,须为整数。

默认值:5

范围:3–10

  • 省略时使用 5 并按其计费。
  • 按秒计费(见“计费”),因此这是影响价格的主要因素。

取值有误时

  • 超出 3~10、不是整数,或以字符串发送:"duration" is outside its supported range
imageslist of strings可选

画面帧:一个链接是首帧,两个链接依次是首帧和尾帧。可选:文生视频或发送参考素材时不要传。

数量:1–2

每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是公开的 https:// URL。
  • 只想让视频参考、而不是从它开始或以它结束的图片,请放进 reference_images。

取值有误时

  • 超过 2 个链接:"images" accepts at most 2 items
  • 空数组:"images" requires at least 1 item
  • 不是数组:"images" must be an array
  • 不是 https:// 链接:"images[0]" must be a public HTTPS URL
  • 与 reference_images 或 reference_videos 同时发送:Cannot combine "images" with reference inputs in one task
reference_imageslist of strings可选

视频要用到的 1 到 10 张人物、产品、风格或场景图片。

数量:1–10

每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是公开的 https:// URL。
  • 发送 reference_videos 时必须同时发送。

取值有误时

  • 超过 10 个链接:"reference_images" accepts at most 10 items
  • 空数组:"reference_images" requires at least 1 item
  • 不是数组:"reference_images" must be an array
  • 与 images 同时发送:Cannot combine "images" with reference inputs in one task
reference_videoslist of strings可选

1 到 3 段视频,新视频参照其中的动作、运镜或主体。

数量:1–3

每一项都必须是公网 https:// 链接。本地文件请先上传(POST /v1/files),再传入返回的 data.url。

  • 每个链接必须是指向 MP4、MOV 或 WebM 文件的公开 https:// URL。
  • 只能和至少一个 reference_images 链接一起发送。
  • 参考视频不影响价格:只按新视频的秒数计费。

取值有误时

  • 没有同时发送 reference_images:Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"
  • 超过 3 个链接:"reference_videos" accepts at most 3 items
  • 与 images 同时发送:Cannot combine "images" with reference inputs in one task
resolutionenum可选默认为 720p

输出分辨率。每升一档,每秒单价更高。

可选值:720p, 1080p, 4k

默认值:720p

  • 省略时使用 720p。
  • 4k 和 4K 是同一档。

取值有误时

  • 不在列表中的取值(例如 480p 或 720P):"resolution" must be one of: [720p 1080p 4k 4K]
允许的值:

响应

任务对象。任务成功之前 output 为 null。标注“运行中”的字段会在任务结束后消失。

错误

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error