快速开始
视频生成是异步操作,整个流程分为三步:
1. 提交任务 → 获得 video_id
2. 轮询状态 → 等待 status 变为 completed
3. 下载视频 → 获取 MP4 文件
最简示例
# 第一步:提交视频生成任务
curl -X POST https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-t2v",
"prompt": "一只猫在钢琴上弹奏爵士乐,温暖的灯光,电影感镜头",
"seconds": "5",
"size": "1280x720"
}'
# 响应示例:
# {
# "id": "eyJtb2RlbCI6IndhbjI...",
# "object": "video",
# "status": "in_progress",
# "model": "wan2.6-t2v",
# "duration": 5,
# "width": 1280,
# "height": 720,
# ...
# }
# 第二步:轮询查询状态(每 15 秒查询一次,直到 status 为 completed)
curl https://aihubmix.com/v1/videos/{video_id} \
-H "Authorization: Bearer $AIHUBMIX_API_KEY "
# 第三步:下载视频
curl https://aihubmix.com/v1/videos/{video_id}/content \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
--output video.mp4
接口概览
接口 方法 路径 说明 创建视频 POST /v1/videos提交视频生成任务 查询状态 GET /v1/videos/{video_id}查询任务状态与进度 下载视频 GET /v1/videos/{video_id}/content下载生成的 MP4 视频 删除任务 DELETE /v1/videos/{video_id}删除视频任务
Base URL:https://aihubmix.com
认证方式:Bearer Token
Authorization: Bearer $AIHUBMIX_API_KEY
支持的模型
文生视频(Text-to-Video)
厂商 模型名称 特点 OpenAI sora-2标准视频生成,支持音画同步 OpenAI sora-2-pro高质量版本,更精致稳定的画面 Google veo-3.1-generate-preview最新 Veo 3.1,原生音频,支持 4K Google veo-3.1-fast-generate-previewVeo 3.1 快速版,生成速度更快 Google veo-3.0-generate-previewVeo 3.0,高保真视频 Google veo-2.0-generate-001Veo 2.0,稳定版 阿里 wan2.6-t2v通义万相最新版,音画同步 阿里 wan2.5-t2v-preview通义万相 2.5,中文优化 阿里 wan2.2-t2v-plus通义万相 2.2 字节 jimeng-3.0-pro即梦 3.0 Pro,1080P 高清 字节 jimeng-3.0-1080p即梦 3.0 1080P 字节 doubao-seedance-2-0-260128专业级多模态创作视频模型 Seedance 2.0 字节 doubao-seedance-2-0-fast-260128Seedance 2.0 快速版 快手 kling-v3、kling-v2-6、kling-v2-5-turbo、kling-v2-1可灵 Kling 文生/图生,新版支持 3~15 秒 快手 kling-v3-omni、kling-video-o1可灵 OmniVideo 多模态,支持参考视频、原生音频、多镜头
图生视频(Image-to-Video)
厂商 模型名称 特点 阿里 wan2.6-i2v通义万相最新版图生视频 阿里 wan2.5-i2v-preview通义万相 2.5 图生视频 阿里 wan2.2-i2v-plus通义万相 2.2 图生视频 字节 doubao-seedance-2-0-260128多模态参考输入,支持图片/视频/音频 字节 doubao-seedance-2-0-fast-260128Seedance 2.0 快速版 快手 kling-v1-6 等可灵图生视频,支持尾帧、多图参考(最多 4 张)
图生视频需通过 input_reference 参数传入参考图片(阿里通义万相);豆包 Seedance 通过 extra_body.content 数组传入,支持图片、视频、音频多种参考类型;可灵 Kling 使用 image / image_tail / image_list 传图,详见下方可灵 Kling 小节。
API 详细说明
请求头
Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json
创建视频生成任务
请求体
参数 类型 必填 说明 modelstring 是 模型名称,如 wan2.6-t2v、sora-2 promptstring 是 视频描述文本 secondsstring 否 视频时长(秒),统一使用字符串类型,如 "5"、"8"(见各模型详解) sizestring 否 分辨率,格式 宽x高,如 1920x1080(各模型支持值不同) input_referencestring/object 否 参考图片(图生视频),支持 URL 或 base64
不同模型的响应格式略有差异,但都包含 id(video_id)和 status 字段。以 status 判断任务进度即可。
响应示例(通义万相/Veo/即梦AI )
{
"id" : "eyJtb2RlbCI6IndhbjI..." ,
"object" : "video" ,
"created" : 1772460274 ,
"model" : "wan2.6-t2v" ,
"status" : "in_progress" ,
"prompt" : "一只猫在窗台上看雨" ,
"duration" : 5 ,
"width" : 1920 ,
"height" : 1080 ,
"url" : null ,
"error" : null
}
响应示例(Sora)
{
"id" : "eyJtb2RlbCI6InNvcmEtMi..." ,
"object" : "video" ,
"created_at" : 1772451930 ,
"status" : "queued" ,
"model" : "sora-2" ,
"progress" : 0 ,
"prompt" : "A cinematic drone shot over mountains" ,
"seconds" : "8" ,
"size" : "1280x720"
}
通用状态值说明
状态 说明 queued排队中(Sora 特有) in_progress生成中 completed生成完成,可以下载 failed生成失败
查询视频状态
GET /v1/videos/{video_id}
轮询此接口检查任务是否完成。建议每 15 秒 查询一次。
响应示例(生成完成 - 通义万相)
{
"id" : "eyJtb2RlbCI6IndhbjI..." ,
"object" : "video" ,
"status" : "completed" ,
"model" : "wan2.5-t2v-preview" ,
"duration" : 5 ,
"width" : 1920 ,
"height" : 1080 ,
"url" : "https://aihubmix.com/v1/videos/eyJtb2RlbCI6IndhbjI.../content" ,
"error" : null
}
响应示例(生成完成 - Sora)
{
"id" : "eyJtb2RlbCI6InNvcmEtMi..." ,
"object" : "video" ,
"created_at" : 1772451930 ,
"status" : "completed" ,
"completed_at" : 1772452114 ,
"expires_at" : 1772538330 ,
"model" : "sora-2" ,
"progress" : 100 ,
"prompt" : "A cinematic drone shot over mountains" ,
"seconds" : "8" ,
"size" : "1280x720"
}
所有模型均通过 status == "completed" 判断完成状态,然后调用 /content 接口下载。
下载视频内容
GET /v1/videos/{video_id}/content
当状态为 completed 后,调用此接口下载 MP4 视频文件。
响应 : 直接返回视频二进制流Content-Type: video/mp4)。
curl https://aihubmix.com/v1/videos/{video_id}/content \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
--output my_video.mp4
注意 :视频下载链接通常有 24 小时有效期,请及时下载保存。
删除视频任务
该接口用于删除已创建的视频任务。
DELETE /v1/videos/{video_id}
各模型参数详解
OpenAI Sora
参数 支持值 模型 sora-2、sora-2-pro时长 (seconds) "4"(默认)、"8"、"12"分辨率 (size) 720x1280(默认)、1280x720、1024x1792、1792x1024图生视频 支持,通过 input_reference 传入图片
提示:所有模型的 seconds 参数统一使用字符串类型传入(如 "8")。
示例
curl -X POST https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "A cinematic drone shot soaring over a misty mountain range at sunrise, golden light filtering through the clouds",
"seconds": "8",
"size": "1280x720"
}'
Google Veo
参数 支持值 模型 veo-3.1-generate-preview(推荐)、veo-3.1-fast-generate-preview(快速)、veo-3.0-generate-preview、veo-2.0-generate-001时长 (seconds) Veo 3/3.1:"4"、"6"、"8";Veo 2:"5"~"8"(默认 "8") 分辨率 (size) 720p(默认)、1080p、4k(4K 仅 Veo 3+),或像素格式如 1280x720、1920x1080宽高比 16:9(默认)、9:16 图生视频 支持,通过 input_reference 传入首帧图片(Veo 3.1),使用时 seconds 固定为 "8"
示例
curl -X POST https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3.1-generate-preview",
"prompt": "一个宁静的日式庭院,樱花花瓣缓缓飘落,锦鲤在池塘中游动,背景传来悠扬的风铃声",
"seconds": "8",
"size": "1280x720"
}'
提示:Veo 支持原生音频生成,可在 prompt 中描述音效,如”背景传来鸟鸣声”、“钢琴旋律”。
通义万相
参数 支持值 文生视频模型 wan2.6-t2v(推荐)、wan2.5-t2v-preview、wan2.2-t2v-plus图生视频模型 wan2.6-i2v(推荐)、wan2.5-i2v-preview、wan2.2-i2v-plus时长 (seconds) 因模型而异(见下方说明),默认 "5" 分辨率 (size) 见下方表格,x 和 * 分隔符均可(如 1920x1080 或 1920*1080) 图生视频 通过 input_reference 传入图片 URL 或 base64
各模型支持的时长
模型 seconds 可选值 默认值 wan2.6-t2v / wan2.6-i2v"2"~"15"(任意整数值)"5"wan2.5-t2v-preview / wan2.5-i2v-preview"5" 或 "10""5"wan2.2-t2v-plus / wan2.2-i2v-plus"5"(固定)"5"
支持的分辨率(宽*高)
清晰度 可选分辨率 480P 832x480、480x832、624x624720P 1280x720(默认)、720x1280、960x960、1088x832(4:3)、832x1088(3:4)1080P 1920x1080、1080x1920、1440x1440、1632x1248(4:3)、1248x1632(3:4)
注意 :wan2.6 仅支持 720P 和 1080P;wan2.5 支持 480P、720P、1080P;wan2.2 仅支持 480P 和 1080P。
示例
curl -X POST https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-t2v",
"prompt": "一条蜿蜒的小溪穿过秋天的森林,金黄色的落叶飘落在水面上,阳光透过树叶洒下斑驳的光影",
"seconds": "5",
"size": "1920x1080"
}'
提示:wan2.5 及以上版本默认生成有声视频(自动配音),中文 prompt 效果更佳。
即梦 AI
参数 支持值 模型 jimeng-3.0-pro(推荐)、jimeng-3.0-1080p时长 (seconds) "5" 或 "10"(默认 "5")分辨率 (size) 支持宽高比格式或像素格式 图生视频 支持,通过 input_reference 传入图片 URL 或 base64
支持的宽高比与对应分辨率
宽高比 (size) 实际分辨率 16:9 或 1920x10801920×1088 9:16 或 1080x19201088×1920 4:3 或 1664x12481664×1248 3:4 或 1248x16641248×1664 1:1 或 1440x14401440×1440 21:9 或 2176x9282176×928
示例
curl -X POST https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-3.0-pro",
"prompt": "一位身穿汉服的少女在竹林间翩翩起舞,长裙随风飘动,背景是淡淡的晨雾",
"seconds": "5",
"size": "16:9"
}'
豆包 Seedance
参数 支持值 模型 doubao-seedance-2-0-260128、doubao-seedance-2-0-fast-260128分辨率 (resolution) "480p"、"720p"(默认)时长 (duration) 整数,范围 4~15,或 -1(模型自动决定) 宽高比 (ratio) "adaptive"(默认,自动适配)、"16:9"、"9:16"、"1:1"、"4:3"、"3:4"、"21:9"有声视频 (generate_audio) 默认 true;设为 false 生成无声视频 水印 (watermark) 默认 false 多模态参考 支持图片、视频、音频
extra_body.content 支持的引用类型
类型 type 值role 值说明 参考图片 image_urlreference_image画面/风格参考图片 参考视频 video_urlreference_video运镜/构图参考视频 参考音频 audio_urlreference_audio背景音乐音频文件
示例
curl -X POST "https://aihubmix.com/v1/videos" \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-260128",
"prompt": "Use the first-person POV framing from Video 1 throughout, and use Audio 1 as the background music for the entire clip. Create a first-person fruit tea commercial featuring the Seedance brand limited-edition apple fruit tea, "Ping Ping An An."
Opening frame: Image 1. From a first-person perspective, your hand picks a dew-covered Aksu red apple, accompanied by a crisp, satisfying bite-like tapping sound.
Seconds 2–4: Fast-paced cuts. Your hand drops freshly cut apple chunks into a shaker, adds ice and tea base, then shakes vigorously. The sound of ice clinking and shaking syncs with upbeat percussion. Background voiceover: "Freshly cut, freshly shaken."
Seconds 4–6: First-person close-up of the finished drink. The layered fruit tea is poured into a clear cup. Your hand gently squeezes a creamy topping across the surface. A pink label is placed on the cup. The camera pushes in to highlight the rich texture and layering.
Seconds 6–8: First-person hand holding the drink. You raise the fruit tea from Image 2 toward the camera, as if offering it directly to the viewer. The label is clearly visible. Background voiceover: "Take a refreshing sip."
Final frame: Freeze on Image 2.
All background voiceovers should be in a female voice.",
"extra_body": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_tea_video1.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_audio/r2v_tea_audio1.mp3"
},
"role": "reference_audio"
}
],
"ratio": "16:9",
"duration": 11,
"watermark": false
}
}'
可灵 Kling
可灵(Kling)支持 文生视频、图生视频、多图参考生视频、OmniVideo 多模态 四类能力,统一通过 /v1/videos 接口调用,网关按「模型名 + 输入形态」自动路由到可灵对应端点,无需调用方区分。
能力 模型 文生 / 图生 kling-v1、kling-v1-5、kling-v1-6、kling-v2-1、kling-v2-5-turbo、kling-v2-6、kling-v3多图参考 kling-v1-6OmniVideo 多模态 kling-video-o1、kling-v3-omni
参数
参数 类型 说明 modelstring 必填 ,kling-*,决定能力与版本promptstring 文本提示词 negative_promptstring 负向提示词 modestring 生成模式:std(720P)/ pro(1080P)/ 4k,默认 std duration / secondsstring 时长(秒),老模型 5/10,新模型 3~15,默认 5 aspect_ratiostring 画幅:16:9 / 9:16 / 1:1(omni 纯文生、视频参考时必填,缺省自动补 16:9) cfg_scalefloat 提示词相关性 [0, 1],默认 0.5(kling-v2.x 不支持) imagestring 图生 :单图,图片 URL 或 Base64(Base64 不带 data:image/...;base64, 前缀)image_tailstring 图生 :尾帧图(可选)image_listarray 多图参考 :图片 URL 数组,最多 4 张soundstring omni :on/off,是否生成原生音频,默认 offvideo_listarray omni :参考视频 [{ "video_url": "...", "refer_type": "feature" }],refer_type 取 feature(视频参考)/ base(视频编辑)
不支持或未映射的关键参数会显式报错,不会静默丢弃。其余可灵原生参数可放进 extra_body 透传到上游。
示例
文生视频
图生视频
多图参考
OmniVideo 参考视频
OmniVideo 原生音频
curl https://aihubmix.com/v1/videos \
-H "Authorization: Bearer $AIHUBMIX_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v1-6",
"prompt": "一只橘猫在阳光下的草地上奔跑",
"mode": "std",
"duration": "5"
}'
说明
异步三步 :提交获 video_id → 轮询 GET /v1/videos/{video_id} 至 status 为 completed → GET /v1/videos/{video_id}/content 下载 MP4。状态值:in_progress / completed / failed。
出片通常 1~3 分钟;结果视频 URL 30 天后清理 ,请及时转存。
删除任务 :可灵无删除接口,DELETE /v1/videos/{video_id} 返回 501 not_supported。
计费 :按 模型 × mode × 时长 × 能力(有无参考视频 / 有声)扣费;生成失败不扣费 ,查询与下载不计费。
完整调用示例
import requests
import time
API_KEY = "AIHUBMIX_API_KEY"
BASE_URL = "https://aihubmix.com"
HEADERS = {
"Authorization" : f "Bearer { API_KEY } " ,
"Content-Type" : "application/json"
}
# 第一步:创建视频生成任务
response = requests.post(
f " { BASE_URL } /v1/videos" ,
headers = HEADERS ,
json = {
"model" : "wan2.6-t2v" ,
"prompt" : "一片星空下的沙漠,流星划过夜空,远处篝火的光芒在微风中摇曳" ,
"seconds" : "5" ,
"size" : "1920x1080"
}
)
result = response.json()
video_id = result[ "id" ]
print ( f "任务已创建,video_id: { video_id } " )
# 第二步:轮询查询状态
while True :
status_response = requests.get(
f " { BASE_URL } /v1/videos/ { video_id } " ,
headers = HEADERS
)
status_data = status_response.json()
current_status = status_data[ "status" ]
print ( f "当前状态: { current_status } " )
if current_status == "completed" :
print ( "视频生成完成!" )
break
elif current_status == "failed" :
error_msg = status_data.get( "error" , {})
if isinstance (error_msg, dict ):
error_msg = error_msg.get( "message" , "未知错误" )
print ( f "生成失败: { error_msg } " )
break
time.sleep( 15 ) # 每 15 秒查询一次
# 第三步:下载视频
video_response = requests.get(
f " { BASE_URL } /v1/videos/ { video_id } /content" ,
headers = HEADERS
)
with open ( "output.mp4" , "wb" ) as f:
f.write(video_response.content)
print ( f "视频已保存为 output.mp4( { len (video_response.content) / 1024 / 1024 :.1f} MB)" )
FAQ
视频生成需要多长时间?
视频生成通常需要 1-5 分钟,具体时间取决于模型、分辨率和时长。建议设置 15 秒的轮询间隔。
input_reference 用于图生视频场景,支持三种传入方式:
// 方式一:直接传入图片 URL
"input_reference" : "https://example.com/image.jpg"
// 方式二:传入 base64 编码的图片(对象格式)
"input_reference" : {
"mime_type" : "image/jpeg" ,
"data" : "<BASE64_ENCODED_IMAGE>"
}
// 方式三:传入 data URL
"input_reference" : "data:image/jpeg;base64,<BASE64_ENCODED_IMAGE>"
视频下载链接有效期是多久?
生成的视频下载链接通常有 24 小时 有效期,请及时下载保存。
各模型 seconds 参数有什么区别?
模型 可选值 默认值 Sora (sora-2 / sora-2-pro) "4", "8", "12""4"Veo 3/3.1 (veo-3.1-generate-preview 等) "4", "6", "8""8"Veo 2 (veo-2.0-generate-001) "5"~"8""8"通义万相 wan2.6 "2"~"15""5"通义万相 wan2.5 "5", "10""5"通义万相 wan2.2 "5"(固定)"5"即梦AI (jimeng-3.0-pro 等) "5", "10""5"豆包 Seedance (doubao-seedance-2-0-*) 整数 duration4~15 或 -1 5可灵 Kling 新版 (kling-v2-x / kling-v3 等) "3"~"15""5"可灵 Kling 老版 (kling-v1 / kling-v1-5 / kling-v1-6) "5", "10""5"
> 提示 :所有模型的 seconds 参数统一使用字符串类型传入(如 "8"),API 会自动处理。
不同模型size 参数格式有什么区别?
模型 支持的 size 值 Sora 1280x720720x12801024x17921792x1024Veo 像素格式1280x720 等)或分辨率标签720p1080p4k) 通义万相 像素格式x 和 * 均可(如 1920x1080 或 1920*1080) 即梦 AI 宽高比格式16:99:16 等)或像素格式 豆包 Seedance 宽高比格式("adaptive"、"16:9"、"9:16" 等) 可灵 Kling 不使用 size,改用 mode(std/pro/4k 控制清晰度)+ aspect_ratio(16:9/9:16/1:1 控制画幅)
### seconds 和 duration 有什么区别?
两者含义相同,均表示视频时长。API 同时支持这两个参数名(Sora 除外,Sora 只接受 seconds)。推荐统一使用 seconds。
如何编写更好的 prompt?
描述具体场景 :包含主体、动作、环境、光线、氛围
指定镜头语言 :如”特写”、“航拍”、“推镜头”、“慢动作”
描述风格 :如”电影感”、“纪录片风格”、“动画风格”
中文模型用中文 prompt 效果更好 :通义万相针对中文优化
Veo 支持音频描述 :可在 prompt 中描述声音,如”鸟鸣声”、“钢琴旋律”
任务失败怎么处理?
当 status 为 failed 时,响应中的 error 字段会包含错误信息:
{
"status" : "failed" ,
"error" : {
"message" : "Video generation failed due to content policy violation" ,
"type" : "video_generation_error"
}
}
常见失败原因包括:内容违规、prompt 过长、图片格式不支持等。请根据错误信息调整后重试。
更新时间:2026-06-01