Qzent Token API 接入文档
一个 API Key、一个稳定域名,即可调用 OpenAI 兼容文本模型、Gemini 图片生成和 Veo 视频生成。
API 地址:https://token.qzent.ai
继续使用客户端原有协议
保留现有请求格式,只需把 API 地址和 API Key 换成 Qzent Token。
用于 OpenAI SDK 以及兼容 OpenAI 协议的客户端。
用于 Gemini REST 路径,通过 x-goog-api-key 鉴权。
为每个请求添加鉴权
在控制台创建密钥。OpenAI 客户端使用 Bearer Token,Gemini 客户端使用 x-goog-api-key。请勿在浏览器代码中暴露密钥。
OpenAI 兼容接口
把现有 OpenAI 客户端指向 Qzent Token。流式响应、Chat Completions、Responses 和 Embeddings 均保留熟悉的请求格式。
from openai import OpenAI
client = OpenAI(
api_key="YOUR_QZENT_API_KEY",
base_url="https://token.qzent.ai/v1",
)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)使用 Gemini 生成图片
使用官方模型名称调用 Gemini 原生 generateContent 接口,文本和内嵌图片均沿用 Gemini 请求格式。
省略 imageSize 时使用 1K。2K 和 4K 处理时间更长,并按后台配置的对应分辨率档位计费。
curl 'https://token.qzent.ai/v1beta/models/gemini-3.1-flash-image:generateContent' \
-H 'x-goog-api-key: YOUR_QZENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contents": [{
"role": "user",
"parts": [{"text": "A blue paper boat on a calm river"}]
}],
"generationConfig": {
"imageConfig": {
"aspectRatio": "16:9",
"imageSize": "2K"
}
}
}'使用 Veo 生成视频
Veo 返回持久化长任务。提交后保存返回的 operation name,并持续轮询,直到 done 为 true。
curl 'https://token.qzent.ai/v1beta/models/veo-3.1-generate-preview:predictLongRunning' \
-H 'x-goog-api-key: YOUR_QZENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"instances": [{"prompt": "A paper boat on a calm river"}],
"parameters": {"aspectRatio": "16:9", "durationSeconds": 8}
}'curl 'https://token.qzent.ai/v1beta/models/veo-3.1-generate-preview/operations/TASK_ID' \
-H 'x-goog-api-key: YOUR_QZENT_API_KEY'MiniMax H3 Developer
文生视频、首尾帧图生视频和参考生视频统一使用 OpenAI 视频任务接口。H3 不走 Gemini Interactions。
使用 Qzent API Key,通过 Authorization: Bearer 认证,不使用 Atlas Cloud 密钥。将以下任一 JSON 示例保存为 request.json;提交前替换全部 YOUR_PUBLIC_HOST 素材占位地址。
# Save one JSON example below as request.json first.
curl --silent --show-error --connect-timeout 15 --max-time 180 \
'https://token.qzent.ai/v1/videos' \
-H "Authorization: Bearer $QZNET_TOKEN_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @request.json \
--dump-header submit.headers --output submit.response.json
# No automatic POST retries. Inspect the response and retain the request ID.H3 请求参数
prompt 必填;seconds 为 4–15 的整数,默认 8。resolution 支持 480P、768P、1440p-sr、4k-sr,默认 768P。prompt_expansion 省略或设为 false。
文生视频比例:21:9、16:9、4:3、1:1、3:4、9:16,默认 1:1。参考模式额外支持 adaptive,且默认为 adaptive;图生视频只接受 adaptive。
文生视频
{
"model": "minimax/h3-developer/text-to-video",
"prompt": "A slow aerial shot over a misty canyon at sunrise.",
"seconds": 4,
"resolution": "480P",
"ratio": "16:9"
}首帧与尾帧
image 是必填首帧,end_image 是可选尾帧;两者可使用公开 HTTP(S) 地址或完整的 PNG/JPEG/WebP Data URL,不接受裸 Base64 或本地路径。只用首帧时删除 end_image。
{
"model": "minimax/h3-developer/image-to-video",
"prompt": "Move smoothly from the opening canyon view to the bridge panorama.",
"seconds": 4,
"resolution": "480P",
"ratio": "adaptive",
"image": "https://YOUR_PUBLIC_HOST/first-frame.jpg",
"end_image": "https://YOUR_PUBLIC_HOST/last-frame.jpg"
}混合参考素材
Use one refers array, not separate image, video and audio arrays. Each item has type (image, video or audio) and url. The gateway accepts 1\u20139 items, including at least one image or video. URLs must be reachable HTTP(S); local paths and data URLs are not accepted. Do not mix refers with image, end_image or images.
{
"model": "minimax/h3-developer/reference-to-video",
"prompt": "Create a new canyon aerial shot using the reference landscape, camera motion and audio rhythm.",
"seconds": 4,
"resolution": "480P",
"ratio": "16:9",
"refers": [
{
"type": "image",
"url": "https://YOUR_PUBLIC_HOST/landscape.jpg"
},
{
"type": "video",
"url": "https://YOUR_PUBLIC_HOST/motion.mp4"
},
{
"type": "audio",
"url": "https://YOUR_PUBLIC_HOST/music.mp3"
}
]
}当前价格与参考素材费用
As of 2026-09-20, default group prices are 480P \u00a50.16/s, 768P \u00a50.26/s, 1440p-sr \u00a50.49/s and 4k-sr \u00a50.67/s. A 4-second 480P output without reference surcharges costs \u00a50.64. Check the model catalogue for current prices and group multipliers.
参考视频输入时长及额外参考素材可能增加费用。提交时预扣估算额度,完成后按实际计费用量结算并退回差额。参考请求不能只按输出秒数估算总价。
查询与下载
Read id from a successful submission. Poll GET /v1/videos/{id} every 5\u201310 seconds: queued or in_progress means wait; completed means download; failed means inspect error.message. Download with the same Qzent key from GET /v1/videos/{id}/content.
curl --silent --show-error \
"https://token.qzent.ai/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $QZNET_TOKEN_API_KEY"
# Download only after status is completed.
curl --fail --silent --show-error \
"https://token.qzent.ai/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $QZNET_TOKEN_API_KEY" \
--output video.mp4路由错误与提交超时
H3 请求若在 /v1beta/interactions 返回 503 model_not_found 或 No available channel,先检查入口。应使用 POST /v1/videos 和完整模型 ID,并确认密钥分组及模型限制允许访问。
提交超时不代表服务端未接单。不要自动重复 POST。保存请求时间和请求 ID,核对任务日志与使用日志;找到任务号后恢复查询。
上面的 curl 超时是客户端设置,不是服务端时限保证。本地引擎锁也不能证明网关故障。先确认原请求结果,再决定是否重发。部分上游 HTTP 500 会先重试,再标记失败并退款。
文生视频、首帧图生视频和视频参考已验证线上生成及下载。尾帧和图片/视频/音频混合示例已通过本地契约测试,含音频的混合参考尚未完成线上实测。
Seedance 2.0 / 2.5
Seedance 使用与 H3 相同的 OpenAI 视频任务接口、查询与下载路径。请使用 Qzent API Key,而非 Atlas Cloud 密钥。共 12 个模型 ID:bytedance/seedance-2.0-mini、bytedance/seedance-2.0-fast、bytedance/seedance-2.0 与 bytedance/seedance-2.5 之下各有 text-to-video、image-to-video、reference-to-video,例如 bytedance/seedance-2.0-fast/text-to-video 与 bytedance/seedance-2.5/text-to-video。Mini 是低成本走量档,Fast 运动质量更强,标准版画质优先并支持原生 4k,2.5 单次最长 30 秒、最多 50 个参考素材。
Seedance 请求参数
文生视频必填 prompt,其他模式可选。seconds 为 4 到 15 的整数(2.5 为 4 到 30),或 -1 由模型自选时长(默认 5)。resolution 支持 480p、720p、720p-SR、1080p-SR、1440p-SR(默认 720p);Fast 与标准版另有原生 1080p,标准版增加原生 4k,2.5 增加 720p-ESR、1080p-ESR、1080p-ESR & 60fps、1440p-ESR 与 4k-ESR 增强档。ratio 支持 16:9、4:3、1:1、3:4、9:16、21:9 或 adaptive(默认 adaptive);图生视频的输出画幅跟随首帧图片,ratio 只能传 adaptive 或省略。可选 generate_audio(默认 true)、bitrate_mode(standard 或 high)、watermark(默认 false)、seed 与 return_last_frame。
文生视频
{
"model": "bytedance/seedance-2.0-mini/text-to-video",
"prompt": "A cyclist rides through a rainy city street at dusk, cinematic tracking shot, natural reflections, dynamic motion.",
"seconds": 5,
"resolution": "720p",
"ratio": "9:16"
}首帧与尾帧
image 是必填首帧,last_image 是可选尾帧(H3 使用 end_image)。两者可使用公开 HTTP(S) 地址或完整的图片 Data URL。
混合参考素材
使用 reference_images、reference_videos 与 reference_audios 三个数组(H3 是单个 refers 数组)。Seedance 2.0 各数组最多 9 个 URL 且至少一张图或一段视频;Seedance 2.5 放宽到 30 图、10 视频、10 音频,并允许纯音频作为唯一参考。不要给 Seedance 模型传 refers、end_image 或 prompt_expansion。
{
"model": "bytedance/seedance-2.0-mini/reference-to-video",
"prompt": "The character in image 1 follows the motion of video 1 and dances.",
"reference_images": [
"https://YOUR_PUBLIC_HOST/character.png"
],
"reference_videos": [
"https://YOUR_PUBLIC_HOST/motion.mp4"
],
"seconds": 8,
"resolution": "720p",
"ratio": "adaptive"
}Seedance 2.5 长视频生成
Seedance 2.5 单次最长生成 30 秒,并支持画面内多语言文字渲染。注意 60fps 档位的分辨率字符串是完整的 "1080p-ESR & 60fps",包含空格与 & 符号。
{
"model": "bytedance/seedance-2.5/text-to-video",
"prompt": "A 30-second product commercial: a perfume bottle on a marble slab, slow orbiting camera, soft reflections, restrained lighting.",
"seconds": 30,
"resolution": "1080p-ESR & 60fps",
"ratio": "16:9"
}当前价格与参考素材费用
截至 2026-09-22,default 分组每秒价格:Mini 480p ¥0.12、720p ¥0.26、720p-SR ¥0.22、1080p-SR ¥0.48、1440p-SR ¥0.85;Fast 480p ¥0.30、720p ¥0.64、720p-SR ¥0.53、1080p ¥1.43、1080p-SR ¥1.14、1440p-SR ¥2.03;标准版 480p ¥0.99、720p ¥2.12、1080p ¥4.77、原生 4k ¥10.65;Seedance 2.5 480p ¥1.53、720p ¥3.29、1080p ¥6.48、4k-ESR ¥18.62。最新价格与分组倍率以模型广场为准。
含参考视频的请求由上游按全部输入与输出 token 计费,只按输出秒数会低估总价。提交时预扣估算额度,完成后按上游报价的实际计费用量结算并退回差额。seconds 设为 -1 时,最终费用以完成时的报价为准。
查询与下载
查询与下载方式与 H3 完全相同:每 5–10 秒查询 GET /v1/videos/{id},完成后用同一个 Qzent 密钥访问 GET /v1/videos/{id}/content 下载。
curl --silent --show-error \
"https://token.qzent.ai/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $QZNET_TOKEN_API_KEY"
# Download only after status is completed.
curl --fail --silent --show-error \
"https://token.qzent.ai/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $QZNET_TOKEN_API_KEY" \
--output video.mp4使用 Gemini Omni Flash 生成与编辑视频
使用 gemini-omni-1.1-flash,通过 Gemini Interactions 接口进行文生视频、图片参考生成、视频编辑和多轮修改。生成新视频无需先上传源视频;编辑时可上传最长 10 秒的视频。
通过官方 SDK 或续传协议上传源视频。
生成、编辑、延长和多轮修改使用同一接口。
上传文件保留 48 小时,请及时保存结果。
文生视频与图片参考生成
纯文本 input 可直接生成视频;图片参考使用 type: image 和 uri,可提供 1–3 张参考图片。图片地址必须可访问;图片参考不能与源视频或 previous_interaction_id 混用。图片参考示例不表示首尾帧约束。
{
"model": "gemini-omni-1.1-flash",
"input": "生成一段峡谷日出航拍视频,镜头平稳向前推进。",
"response_format": {"type": "video", "delivery": "uri"}
}{
"model": "gemini-omni-1.1-flash",
"input": [{
"type": "user_input",
"content": [
{"type": "image", "uri": "https://YOUR_PUBLIC_HOST/reference.jpg"},
{"type": "text", "text": "参考图片中的峡谷景色,生成平稳向前推进的航拍视频。"}
]
}],
"response_format": {"type": "video", "delivery": "uri"}
}首尾帧生成(Qzent 扩展)
将 response_format.generation_mode 设为 "first_last_frame" 即可生成两帧之间的过渡视频。该参数是 Qzent 扩展,不是 Google 官方参数。按顺序提供恰好两张图片:首帧在前,尾帧在后。不带该参数时,两张图片仍按普通参考图处理。
duration_seconds 支持 4、6、8、10(默认 8),aspect_ratio 支持 16:9 或 9:16。该模式不能与源视频、previous_interaction_id 或视频编辑同时使用。计费、轮询和下载与 Omni 生成完全相同;使用相同的 curl 命令、替换为本 JSON 请求体提交即可。
{
"model": "gemini-omni-1.1-flash",
"input": [{
"type": "user_input",
"content": [
{"type": "image", "uri": "https://YOUR_PUBLIC_HOST/first-frame.jpg"},
{"type": "image", "uri": "https://YOUR_PUBLIC_HOST/last-frame.jpg"},
{"type": "text", "text": "从首帧画面平滑过渡到尾帧画面,镜头缓慢推进。"}
]
}],
"response_format": {"type": "video", "delivery": "uri", "aspect_ratio": "16:9", "duration_seconds": 8, "generation_mode": "first_last_frame"}
}将以上任一 JSON 保存为 omni.json,替换素材占位地址后提交。使用 Qzent API Key,并保存响应中的 id。Omni 使用 /v1beta/interactions;H3 使用 /v1/videos。提交超时不代表未接单,请核对任务日志,勿自动重复 POST。
curl --silent --show-error --connect-timeout 15 --max-time 180 \
'https://token.qzent.ai/v1beta/interactions' \
-H "x-goog-api-key: $QZNET_TOKEN_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @omni.json \
--dump-header omni.headers --output omni.response.json查询生成结果
将返回的 id 填入 INTERACTION_ID,每 5–10 秒查询一次。in_progress 表示处理中;completed 后从 steps 中 type 为 model_output 的 content 找到 type 为 video 的 uri,及时下载保存;failed 时读取 error。
curl --silent --show-error \
"https://token.qzent.ai/v1beta/interactions/$INTERACTION_ID" \
-H "x-goog-api-key: $QZNET_TOKEN_API_KEY"编辑已有视频与多轮修改
from google import genai
client = genai.Client(
api_key="YOUR_QZENT_API_KEY",
http_options={"base_url": "https://token.qzent.ai"},
)
video_file = client.files.upload(file="input.mp4")interaction = client.interactions.create(
model="gemini-omni-1.1-flash",
input=[{
"type": "user_input",
"content": [
{"type": "video", "uri": video_file.uri},
{"type": "text", "text": "移除桌上的杯子,保持镜头运动不变"},
],
}],
response_format={"type": "video", "delivery": "uri"},
)
# 返回 in_progress 时,用 interaction.id 查询
interaction = client.interactions.get(interaction.id)next_edit = client.interactions.create(
model="gemini-omni-1.1-flash",
previous_interaction_id=interaction.id,
input="把背景改成傍晚,并隐藏小提琴",
)一致地处理错误
Gemini 路由返回 google.rpc.Status,OpenAI 兼容路由返回 OpenAI 错误对象。重试时请判断 HTTP 状态码和消息。
{
"error": {
"code": 401,
"message": "Invalid API key",
"status": "UNAUTHENTICATED"
}
}