视频

视频生成

使用 Seedance, Kling, Omni, Wan, Grok, Veo, Vidu, PixVerse 和 MiniMax,根据提示词、首帧(也可同时提供尾帧)或参考图片, 视频和音频生成视频。生成需要几分钟,先提交任务,再查询结果。

POST/v1/videos
模型ID每秒价格起价声音时长
Seedance 2.5seedance-2.5480p $0.135 · 720p $0.305 · 1080p $0.75提示词、首尾帧或最多 9 张参考图默认开启,免费4 至 30 s
Seedance 2.0seedance-2.0480p $0.097 · 720p $0.199 · 1080p $0.445 · 4K $0.99提示词、首尾帧或最多 9 张参考图默认开启,免费4 至 15 s
Seedance 2.0 Fastseedance-2.0-fast480p $0.074 · 720p $0.159提示词、首尾帧或最多 9 张参考图默认开启,免费4 至 15 s
Kling 4.0kling-4.0720p $0.15 · 1080p $0.225提示词、首尾帧或最多 10 张参考图始终开启3 至 30 s
Seedance 2.0 Miniseedance-2.0-mini480p $0.047 · 720p $0.10提示词、首尾帧或最多 9 张参考图默认开启,免费4 至 15 s
Gemini Omni Flashgemini-omni-flash360p $0.042 · 720p $0.042 · 1080p $0.042 · 4K $0.07提示词、首尾帧或最多 10 张参考图始终开启4 至 10 s
Kling 3.0kling-3.0720p $0.185 (silent $0.125) · 1080p $0.235 (silent $0.18)提示词或首尾帧默认开启;无声更便宜3 至 15 s
Wan 3.0wan-3.0480p $0.039 · 720p $0.079 · 1080p $0.158提示词、首尾帧或最多 10 张参考图默认开启,免费2 至 30 s
Grok Imagine Video 1.5grok-imagine-video-1.5480p $0.071 · 720p $0.124提示词、首帧或最多 3 张参考图默认开启,免费1 至 15 s
Veo 3.1 Fastveo-3.1-fast720p $0.20 per 8 s 视频提示词或首帧始终开启8 s
Vidu Q3 Turbovidu-q3-turbo540p $0.03 · 720p $0.047 · 1080p $0.057提示词或首尾帧默认开启,免费1 至 16 s
PixVerse V6pixverse-v6360p $0.027 (silent $0.019) · 540p $0.035 (silent $0.027) · 720p $0.047 (silent $0.035) · 1080p $0.09 (silent $0.07)提示词或首尾帧默认开启;无声更便宜1 至 15 s
MiniMax H3minimax-h3768p $0.039 · 2K $0.064提示词和最多 9 张参考图, 3 videos and 3 audio clips始终开启4 至 15 s

提交、轮询、下载

import os, time, requests
API = "https://api.zurelay.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['ZURELAY_API_KEY']}"}
# 1. Start the video
response = requests.post(f"{API}/videos", headers=HEADERS, json={
"model": "seedance-2.0",
"prompt": "A paper boat drifting down a rain-soaked street at night, neon reflections, slow dolly shot",
"seconds": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
})
response.raise_for_status() # a 4xx says what to fix
job = response.json()
# 2. Poll until it's done (usually 2 to 6 minutes)
while job["status"] in ("queued", "in_progress"):
time.sleep(10)
job = requests.get(f"{API}/videos/{job['id']}", headers=HEADERS).json()
if job["status"] == "failed":
raise SystemExit(job["error"]["message"])
# 3. Download the MP4
video = requests.get(f"{API}/videos/{job['id']}/content", headers=HEADERS)
open("boat.mp4", "wb").write(video.content)

所有视频模型的调用方式都一样:只需更改 model,请求的其余部分无需修改。各模型指南介绍了它们各自的优势:Seedance、Kling、Wan、Grok Imagine、Omni Flash、MiniMax H3、Veo、Vidu 和 PixVerse。

不想轮询?添加 callback_url,视频生成完成后就会立即通过 POST 发送到你的服务器,并附带签名。参见回调。

参数

modelstring必填
视频模型 ID。
promptstring
描述视频内容,最多 8,000 个字符 (Kling 最多读取 2,500, Vidu reads up to 2,000, PixVerse reads up to 2,048, MiniMax reads up to 7,000)。未提供首帧或参考图片时必填。
negative_promptstring
描述视频中不要出现的内容,最多 2,500 个字符。Kling and PixVerse 支持此参数,其他模型会拒绝此参数。
secondsinteger
时长,单位为整秒,须在模型支持的范围内(见表格)。默认为 5,或模型支持的最接近时长。
resolutionstring
例如 480p、720p、1080p、2k 或 4k:各模型支持的值见表格。默认为 720p,或模型支持的最低分辨率。
aspect_ratiostring
16:9、9:16、1:1、4:3、3:4、21:9 或 adaptive(沿用首帧的宽高比;提供首帧时默认使用此值)。否则默认为 16:9. Kling makes 16:9, 9:16, 1:1 和 21:9; Omni and Veo make 16:9 and 9:16; Kling makes 16:9, 9:16 and 1:1; Grok, Vidu and PixVerse make 16:9, 9:16, 1:1, 4:3 and 3:4.
sizestring
用像素尺寸代替分辨率和宽高比,例如 1280x720。
generate_audioboolean
随视频一起生成声音和语音。默认为 true。(也支持 audio。) Kling and PixVerse cost 在不生成声音时费用更低。
seedinteger
相同的 seed 和设置会生成相似的结果. Kling, Grok and Veo have no seed and ignore it.
first_framestring
视频的首帧图片:链接或 data URL. MiniMax takes none: give the image in reference_images.
last_framestring
视频的尾帧图片。须同时提供首帧. Seedance, Kling, Omni, Wan, Vidu and PixVerse take one.
reference_imagesarray
用于参考角色、产品、场景或风格的图片:Seedance up to 9, Kling up to 10, Omni up to 10, Wan up to 10, Grok up to 3, MiniMax up to 9; Veo, Vidu and PixVerse take none。不能与首尾帧同时使用。
reference_videosarray
用于参考画面风格、动作或运镜的视频,或要编辑、续接的视频:支持 MP4 或 MOV,以链接或 data URL 提供,并在提示词中用 @Video1、@Video2 等引用。仅 Seedance 2.5, Seedance 2.0, Gemini Omni Flash 和 MiniMax H3 支持。参考视频每秒按标准每秒价格的一定比例计费,部分模型不收费;参见参考视频和音频。
reference_audioarray
要使用的人声、音乐或音效: MP3 或 WAV 格式,以链接或 data URL 提供,用 @Audio1 等标记引用。仅限 Seedance 2.5, Seedance 2.0 和 MiniMax H3, 不额外收费。
reference_modestring
使用参考视频时:对某个视频执行 edit 或 extend, 或根据参考素材生成新视频 (reference)。默认值为 auto: 模型根据提示词决定。仅限 Seedance 2.5。
callback_urlstring
用于接收视频生成完成或失败通知的 https URL, 无需轮询。参见 回调。

从图像开始

首帧和尾帧

让静态图像动起来:视频以 first_frame 作为首帧。添加 last_frame 后,视频会以该图像作为尾帧,让你控制镜头的起点和终点. MiniMax starts 则根据参考图像生成。

请求体
{
"model": "seedance-2.0",
"first_frame": "https://example.com/storefront-day.jpg",
"last_frame": "https://example.com/storefront-night.jpg",
"prompt": "Time passes from afternoon to night; lights come on inside the shop.",
"seconds": 6,
"resolution": "720p"
}

参考图

最多提供 10 张图像 (Seedance up to 9, Kling up to 10, Omni up to 10, Wan up to 10, Grok up to 3, MiniMax up to 9; Veo, Vidu 和 PixVerse take none),并在提示词中按顺序引用 (@Image1, @Image2…): 图中的人物、产品和场景会出现在视频中。

请求体
{
"model": "seedance-2.5",
"reference_images": [
"https://example.com/chef.jpg",
"https://example.com/kitchen.jpg",
"https://example.com/dish.jpg"
],
"prompt": "The chef from @Image1 plates the dish from @Image3 in the kitchen from @Image2, close-up, warm light.",
"seconds": 8,
"resolution": "720p",
"aspect_ratio": "9:16"
}

参考视频和音频

提供视频以参考人物外观和动作、运镜或场景,提供音频以参考人声、旋律或音效。与图像一样,在提示词中按顺序引用: @Video1, @Audio1。可与参考图像混用,但不能与首帧图像同时使用。

请求体
{
"model": "seedance-2.5",
"reference_images": ["https://example.com/singer.jpg"],
"reference_videos": ["https://example.com/dance-moves.mp4"],
"reference_audio": ["https://example.com/chorus.mp3"],
"prompt": "The singer from @Image1 performs the dance from @Video1 on a rooftop at dusk, singing to @Audio1.",
"seconds": 8,
"resolution": "720p"
}
模型参考视频参考音频参考视频每秒费用
Seedance 2.5最多 10, 30 s in all 个最多 10, 30 s in all 个480p $0.081, 720p $0.183
Seedance 2.0最多 3, 15 s in all 个最多 3, 15 s in all, with an image or video 个480p $0.0582, 720p $0.1194
Gemini Omni Flash最多 3, 10 s each 个无免费
MiniMax H3最多 3, 15 s each 个最多 3, 15 s in all 个免费

模型会读取参考视频的每一秒,因此参考时长也会计费,单价为生成视频每秒价格的一部分:生成 5 s 视频并使用 10 s 参考视频时,费用包含 5 秒生成时长和 10 秒参考时长。参考音频不额外收费。每个视频对象都会显示计费的参考时长 (reference_seconds)。

编辑和延长视频

将 reference_mode 设为 edit 可修改参考视频 (替换人物或物体、添加或移除内容、更换音乐),设为 extend 可向后续写或向前扩展视频。在提示词中说明操作: “将 @Video1 中的汽车替换为 @Image1 中的汽车”, “续写 @Video1, 让舞者离开舞台”。

  • 编辑会保留视频的画幅和时长,因此不要传入 aspect_ratio 和 seconds。按最长参考视频的时长计费,该视频时长须为 4 至 30 秒。
  • 延长视频会保留原视频的画幅;seconds 用于设置新视频的时长。
  • 未设置 reference_mode 时,模型会根据提示词决定操作;如果提示词被识别为编辑操作,但设置了 seconds 或 aspect_ratio, 则可能生成失败 (失败视频不收费)。

图像要求

  • PNG、JPEG 或 WebP 格式,以公开可访问的 https 链接或 data URL 提供,最大 10 MB。
  • 每边 300 至 6000 像素,长宽比和宽长比均不得超过 5:2. 不符合要求的 data URL 会被立即拒绝,并返回原因说明。链接会在视频生成开始时读取:如果链接内容不是可用图像,视频会生成失败并返回 invalid_image, 不收取费用。
  • 同一请求中只能使用首尾帧或参考素材,不能同时使用。
  • 请求采用 JSON 格式:图像以链接或 data URL 传入,不支持 multipart 上传。

视频对象

GET /v1/videos/video_abc123
{
"id": "video_abc123",
"object": "video",
"model": "seedance-2.0",
"status": "completed",
"progress": 100,
"created_at": 1790870400,
"completed_at": 1790870562,
"expires_at": 1793462400,
"seconds": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"size": "1280x720",
"generate_audio": true,
"url": "https://...signed link...",
"url_expires_at": 1790956962,
"cost": 1.035,
"error": null
}
字段含义
statusqueued、in_progress、completed 或 failed。
progress根据模型通常所需时间估算的进度,范围为 0 至 100.
url生成完成后的 MP4. 链接有效期为 24 小时;重新查询任务即可获取新链接。
expires_at视频的删除时间:创建后 30 天,或在此之前由用户从素材库中删除的时间。
cost生成完成后的实际费用。
reference_seconds如提供了参考视频,此处为计入费用的参考视频秒数。
error视频生成失败时返回:code(content_policy、invalid_image、模型无法按要求处理请求时的 invalid_request、generation_failed,或超过 90 分钟后的 generation_timeout)以及一条说明消息。

其他端点

端点返回内容
GET /v1/videos/{id}单个视频,格式同上。
GET /v1/videos/{id}/contentMP4 文件本身。
GET /v1/videos?limit=20&after=video_abc工作区中的视频,按最新优先排序,通过 first_id 和 last_id 分页。

视频计费

视频费用为每秒单价(按分辨率区分)乘以时长; 无声视频每秒便宜 Kling 和 PixVerse cost; 参考视频按其时长计费,单价为上述单价的一部分。开始生成时,会从余额中冻结相应金额;生成完成后扣费,失败则解冻。生成失败不收费。

先用最低分辨率和较短时长生成草稿,调好提示词后再以更高分辨率生成成片。等待时间主要花在排队上,因此草稿不会快太多,但费用低得多。

有疑问,或发现内容缺失?联系我们的支持团队,我们会通过邮件回复,通常只需一分钟。