seeAPI Docs客户接入文档
Base URLhttps://api.example.com

API 文档

SeeAPI 客户接入文档

覆盖视频生成、图片生成、图片参考生视频、任务查询、模型列表、余额查询、计费行为、错误码和 Webhook 验签。 示例基础地址以平台实际分配为准,API Key 只应保存在服务端。
基础地址https://api.example.com
认证方式Authorization: Bearer sk_live_...
幂等请求Idempotency-Key: client-generated-key

认证与安全

外部 API 使用 API Key 认证。创建 API Key 时,完整密钥只展示一次;之后控制台只展示 key_prefix, 请在服务端安全保存密钥,不要放进前端代码、日志、截图或工单。

  • 所有公开 API 请求都带 Authorization: Bearer sk_live_...。
  • API Key 无效返回 401 invalid_api_key;被暂停或禁用返回 403 系列错误。
  • 可在控制台为每个 API Key 选择模型范围;该范围只能缩小当前客户分组已有权限,不能开通分组外模型。 未选择模型时,Key 保持对当前分组全部模型的访问。
  • 使用受限 Key 请求范围外模型时,会在创建任务和扣费前返回 403 model_not_available; 携带该 Key 调用 GET /v1/models 只返回它可访问的模型。
  • 建议每次提交任务都带业务侧唯一 Idempotency-Key,例如订单号或请求流水号。

幂等、计费与恢复规则

  • 同一用户使用同一个 Idempotency-Key 和相同请求体,会返回同一个任务,不会重复扣费。
  • 同一个 Idempotency-Key 搭配不同请求体,会返回 409 idempotency_conflict。
  • 平台在创建任务前预扣预计费用;任务成功后按已预扣金额正式结算。
  • 任务失败或取消后,Worker 会自动退款,任务最终通常表现为 refunded。
  • 余额不足返回 402 insufficient_credits,不会创建任务,并会把当前账户下 active API Key 暂停为 balance_paused。
  • 充值后只恢复 balance_paused 的 API Key,不恢复 user_disabled、admin_disabled 或 risk_blocked。

模型与生成能力

视频任务可以选择模型、时长、画幅、分辨率、生成数量、输入模式、声音和搜索开关;任务响应和任务详情继续返回预估、实扣与退款字段。

  • 视频生成不再区分 STD / Pro 输出档,客户只需要选择模型、时长、画幅和分辨率。
  • seedance-2.0 支持 480p、720p、1080p、4k;seedance-2.0-fast 与 seedance-2.0-mini 支持 480p、720p。
  • 三个模型均支持 4 到 15 秒、七种画幅以及 1、2、4 个输出。
  • seedance-2.5 支持 480p、720p、1080p、文生视频、全能生视频和视频编辑;文生/全能模式支持 4 到 30 秒和七种画幅,视频编辑固定使用自动时长与自动画幅。最多 30 张图、10 段视频、10 段音频,每段参考视频最长 30 秒、总时长不超过 30 秒。
  • happy-horse-1.1 支持 720p、1080p、3 到 15 秒和固定 1 个输出;提供文生视频、首帧图生视频及 1 到 9 张参考图生视频。
  • minimax-h3 支持 768P、2K,支持 5 到 15 秒、七种画幅和 1、2、4 个输出;支持文字、单图、首尾帧及图片/视频/音频混合参考。
  • seedream-5.0-pro 使用异步图片接口,支持 1K、2K、4K 自适应尺寸,以及官方边界内的精确 WIDTHxHEIGHT;支持最多 6 张普通参考图编辑,当前不接收独立遮罩文件。
  • 如需核对当前账户档位,请调用 /v1/credits 或联系平台管理员。

Image2 Pro

image-2-pro 和 image-2.5 提供同步与异步两种入口,默认 n=1、quality=auto、moderation=auto。Image2 Pro 默认 output_format=jpeg;Image2.5 仅支持 PNG,默认 output_format=png,标准售价为每张 0.6 元(客户约定价格以账户模型列表为准)。当前请求尺寸以鉴权后的模型列表为准;生成结果的实际宽高可能由模型微调,以返回图像为准。

  • 同步 /v1/images/generations 默认返回 b64_json,也可指定 url;JSON 参考图使用同一种 HTTPS 或 data URL,不接受 asset://。本地文件使用 multipart /v1/images/edits。
  • 异步 /v1/images/generations/async 只返回任务 ID 和最终 URL。参考图先上传到普通素材接口,只接受当前账号有效的 asset://ref_...;不直接传 HTTPS 或 data URL。无参考图时省略素材字段。
  • 两种入口的单图 input_reference 与多图 input_references 互斥,最多 6 张,同一请求全部参考图合计(按解码后的文件字节)不超过 30 MiB;每次创建需提供 Idempotency-Key。异步任务通过 /v1/tasks/{task_id} 查询结果。
同步示例 · 异步示例

Seedream 5.0 Pro

seedream-5.0-pro 通过 POST /v1/images/generations/async 创建异步图片任务。 提交成功后使用返回的任务 ID 查询 /v1/tasks/{task_id},直到状态进入成功或退款终态。

  • 自适应输出:size 可传 1K、2K、4K;这三种写法不保证一个固定画幅。
  • 严格指定画幅:把 size 写成精确的 宽x高,例如 2560x1440。总像素必须在 1,048,576 到 16,777,216 之间,宽高比必须在 1:16 到 16:1 之间(含边界)。
  • 官方常用推荐尺寸包括:1:1 的 2048x2048;4:3 / 3:4 的 2304x1728 / 1728x2304;3:2 / 2:3 的 2496x1664 / 1664x2496;16:9 / 9:16 的 2560x1440 / 1440x2560;21:9 / 9:21 的 3024x1296 / 1296x3024。合法范围内的其他精确尺寸同样支持。
  • 输出计费:精确尺寸总像素不超过 2,610,000 时每张 300,000 积分,超过时每张 600,000 积分;自适应 1K 为 300,000,2K、4K 为 600,000。
  • 无参考图或 1 张参考图不加价;从第 2 张起,每增加 1 张加收 20,000 积分,最多 6 张。
  • 纯文生图:不要传 input_reference 或 input_references。
  • 参考图编辑:先通过普通参考素材上传接口取得已激活的 asset://ref_...,单图使用 input_reference,多图使用 input_references。
  • 局部修改:当前不支持独立 mask 遮罩字段。请先在参考图上画框、箭头或涂写标注,再在提示词中说明只修改标注区域。
  • 当前不提供图层分离;如需人物、背景或商品分层,请在客户侧另行处理。
  • 当前固定 n=1、response_format=url、output_format=png,可选 watermark。

Seedance 输入模式

Seedance 当前分为两套输入契约:2.0 系列保留兼容模式,2.5 使用更精简的文生视频和全能生视频模式。 两套契约不要混用。

Seedance 2.0 系列:seedance-2.0、seedance-2.0-fast 和 seedance-2.0-mini使用同一套输入模式。mode 保持可选:有明确首尾帧或多模态参考意图时显式选择; 没有此类需求时,现有请求无需修改。

能力客户边界
模式选择mode 可选;有明确首尾帧或多模态意图时显式传值,没有此类需求时可以继续不传,现有请求无需修改。
首尾帧mode=frames2video,只传 1 到 2 张图片;两张时严格按数组顺序解释为首帧、尾帧。
多模态参考mode=mixed2video,可组合图片、视频和音频;图片最多 9、视频最多 3、音频最多 3,总数最多 15。
兼容行为不传 mode 时沿用原有自动判断;特别是两张图片不会自动解释为首尾帧,而会沿用多图参考模式。
mode用途素材要求
text2video文生视频不传任何参考素材。
singleImage2video单图生视频只传 1 张参考图。
frames2video首帧 / 首尾帧生视频只传 1 到 2 张参考图;1 张表示首帧,2 张时数组第一张是首帧、第二张是尾帧。
image2video多图参考生视频只传 1 到 9 张普通参考图;图片用于主体、场景或风格参考,不表示首尾帧。
mixed2video全能 / 多模态参考生视频可组合图片、视频和音频,合计 1 到 15 个;音频不能单独使用。
  • frames2video 传两张图片时,reference_image_urls[0] 是首帧,reference_image_urls[1] 是尾帧;不要交换顺序。
  • mixed2video 可组合图片、视频和音频;音频不能单独使用,素材总数最多 15。
  • 不传 mode 时沿用旧自动判断。特别是两张图片会继续按多图参考处理,不会自动变成首尾帧; 需要首尾帧控制的客户必须显式传 frames2video。

Seedance 2.5:mode 必填,可以使用 text2video、mixed2video 或 videoEdit2video。不要传 frames2video、singleImage2video、image2video,也不要省略 mode。

能力客户边界
模式选择mode 必填,可使用 text2video、mixed2video 或 videoEdit2video。
文生视频mode=text2video,不传任何参考素材。
全能生视频mode=mixed2video,图片、视频或音频至少传一种,也可以组合使用。
视频编辑mode=videoEdit2video,必须传 1 段视频,可再传最多 30 张图片,不传音频;duration=0、aspect_ratio=adaptive。
素材上限图片最多 30 张、视频最多 10 段、音频最多 10 段,总数最多 50;每段参考视频最长 30 秒,总时长最多 30 秒。
mode用途素材要求
text2video文生视频不传任何参考素材。
mixed2video全能生视频至少传入图片、视频或音频中的一种;三类素材可以任意组合。
videoEdit2video视频编辑必须传 1 段视频,可再传最多 30 张图片,不传音频;duration=0、aspect_ratio=adaptive 表示自动。
  • text2video 不传任何参考素材。
  • mixed2video 至少传图片、视频或音频中的一种;三类素材可以单独使用或任意组合。
  • videoEdit2video 必须传 1 段视频,可再传最多 30 张图片,不传音频;duration=0、aspect_ratio=adaptive 表示自动。
  • 图片最多 30 张、视频最多 10 段、音频最多 10 段,三类合计最多 50 个。
  • 参考视频按所有视频的总时长校验,合计不得超过 30 秒。

Wan 3.0

wan3.0-video 与 wan3.0-video-prime 都通过统一的视频任务接口创建异步任务。 当前账号的最终可用状态和精确价格,以携带该账号 API Key 调用 GET /v1/models 的返回为准。

模型480P(每个计费秒)720P(每个计费秒)1080P(每个计费秒)
wan3.0-video231,000 积分/秒462,000 积分/秒924,000 积分/秒
wan3.0-video-prime346,500 积分/秒693,000 积分/秒1,386,000 积分/秒
输入形态使用方式计费秒数
不含参考视频text2video 不传素材;frames2video 传 1 到 2 张首尾帧图片;mixed2video 可使用图片或图片加音频。输出时长
含参考视频使用 mixed2video 并传 reference_video_urls;可再组合图片和音频参考。输出时长 + 参考视频总时长
  • 输出时长为 2 到 30 秒,支持 480P、720P、1080P。
  • 画幅支持 adaptive、16:9、4:3、1:1、3:4、9:16,每次固定生成 1 条视频。
  • text2video 不传参考素材;frames2video 传 1 到 2 张首尾帧图片;mixed2video 可组合图片、视频和音频。
  • 最多 10 张图片、5 段视频、5 段音频,三类合计最多 15 个参考素材。
  • 每段参考视频为 1 到 15 秒,参考视频总时长不超过 15 秒,参考视频总时长加输出时长不超过 30 秒。
  • 不含参考视频:费用 = 输出时长 × 对应模型和分辨率的每计费秒单价。
  • 含参考视频:费用 =(输出时长 + 参考视频总时长)× 对应模型和分辨率的每计费秒单价。
  • 图片和音频参考本身不增加时长费用;是否生成声音也不改变单价。
  • 例如 480P 输出 2 秒且不含参考视频,标准版为 462,000 积分,Prime 为 693,000 积分。
  • 例如 480P 输出 2 秒并使用 5 秒参考视频,共按 7 秒计费:标准版为 1,617,000 积分,Prime 为 2,425,500 积分。

MiniMax H3

minimax-h3 使用统一的视频任务接口。以下能力、输入模式、素材限制和计费规则构成完整客户契约; 当前账号是否可用以及精确单价,始终以携带该账号 API Key 调用 GET /v1/models 的返回为准。

能力客户边界
输出规格支持 768P、2K,支持 5 到 15 秒。
画幅adaptive、21:9、16:9、4:3、1:1、3:4、9:16。
生成数量count 支持 1、2、4;素材输入和费用按 count 共同乘算。
参考图最多 9 张。
参考视频最多 3 段;每段 2 到 15 秒,总时长不超过 15 秒。
参考音频最多 3 段,只支持 MP3/WAV,必须同时提供图片或视频参考。
混合素材总数图片、视频和音频合计最多 15 个。
mode用途素材要求
text2video文生视频不传参考素材。
singleImage2video单图生视频传 1 张参考图,aspect_ratio 必须为 adaptive。
frames2video首尾帧生视频传 1 到 2 张参考图,aspect_ratio 必须为 adaptive。
mixed2video全能参考生视频可组合图片、视频和音频;音频不能单独使用。
  • 参考图片、视频和音频都先上传到 /v1/assets/references/upload,任务中使用当前账号获得的 asset_uri。
  • 参考视频时长从上传后记录的可信素材元数据读取,客户不需要额外填写时长。
  • 费用公式为:count ×(输出秒数 × 输出每秒单价 + 参考视频总秒数 × 输入每秒单价)。
  • 图片和音频参考本身不增加每秒费用;参考视频输入按实际总秒数计费。
  • 请求会在任务创建、扣费和提交生成服务前校验素材数量、组合方式和参考视频时长。

参考素材规则

Seedance 系列、Wan 3.0、happy-horse-1.1 和 minimax-h3 的参考素材统一使用普通参考素材流程。 图片、视频和音频分别使用 reference_image_urls、reference_video_urls 和reference_audio_urls。

  • 不上传任何参考素材时按文生视频生成;普通产品、场景、故事板图片使用 reference_image_urls。
  • happy-horse-1.1 只接受图片参考,不接受视频或音频参考;首帧模式只能传 1 张,参考图模式可传 1 到 9 张。
  • 所有图片参考先上传到 /v1/assets/references/upload,字段 kind=image,任务里使用当前账号返回的 asset://ref_...。
  • 旧真人素材库中的素材和 portrait URI 不能直接复用;即使素材属于当前账号,也必须重新上传原始图片。
  • /v1/assets/portraits/upload、face_reference_url 和 image_reference_url 只适用于input_schema 明确仍支持真人素材的旧模型,不适用于当前 Seedance 2.0 系列和 Seedance 2.5。
  • Studio 选择不兼容旧真人素材的当前模型时会禁用旧真人素材,并引导通过普通参考素材接口重新上传。
  • 视频参考和音频参考使用 /v1/assets/references/upload,生成任务里使用返回的asset_uri;音频文件仅支持 MP3 和 WAV。是否允许音频单独使用取决于具体模型模式。
  • minimax-h3 的参考视频每段必须为 2 到 15 秒,总时长不得超过 15 秒;不满足时会在创建任务和扣费前拒绝。
  • 平台生成成功的视频会在任务详情里返回 output.generated_reference_uri;同一账号可把这个值放入下一次 reference_video_urls,用于复用平台已生成的视频参考。
  • Seedance 2.0 系列最多 9 张图片、3 段视频、3 段音频,总数不超过 15;音频必须与图片或视频同时使用,参考视频最长 15 秒。
  • Seedance 2.5 最多 30 张图片、10 段视频、10 段音频,总数不超过 50;每段参考视频最长 30 秒,总时长不超过 30 秒。
  • Wan 3.0 两个版本最多 10 张图片、5 段视频、5 段音频,总数不超过 15;每段参考视频为 1 到 15 秒,总时长不超过 15 秒。
  • 同一字段内不得重复 URI;所有数量、组合和时长限制都在创建任务和扣费前校验。
  • 平台不会在任务详情或 Webhook 中返回生成服务的临时下载地址。
  • 如果素材缺失、过期或跨账号,平台返回 400 validation_error;如果素材来源与模型不兼容,返回不可重试的 400 asset_provider_incompatible。这些错误发生在计费和入队前。
POST/v1/assets/references/upload

上传普通图片参考

上传产品、场景、故事板等普通图片参考,再把返回的 asset_uri 放入 reference_image_urls。平台会在提交上游前校验归属与有效期。

curl https://api.example.com/v1/assets/references/upload \
  -H "Authorization: Bearer sk_live_xxx" \
  -F "kind=image" \
  -F "file=@./product-reference.png"

# 成功响应示例
{
  "id": "ref_xxx",
  "object": "reference.asset",
  "kind": "image",
  "asset_uri": "asset://ref_xxx",
  "status": "active",
  "mime_type": "image/png",
  "size_bytes": 123456,
  "created_at": "2026-06-26T08:00:00.000Z"
}
POST/v1/assets/references/upload

上传视频/音频参考素材

上传视频或 MP3/WAV 音频参考文件,再把返回的 asset_uri 放入对应字段。视频参考当前支持带可读时长的 MP4/MOV。

curl https://api.example.com/v1/assets/references/upload \
  -H "Authorization: Bearer sk_live_xxx" \
  -F "kind=video" \
  -F "file=@./motion-reference.mp4"

curl https://api.example.com/v1/assets/references/upload \
  -H "Authorization: Bearer sk_live_xxx" \
  -F "kind=audio" \
  -F "file=@./audio-reference.mp3"

# 视频成功响应示例
{
  "id": "ref_video_xxx",
  "object": "reference.asset",
  "kind": "video",
  "asset_uri": "asset://ref_video_xxx",
  "status": "active",
  "mime_type": "video/mp4",
  "size_bytes": 1234567,
  "duration_seconds": 6,
  "created_at": "2026-06-26T08:00:00.000Z"
}
POST/v1/images/generations

图片生成

创建同步图片生成任务。成功响应会返回 base64 图片内容,客户侧可保存为图片文件。

curl https://api.example.com/v1/images/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: image-order-20260703-0001" \
  -d '{
  "model": "image-2-pro",
  "prompt": "一张干净的产品主图,白色背景,柔和自然光。",
  "size": "1024x1024",
  "n": 1,
  "response_format": "b64_json"
}'
POST/v1/images/generations/async

Image2 Pro 异步图片生成

必须提供 Idempotency-Key。省略参考字段为文生图;单图或多图参考只能使用上传后属于当前账号的 asset://ref_...。默认且仅支持 response_format=url。

curl https://api.example.com/v1/images/generations/async \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: image-async-20260906-0001" \
  -d '{
  "model": "image-2-pro",
  "prompt": "一张白色背景的产品图片",
  "size": "1024x1024"
}'
POST/v1/images/generations

图片参考改图

提交 1 到 6 张图片参考和提示词,生成保持参考图主体、构图或风格的新图片。参考图建议使用公网 HTTPS 图片 URL。

curl https://api.example.com/v1/images/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: image-order-20260703-0002" \
  -d '{
  "model": "image-2-pro",
  "prompt": "综合参考图主体和风格,调整为高端商业摄影质感。",
  "size": "2160x3840",
  "input_references": [
    "https://client.example.com/reference-1.png",
    "https://client.example.com/reference-2.jpg"
  ],
  "n": 1,
  "response_format": "b64_json"
}'
POST/v1/images/generations

Nano Banana 图片生成

Nano Banana 使用 image_size 和 aspect_ratio 选择输出规格。当前支持 Flash 和 Pro 两档。

curl https://api.example.com/v1/images/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-order-20260708-0001" \
  -d '{
  "model": "nano-banana-flash",
  "prompt": "一张高质感产品海报,柔和灯光,干净背景。",
  "image_size": "2K",
  "aspect_ratio": "9:16",
  "n": 1,
  "response_format": "b64_json"
}'
POST/v1/images/generations

Nano Banana 图片参考编辑

提交 1 到 6 张图片参考,平台会转为上游支持的图片内容格式。

curl https://api.example.com/v1/images/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-order-20260708-0002" \
  -d '{
  "model": "nano-banana-pro",
  "prompt": "保持参考图产品外观一致,生成高端电商详情页场景图。",
  "image_size": "4K",
  "aspect_ratio": "3:4",
  "input_references": [
    "https://client.example.com/product-reference.png"
  ],
  "n": 1,
  "response_format": "b64_json"
}'
POST/v1/images/generations/async

Seedream 5.0 Pro 异步图片生成

示例用 size=2560x1440 严格指定 16:9,并使用一张已上传且激活的普通参考图;纯文生图时删除 input_references 字段。

curl https://api.example.com/v1/images/generations/async \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedream-5-pro-order-20260822-0001" \
  -d '{
  "model": "seedream-5.0-pro",
  "prompt": "保留参考图主体与构图,只修改标注区域内的商品颜色。",
  "size": "2560x1440",
  "n": 1,
  "response_format": "url",
  "output_format": "png",
  "watermark": false,
  "input_references": [
    "asset://ref_image_xxx"
  ]
}'
POST/v1/video/generations

提交视频任务

创建异步视频生成任务。成功时返回 202 Accepted 和任务 ID。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-20260510-0001" \
  -d '{
  "model": "seedance-2.0",
  "prompt": "基于产品参考图生成一段自然柔光下的展示视频。",
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_audio_urls": [
    "asset://ref_audio_mp3_xxx"
  ],
  "duration": 5,
  "aspect_ratio": "9:16",
  "resolution": "720p",
  "count": 1,
  "mode": "mixed2video",
  "generate_audio": true,
  "search_enabled": true,
  "callback_url": "https://client.example.com/webhooks/seeapi"
}'
POST/v1/video/generations

Seedance 首尾帧生视频

显式使用 frames2video。传两张图片时,数组第一张是首帧、第二张是尾帧;只传一张时表示首帧控制。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedance-frames-order-20260807-0001" \
  -d '{
  "model": "seedance-2.0-mini",
  "prompt": "从首帧自然运动到尾帧,保持人物、服装和场景连续。",
  "reference_image_urls": [
    "asset://ref_first_frame_xxx",
    "asset://ref_last_frame_xxx"
  ],
  "duration": 4,
  "aspect_ratio": "9:16",
  "resolution": "480p",
  "count": 1,
  "mode": "frames2video",
  "generate_audio": false
}'
POST/v1/video/generations

Seedance 多模态参考生视频

显式使用 mixed2video,可按需组合图片、视频和音频;不使用的素材字段直接删除。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedance-mixed-order-20260807-0001" \
  -d '{
  "model": "seedance-2.0-mini",
  "prompt": "综合图片主体、视频动作和音频节奏生成连续镜头。",
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_audio_urls": [
    "asset://ref_audio_xxx"
  ],
  "duration": 4,
  "aspect_ratio": "9:16",
  "resolution": "480p",
  "count": 1,
  "mode": "mixed2video",
  "generate_audio": true
}'
POST/v1/video/generations

Seedance 2.5 文生视频

model 使用 seedance-2.5,mode 必须为 text2video,并且不传任何参考素材字段。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedance-25-text-order-20260814-0001" \
  -d '{
  "model": "seedance-2.5",
  "prompt": "生成一段自然光下的城市街景镜头,运镜平稳,画面连续。",
  "duration": 12,
  "aspect_ratio": "16:9",
  "resolution": "720p",
  "count": 1,
  "mode": "text2video",
  "generate_audio": true,
  "search_enabled": true
}'
POST/v1/video/generations

Seedance 2.5 全能生视频

mode 必须为 mixed2video;图片、视频或音频至少传一种,也可以任意组合。不使用的素材字段直接删除。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedance-25-mixed-order-20260814-0001" \
  -d '{
  "model": "seedance-2.5",
  "prompt": "综合参考素材中的主体、动作和音乐节奏,生成风格统一的连续镜头。",
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_audio_urls": [
    "asset://ref_audio_xxx"
  ],
  "duration": 12,
  "aspect_ratio": "16:9",
  "resolution": "720p",
  "count": 1,
  "mode": "mixed2video",
  "generate_audio": true,
  "search_enabled": true
}'
POST/v1/video/generations

Seedance 2.5 视频编辑

mode 使用 videoEdit2video;必须传 1 段视频,可再传最多 30 张图片,不传音频。duration=0、aspect_ratio=adaptive 表示自动。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedance-25-edit-order-20260814-0001" \
  -d '{
  "model": "seedance-2.5",
  "prompt": "保持原视频主体和动作连续性,按参考图片调整整体视觉风格。",
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "duration": 0,
  "aspect_ratio": "adaptive",
  "resolution": "720p",
  "count": 1,
  "mode": "videoEdit2video",
  "generate_audio": true,
  "search_enabled": true
}'
POST/v1/video/generations

MiniMax H3 全能参考生视频

完整示例同时使用图片、视频和音频参考;不需要的素材字段可以删除,但 mode 必须与实际素材组合一致。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: minimax-h3-order-20260804-0001" \
  -d '{
  "model": "minimax-h3",
  "prompt": "保持人物、服装和场景一致,生成自然连续的电影感动作。",
  "duration": 8,
  "aspect_ratio": "16:9",
  "resolution": "768P",
  "count": 1,
  "mode": "mixed2video",
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_audio_urls": [
    "asset://ref_audio_xxx"
  ],
  "callback_url": "https://client.example.com/webhooks/seeapi"
}'
POST/v1/video/generations

Wan 3.0 不含参考视频

Prime 纯文生视频最小请求,只按输出时长计费。使用标准版时把 model 改为 wan3.0-video;每次请求都使用新的 Idempotency-Key。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: wan30-prime-order-20260827-0001" \
  -d '{
  "model": "wan3.0-video-prime",
  "prompt": "生成一段具有电影感的城市夜景推进镜头,运动自然、画面稳定。",
  "duration": 2,
  "aspect_ratio": "16:9",
  "resolution": "480P",
  "count": 1,
  "mode": "text2video",
  "generate_audio": false
}'
POST/v1/video/generations

Wan 3.0 含参考视频

含视频输入时使用 mixed2video 和 reference_video_urls;费用按输出时长加参考视频总时长计算。示例中的 asset URI 需替换为当前账号有效的视频参考素材。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: wan30-video-reference-order-20260827-0001" \
  -d '{
  "model": "wan3.0-video",
  "prompt": "参考已有视频的镜头运动和节奏,生成一段新的城市夜景镜头。",
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "duration": 2,
  "aspect_ratio": "16:9",
  "resolution": "480P",
  "count": 1,
  "mode": "mixed2video",
  "generate_audio": false
}'
POST/v1/video/generations

复用已生成视频作为参考

任务 succeeded 后,从 /v1/tasks/{task_id} 的 output.generated_reference_uri 取值,放入下一次 reference_video_urls。同一账号、成功任务且可复用的视频才会通过校验。

curl https://api.example.com/v1/video/generations \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-20260510-0002" \
  -d '{
  "model": "seedance-2.0",
  "prompt": "延续上一条视频的动作节奏,生成同风格的新镜头。",
  "reference_video_urls": [
    "asset://generated-video/job_xxx"
  ],
  "duration": 5,
  "aspect_ratio": "9:16",
  "resolution": "720p"
}'
POST/v1/videos

Grok 图片参考生视频

preview 要求单张图片参考;preview-pro 要求 1–7 张图片参考,不支持纯文生视频。两者都支持横竖 720P 和 1–15 秒任意整数。

curl https://api.example.com/v1/videos \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: video-order-20260703-0001" \
  -d '{
  "model": "grok-imagine-video-1.5-preview",
  "prompt": "让参考图中的画面产生轻微电影感推进,保持自然、简洁。",
  "input_reference": "https://client.example.com/reference.png",
  "seconds": 4,
  "size": "1280x720"
}'
POST/v1/chat/completions

流式对话

为已开通 GPT 文本模型的账户创建对话响应,支持文字和图片输入。传 stream: true 时会返回 text/event-stream;视频、音频和通用文件会本地拒绝且不扣费。

curl -N https://api.example.com/v1/chat/completions \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: chat-order-20260704-0001" \
  -d '{
  "model": "gpt-5.5",
  "messages": [
    {
      "role": "user",
      "content": "请把这段产品介绍改写成更适合短视频口播的版本。"
    }
  ],
  "max_completion_tokens": 800,
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}'

图片尺寸

下表由 Image2 Contract Hub 生成,与 Registry seed、管理员配置校验和 /v1/models 使用同一份尺寸定义。 线上实际可用值仍以当前账号从 /v1/models 取得的激活结果为准。

model1K 方图1K 横屏1K 竖屏2K 方图2K 横屏2K 竖屏4K 横屏4K 竖屏
image-2-pro1024x10241536x864、1360x1024、1536x1024864x1536、1024x1360、1024x15362048x20483072x1728、2720x2048、3072x20481728x3072、2048x2720、2048x30723840x2160、3264x2448、3520x23362160x3840、2448x3264、2336x3520
image-2.51024x10241536x864、1360x1024、1536x1024864x1536、1024x1360、1024x15362048x20483072x1728、2720x2048、3072x20481728x3072、2048x2720、2048x30723840x2160、3264x2448、3520x23362160x3840、2448x3264、2336x3520

Nano Banana 使用 image_size 和 aspect_ratio,不使用 Image2 的 size 字段。nano-banana-flash 和 nano-banana-pro 当前支持同一组规格。

image_size1:116:99:164:33:43:22:3
1K1024x10241536x864864x15361360x10241024x13601536x10241024x1536
2K2048x20483072x17281728x30722720x20482048x27203072x20482048x3072
4K2880x28803840x21602160x38403328x24962496x33283520x23362336x3520

图片参考素材

项目边界
格式PNG、JPEG/JPG、WebP。
数量Image2、Nano Banana 和 Seedream 5.0 Pro 支持 1 到 6 张;Grok preview 支持 1 张,preview-pro 支持 1 到 7 张。
Image2 HTTPS URL推荐方式。URL 必须公网可访问,不能是内网地址、需要登录的地址、带账号密码的地址或过期签名地址;同一请求的所有参考图合计(按解码后的文件字节)不超过 30 MiB。平台按当前适配链路处理,客户请求格式保持稳定。
Seedream 5.0 Pro仅接受已激活的 PNG/JPEG 普通参考素材 asset://ref_...;单图用 input_reference,多图用 input_references,两个字段不能同时传,且不能重复引用同一素材。
其他图片模型 HTTPS URLURL 必须公网可访问;具体数量与体积限制以对应模型契约为准。
Grok HTTPS URLURL 会随请求提交给图片参考生视频服务。请使用非敏感、可公开访问的 HTTPS 图片 URL,不要使用私有地址、登录态 URL 或带敏感签名参数的 URL。
Base64 data URL仅建议用于 700 KB 以内的小图,格式为 data:image/png;base64,...、data:image/jpeg;base64,... 或 data:image/webp;base64,...。较大图片请压缩或改用 HTTPS URL,否则可能返回 413。

视频任务字段

字段要求说明
model必填当前视频生成模型包括 seedance-2.0、seedance-2.0-fast、seedance-2.0-mini、seedance-2.5、wan3.0-video、wan3.0-video-prime、happy-horse-1.1 与 minimax-h3;最终以鉴权后的 /v1/models 为准。
prompt必填视频提示词,1 到 4000 字符。
reference_image_urls可选图片参考数组。seedance-2.5 最多 30 张,Wan 3.0 最多 10 张,其他当前视频模型最多 9 张。均使用当前账号有效的普通参考素材 asset_uri;旧真人素材库及 portrait URI 不能直接复用。纯文生视频可不传。
reference_video_urls可选视频参考数组。seedance-2.5 最多 10 个且总时长不超过 30 秒;Wan 3.0 最多 5 个且总时长不超过 15 秒;其他当前视频模型最多 3 个。使用当前账号有效的参考素材 asset_uri,或同账号成功任务的 output.generated_reference_uri。MiniMax H3 要求每段 2 到 15 秒且总时长不超过 15 秒。
reference_audio_urls可选音频参考数组。seedance-2.5 最多 10 个,Wan 3.0 最多 5 个,其他当前视频模型最多 3 个。仅接受 MP3 或 WAV,并使用当前账号有效的参考素材 asset_uri。
duration必填seedance-2.5 的文生/全能模式支持 4 到 30 秒,视频编辑模式固定传 0 表示自动;Wan 3.0 支持 2 到 30 秒;Seedance 2.0 系列支持 4 到 15 秒;happy-horse-1.1 支持 3 到 15 秒;minimax-h3 支持 5 到 15 秒。
aspect_ratio必填Wan 3.0 支持 adaptive、16:9、4:3、1:1、3:4、9:16;Seedance 系列和 minimax-h3 支持七种画幅;happy-horse-1.1 支持 16:9、9:16、1:1、4:3、3:4。
resolution必填Wan 3.0 支持 480P、720P、1080P;seedance-2.0 支持 480p、720p、1080p、4k;Fast、Mini 支持 480p、720p;seedance-2.5 支持 480p、720p、1080p;happy-horse-1.1 支持 720p、1080p;minimax-h3 支持 768P、2K。
count可选Wan 3.0 与 happy-horse-1.1 固定为 1;Seedance 系列和 minimax-h3 支持 1、2、4。
mode按模型seedance-2.5 必须传 text2video、mixed2video 或 videoEdit2video;Seedance 2.0 系列可省略,有明确首尾帧意图时传 frames2video,有图片/视频/音频组合意图时传 mixed2video。Wan 3.0 使用 text2video、frames2video 或 mixed2video。MiniMax H3 的完整边界见本页独立章节。
generate_audio按模型Seedance 系列和 Wan 3.0 可选择是否生成声音,默认 true;未在模型 input_schema 中声明时不要传。
search_enabled按模型Seedance 系列可启用搜索增强,默认 true;未在模型 input_schema 中声明时不要传。
callback_url可选接收任务 Webhook 通知的地址。当前 MVP 稳定投递成功事件;生产环境请使用 HTTPS。

图片任务字段

字段要求说明
model必填使用 image-2-pro 或 image-2.5;实际可见模型以 GET /v1/models 为准。
prompt必填图片提示词,1 到 4000 字符。
size必填请求尺寸使用当前模型契约列出的精确值;生成结果的实际宽高可能由模型微调,以返回图像为准。
input_reference图生图可选旧版单图字段;不要和 input_references 同时传。
input_references图生图可选1 到 6 张;数组内只能全部为 HTTPS URL 或全部为 Base64 data URL;同一请求全部参考图解码后合计不超过 30 MiB。
n可选当前固定为 1。
response_format可选b64_json(默认)或 url。url 返回 seeAPI 托管的短期签名地址,不暴露供应商原始地址。
output_format可选image-2-pro:jpeg 或 png,默认 jpeg;image-2.5:仅 png,默认 png。
quality可选当前固定为 auto。
moderation可选当前固定为 auto。
image_sizeNano Banana 必填Nano Banana 尺寸档位,当前支持 1K、2K、4K。
aspect_ratioNano Banana 必填Nano Banana 画幅比例,当前支持 1:1、16:9、9:16、4:3、3:4、3:2、2:3。

图片参考生视频字段

字段要求说明
model必填推荐使用 grok-imagine-video-1.5-preview 或 grok-imagine-video-1.5-preview-pro;旧 grok-imagine-video 仅作兼容入口。
prompt必填视频提示词,1 到 4000 字符。
input_reference条件必填两个模型都不支持纯文生视频。preview 必须传 1 张图;preview-pro 传 1 张图时可用 input_reference,传 1 到 7 张图时可用 input_references,两个字段不能同时传。推荐使用非敏感、可公开访问的 HTTPS 图片 URL。Base64 data URL 只建议用于 700 KB 以内的小图。
seconds必填两个新模型支持 1 到 15 秒任意整数;旧兼容入口仍为 4 到 15 秒。
size必填当前支持 1280x720 和 720x1280。
callback_url可选接收任务 Webhook 通知的地址;生产环境请使用 HTTPS。

流式对话字段

字段要求说明
model必填受邀账户当前可用 gpt-5.5;以 /v1/models 返回为准。
messages必填对话消息数组,支持 system、developer、user、assistant 角色;用户内容支持文字和图片。
max_completion_tokens必填本次回复最大输出 token 数;也可使用兼容字段 max_tokens。
temperature可选0 到 2 的采样温度。
stream推荐传 true 时返回 text/event-stream,客户侧可边接收边展示。
stream_options可选建议传 { include_usage: true },便于平台按上游最终 usage 做结算。
不支持固定GPT 对话不支持视频、音频或通用文件输入;此类请求会在本地 400 拒绝且不扣费。
GET/v1/tasks/{task_id}

查询任务

轮询任务状态,直到进入 succeeded、refunded、failed 或 canceled。

curl https://api.example.com/v1/tasks/job_xxx \
  -H "Authorization: Bearer sk_live_xxx"

# 成功响应示例
{
  "id": "job_xxx",
  "object": "task",
  "status": "succeeded",
  "model": "seedance-2.0",
  "output": {
    "video_url": "https://cdn.example.com/users/usr_xxx/jobs/job_xxx/output/video.mp4",
    "generated_reference_uri": "asset://generated-video/job_xxx",
    "assets": [
      {
        "type": "output_video",
        "url": "https://cdn.example.com/users/usr_xxx/jobs/job_xxx/output/video.mp4",
        "mime_type": "video/mp4",
        "size_bytes": "12345678",
        "checksum": "sha256:..."
      }
    ]
  },
  "error": null,
  "cost": {
    "estimated_units": 1234567,
    "charged_units": 1234567,
    "refunded_units": 0,
    "currency": "credits"
  },
  "created_at": "2026-05-10T08:00:00.000Z",
  "finished_at": "2026-05-10T08:01:00.000Z"
}

任务状态

状态含义
created任务已持久化,等待入队;提交响应中会按 queued 展示。
queued已进入队列,等待 Worker 处理。
running正在生成或等待结果回传。
succeeded任务成功,余额正式结算,output 中返回平台存储后的结果地址。
failed任务失败的中间状态;Worker 会继续执行退款流程。
refunded任务失败或取消后已退款,cost.refunded_units 展示退款数量。
canceled任务已取消;如果已预扣,后续会进入退款流程。
GET/v1/models

模型列表

返回当前账户可调用的模型和输入能力 schema;示例为响应节选。

curl https://api.example.com/v1/models \
  -H "Authorization: Bearer sk_live_xxx"

# 响应示例
{
  "object": "list",
  "data": [
    {
      "id": "seedance-2.0",
      "object": "model",
      "code": "seedance-2.0",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "duration", "aspect_ratio", "resolution"],
        "properties": {
          "duration": { "enum": [4, 5, 6, "...", 15] },
          "resolution": { "enum": ["480p", "720p", "1080p", "4k"] },
          "aspect_ratio": { "enum": ["adaptive", "16:9", "4:3", "1:1", "3:4", "9:16", "21:9"] },
          "count": { "enum": [1, 2, 4], "default": 1 },
          "mode": { "enum": ["text2video", "singleImage2video", "frames2video", "image2video", "mixed2video"] },
          "generate_audio": { "type": "boolean", "default": true },
          "search_enabled": { "type": "boolean", "default": true },
          "reference_image_urls": { "type": "array", "maxItems": 9 },
          "reference_video_urls": { "type": "array", "maxItems": 3 },
          "reference_audio_urls": { "type": "array", "maxItems": 3, "description": "MP3 or WAV; requires an image or video reference" }
        }
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "seedance-2.0-fast",
      "object": "model",
      "code": "seedance-2.0-fast",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "duration", "aspect_ratio", "resolution"],
        "properties": {
          "duration": { "enum": [4, 5, 6, "...", 15] },
          "resolution": { "enum": ["480p", "720p"] },
          "count": { "enum": [1, 2, 4], "default": 1 },
          "generate_audio": { "type": "boolean", "default": true },
          "search_enabled": { "type": "boolean", "default": true }
        }
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "happy-horse-1.1",
      "object": "model",
      "code": "happy-horse-1.1",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "duration", "aspect_ratio", "resolution"],
        "properties": {
          "duration": { "enum": [3, 4, 5, "...", 15] },
          "resolution": { "enum": ["720p", "1080p"] },
          "aspect_ratio": { "enum": ["16:9", "9:16", "1:1", "4:3", "3:4"] },
          "count": { "enum": [1], "default": 1 },
          "mode": { "enum": ["text2video", "frames2video", "image2video"] },
          "reference_image_urls": { "type": "array", "maxItems": 9 }
        }
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "minimax-h3",
      "object": "model",
      "code": "minimax-h3",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "duration", "aspect_ratio", "resolution"],
        "properties": {
          "duration": { "enum": [5,6,7,8,9,10,11,12,13,14,15] },
          "resolution": { "enum": ["768P","2K"] },
          "aspect_ratio": { "enum": ["adaptive","21:9","16:9","4:3","1:1","3:4","9:16"] },
          "count": { "enum": [1,2,4], "default": 1 },
          "mode": { "enum": ["text2video","singleImage2video","frames2video","mixed2video"] },
          "reference_image_urls": { "type": "array", "maxItems": 9 },
          "reference_video_urls": { "type": "array", "maxItems": 3 },
          "reference_audio_urls": { "type": "array", "maxItems": 3, "description": "MP3 or WAV; requires an image or video reference" }
        }
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "image-2-pro",
      "object": "model",
      "code": "image-2-pro",
      "owned_by": "seeapi",
      "modality": "image",
      "execution_mode": "sync",
      "input_schema": {
      "oneOf": [
            {
                  "type": "object",
                  "required": [
                        "model",
                        "prompt",
                        "size"
                  ],
                  "properties": {
                        "model": {
                              "const": "image-2-pro"
                        },
                        "prompt": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                        },
                        "n": {
                              "type": "integer",
                              "enum": [
                                    1
                              ],
                              "default": 1
                        },
                        "response_format": {
                              "type": "string",
                              "enum": [
                                    "b64_json",
                                    "url"
                              ],
                              "default": "b64_json"
                        },
                        "output_format": {
                              "type": "string",
                              "enum": [
                                    "jpeg",
                                    "png"
                              ],
                              "default": "jpeg"
                        },
                        "quality": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "moderation": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "size": {
                              "type": "string",
                              "enum": [
                                    "1024x1024",
                                    "1536x864",
                                    "1360x1024",
                                    "1536x1024",
                                    "864x1536",
                                    "1024x1360",
                                    "1024x1536",
                                    "2048x2048",
                                    "3072x1728",
                                    "2720x2048",
                                    "3072x2048",
                                    "1728x3072",
                                    "2048x2720",
                                    "2048x3072",
                                    "3840x2160",
                                    "3264x2448",
                                    "3520x2336",
                                    "2160x3840",
                                    "2448x3264",
                                    "2336x3520"
                              ]
                        }
                  },
                  "additionalProperties": false
            },
            {
                  "type": "object",
                  "required": [
                        "model",
                        "prompt",
                        "size",
                        "input_reference"
                  ],
                  "properties": {
                        "model": {
                              "const": "image-2-pro"
                        },
                        "prompt": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                        },
                        "n": {
                              "type": "integer",
                              "enum": [
                                    1
                              ],
                              "default": 1
                        },
                        "response_format": {
                              "type": "string",
                              "enum": [
                                    "b64_json",
                                    "url"
                              ],
                              "default": "b64_json"
                        },
                        "output_format": {
                              "type": "string",
                              "enum": [
                                    "jpeg",
                                    "png"
                              ],
                              "default": "jpeg"
                        },
                        "quality": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "moderation": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "size": {
                              "type": "string",
                              "enum": [
                                    "1024x1024",
                                    "1536x864",
                                    "1360x1024",
                                    "1536x1024",
                                    "864x1536",
                                    "1024x1360",
                                    "1024x1536",
                                    "2048x2048",
                                    "3072x1728",
                                    "2720x2048",
                                    "3072x2048",
                                    "1728x3072",
                                    "2048x2720",
                                    "2048x3072",
                                    "3840x2160",
                                    "3264x2448",
                                    "3520x2336",
                                    "2160x3840",
                                    "2448x3264",
                                    "2336x3520"
                              ]
                        },
                        "input_reference": {
                              "anyOf": [
                                    {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 29360128,
                                          "pattern": "^data:image\\/(png|jpeg|jpg|webp);base64,[A-Za-z0-9+/]+={0,2}$"
                                    },
                                    {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4096,
                                          "format": "uri",
                                          "pattern": "^https:\\/\\/.+"
                                    }
                              ]
                        }
                  },
                  "additionalProperties": false
            },
            {
                  "type": "object",
                  "required": [
                        "model",
                        "prompt",
                        "size",
                        "input_references"
                  ],
                  "properties": {
                        "model": {
                              "const": "image-2-pro"
                        },
                        "prompt": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                        },
                        "n": {
                              "type": "integer",
                              "enum": [
                                    1
                              ],
                              "default": 1
                        },
                        "response_format": {
                              "type": "string",
                              "enum": [
                                    "b64_json",
                                    "url"
                              ],
                              "default": "b64_json"
                        },
                        "output_format": {
                              "type": "string",
                              "enum": [
                                    "jpeg",
                                    "png"
                              ],
                              "default": "jpeg"
                        },
                        "quality": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "moderation": {
                              "type": "string",
                              "enum": [
                                    "auto"
                              ],
                              "default": "auto"
                        },
                        "size": {
                              "type": "string",
                              "enum": [
                                    "1024x1024",
                                    "1536x864",
                                    "1360x1024",
                                    "1536x1024",
                                    "864x1536",
                                    "1024x1360",
                                    "1024x1536",
                                    "2048x2048",
                                    "3072x1728",
                                    "2720x2048",
                                    "3072x2048",
                                    "1728x3072",
                                    "2048x2720",
                                    "2048x3072",
                                    "3840x2160",
                                    "3264x2448",
                                    "3520x2336",
                                    "2160x3840",
                                    "2448x3264",
                                    "2336x3520"
                              ]
                        },
                        "input_references": {
                              "oneOf": [
                                    {
                                          "type": "array",
                                          "minItems": 1,
                                          "maxItems": 6,
                                          "items": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 29360128,
                                                "pattern": "^data:image\\/(png|jpeg|jpg|webp);base64,[A-Za-z0-9+/]+={0,2}$"
                                          }
                                    },
                                    {
                                          "type": "array",
                                          "minItems": 1,
                                          "maxItems": 6,
                                          "items": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4096,
                                                "format": "uri",
                                                "pattern": "^https:\\/\\/.+"
                                          }
                                    }
                              ]
                        }
                  },
                  "additionalProperties": false
            }
      ]
},
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "seedream-5.0-pro",
      "object": "model",
      "code": "seedream-5.0-pro",
      "owned_by": "seeapi",
      "modality": "image",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt"],
        "properties": {
          "size": { "type": "string", "pattern": "^(?:1K|2K|4K|[1-9][0-9]{0,4}x[1-9][0-9]{0,4})$", "default": "2K" },
          "n": { "enum": [1], "default": 1 },
          "response_format": { "enum": ["url"], "default": "url" },
          "output_format": { "enum": ["png"], "default": "png" },
          "watermark": { "type": "boolean", "default": false },
          "input_reference": { "type": "string", "description": "one active asset://ref_... image" },
          "input_references": { "type": "array", "minItems": 1, "maxItems": 6, "description": "active asset://ref_... images" }
        }
      },
      "pricing_rule": {
        "type": "fixed_by_size_and_reference_count_tier",
        "currency": "credits",
        "unit": "credit_units",
        "prices": {
          "1K": { "retail": 300000 },
          "2K": { "retail": 600000 },
          "4K": { "retail": 600000 }
        },
        "exact_size_pixel_threshold": 2610000,
        "exact_size_prices": {
          "at_or_below_threshold": { "retail": 300000 },
          "above_threshold": { "retail": 600000 }
        },
        "additional_reference_prices": { "retail": 20000 },
        "included_reference_count": 1,
        "single_reference_field": "input_reference",
        "multiple_references_field": "input_references"
      }
    },
    {
      "id": "grok-imagine-video-1.5-preview",
      "object": "model",
      "code": "grok-imagine-video-1.5-preview",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "input_reference", "seconds", "size"],
        "properties": {
          "input_reference": { "description": "single base64 image data URL or HTTPS image URL" },
          "seconds": { "enum": [1, 2, 3, "...", 15] },
          "size": { "enum": ["1280x720", "720x1280"] }
        }
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "grok-imagine-video-1.5-preview-pro",
      "object": "model",
      "code": "grok-imagine-video-1.5-preview-pro",
      "owned_by": "seeapi",
      "modality": "video",
      "execution_mode": "async",
      "input_schema": {
        "required": ["model", "prompt", "seconds", "size"],
        "properties": {
          "input_reference": { "description": "single base64 image data URL or HTTPS image URL" },
          "input_references": { "description": "1 to 7 base64 image data URLs or HTTPS image URLs", "minItems": 1, "maxItems": 7 },
          "seconds": { "enum": [1, 2, 3, "...", 15] },
          "size": { "enum": ["1280x720", "720x1280"] }
        },
        "oneOf": [
          { "required": ["input_reference"] },
          { "required": ["input_references"] }
        ]
      },
      "pricing_rule": { "currency": "credits" }
    },
    {
      "id": "gpt-5.5",
      "object": "model",
      "code": "gpt-5.5",
      "owned_by": "seeapi",
      "modality": "text",
      "execution_mode": "sync",
      "input_modalities": ["text", "image"],
      "input_schema": {
        "required": ["model", "messages"],
        "properties": {
          "messages": { "type": "array", "description": "text and image content parts only" },
          "max_completion_tokens": { "type": "integer" },
          "stream": { "type": "boolean" }
        }
      },
      "pricing_rule": { "currency": "credits" }
    }
  ]
}
GET/v1/credits

查询余额

返回账户余额、币种和因余额不足暂停的 API Key 数量。

curl https://api.example.com/v1/credits \
  -H "Authorization: Bearer sk_live_xxx"

# 响应示例
{
  "balance_units": 12000000,
  "currency": "credits",
  "price_tier": "retail",
  "paused_api_keys": 0
}

Webhook 事件与签名

提交任务时传入 callback_url 后,可用 Webhook 接收任务通知。当前 MVP 稳定投递 task.succeeded;核心事件格式已覆盖 task.refunded、task.failed和 task.canceled,这些非成功终态会在后续版本升级为稳定投递承诺。请始终以 /v1/tasks/{task_id} 作为最终状态兜底;Webhook 投递失败不会改变任务最终状态, 也不会再次触发扣费或退款。

  • Header:x-webhook-id、x-webhook-timestamp、x-webhook-signature。
  • 签名算法:HMAC_SHA256(secret, "{timestamp}.{rawBody}"),Header 值格式为 v1=hex_hmac_sha256。
  • 验签时必须使用收到的原始请求体 raw body,不要使用重新序列化后的 JSON。
POSTclient callback_url

Webhook Payload

succeeded 事件会包含 output;refunded、failed、canceled 的事件格式中 output 为 null,并包含 error。当前 MVP 请不要依赖非成功终态一定投递。

{
  "id": "evt_xxx",
  "type": "task.succeeded",
  "created_at": "2026-05-10T08:01:00.000Z",
  "data": {
    "id": "job_xxx",
    "status": "succeeded",
    "model": "seedance-2.0",
    "output": {
      "video_url": "https://cdn.example.com/users/usr_xxx/jobs/job_xxx/output/video.mp4"
    },
    "error": null
  }
}
NODEx-webhook-signature

Node.js Webhook 验签

示例使用 Node.js 内置 http 和 crypto。请将 SEEAPI_WEBHOOK_SECRET 配置为平台为你的回调地址分配的密钥。

import { createHmac, timingSafeEqual } from "node:crypto";
import http from "node:http";

const WEBHOOK_SECRET = process.env.SEEAPI_WEBHOOK_SECRET;

function verifySignature(rawBody, timestamp, signature) {
  if (!WEBHOOK_SECRET || !timestamp || !signature?.startsWith("v1=")) return false;

  const expected = "v1=" + createHmac("sha256", WEBHOOK_SECRET)
    .update(`${timestamp}.${rawBody}`)
    .digest("hex");

  const receivedBuffer = Buffer.from(signature);
  const expectedBuffer = Buffer.from(expected);
  return receivedBuffer.length === expectedBuffer.length
    && timingSafeEqual(receivedBuffer, expectedBuffer);
}

http.createServer((req, res) => {
  if (req.method !== "POST") {
    res.writeHead(405).end();
    return;
  }

  const chunks = [];
  req.on("data", (chunk) => chunks.push(chunk));
  req.on("end", () => {
    const rawBody = Buffer.concat(chunks).toString("utf8");
    const timestamp = req.headers["x-webhook-timestamp"];
    const signature = req.headers["x-webhook-signature"];

    if (!verifySignature(rawBody, String(timestamp ?? ""), String(signature ?? ""))) {
      res.writeHead(401).end("invalid signature");
      return;
    }

    const event = JSON.parse(rawBody);
    console.log(req.headers["x-webhook-id"], event.type, event.data.id);
    res.writeHead(204).end();
  });
}).listen(3000);

统一错误格式

所有平台错误都使用统一结构;message 可用于排查,业务判断请优先依赖稳定的 code。

{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits.",
    "type": "billing_error",
    "request_id": "req_xxx"
  }
}
错误码类型HTTP说明
invalid_api_keyauthentication_error401API Key 缺失、格式错误或不存在。
api_key_disabledauthorization_error403API Key 被用户、管理员或风控禁用。
api_key_paused_insufficient_balanceauthorization_error403API Key 因余额不足暂停;充值后会自动恢复该类 Key。
validation_errorinvalid_request_error400请求字段不符合 input_schema,或 ReferenceAsset 缺失、已过期、不属于当前账号。修正或重新上传素材后使用新的 Idempotency-Key。
asset_provider_incompatibleinvalid_request_error400当前模型不能使用该素材来源,且不应重试。请通过普通参考素材接口重新上传原始图片,再使用新的 asset://ref_...。
unsupported_input_modalityinvalid_request_error400GPT 对话只支持文字和图片输入;不要传视频、音频或通用文件。
insufficient_creditsbilling_error402余额不足,平台不会创建任务,并会暂停当前账户下 active API Key。
idempotency_conflictinvalid_request_error409同一 Idempotency-Key 已用于不同请求体。
idempotent_stream_replay_unavailabletask_error409同一流式请求不能回放原始字节流;请使用新的 Idempotency-Key 重新生成。
model_not_foundmodel_error404模型不存在。
model_disabledmodel_error403模型已禁用。
provider_not_configuredmodel_error500模型服务未配置。
task_not_foundtask_error404任务不存在,或当前 API Key 不属于该任务用户。
task_timeouttask_error503任务处理超时;如已扣费,平台会走退款流程。
provider_auth_failedprovider_error502服务配置异常,请联系平台处理,不要重复提交大量请求。
provider_invalid_requestprovider_error422生成服务认为请求无效。
provider_generated_output_safety_rejectedprovider_error422生成结果未通过安全检查;平台不会向客户暴露上游原文、提示词或私有素材信息。
reference_media_compliance_incompleteprovider_error422参考素材合规校验未能在上游受理前完成;不等同于素材被判违规。异步任务会进入退款终态。
reference_media_compliance_rejectedprovider_error422仅在上游返回明确结构化拒绝码时使用;异步任务会进入退款终态。
reference_media_asset_registration_failedprovider_error422参考素材在上游受理前未完成登记;异步任务会进入退款终态。
reference_media_compliance_unavailableprovider_error422参考素材合规校验服务暂不可用且任务未被上游受理;异步任务会进入退款终态。
reference_media_compliance_timeoutprovider_error422参考素材合规校验在上游受理前超时;异步任务会进入退款终态。
real_person_reference_requires_assetprovider_error422仅适用于 input_schema 明确支持旧真人素材流程的旧模型;不要将真人素材接口用于 seedance-2.0 或 seedance-2.0-fast。
provider_task_failedprovider_error502生成任务失败;请查询任务状态确认是否已退款。
asset_library_not_configuredprovider_error500真人素材上传服务未配置,请联系平台处理。
asset_upload_failedprovider_error502真人素材上传失败;文件直传模式请稍后重试。
storage_file_too_largeinvalid_request_error413真人素材图片过大,请压缩后重新上传。
asset_activation_timeoutprovider_error504真人素材已上传但未及时完成校验,请稍后重试或联系平台。
provider_unavailableprovider_error502生成服务确实暂不可用;该错误不表示素材缺失、过期、跨账号或来源不兼容。
provider_rate_limitedprovider_error429生成服务限流。
provider_timeoutprovider_error503生成服务超时。
storage_upload_failedstorage_error502结果文件写入平台存储失败;请查询任务状态确认是否已退款。
internal_errorinternal_error500平台内部错误。

常见处理建议

情况建议动作
401 / 403先检查 API Key 是否复制完整、是否放在服务端、账户余额是否已耗尽。
402 insufficient_credits停止重试,联系平台充值;充值后 balance_paused 的 Key 会恢复。
409 idempotency_conflict换一个新的 Idempotency-Key,或使用原请求体查询旧任务。
400 asset_provider_incompatible不要重试原请求。重新上传原始图片,并把新的 asset://ref_... 放入 reference_image_urls。
400 validation_error(素材)确认 ReferenceAsset 存在、未过期且属于当前账号;修正后使用新的 Idempotency-Key。
422 real_person_reference_requires_asset仅对明确支持旧真人素材流程的旧模型使用 /v1/assets/portraits/upload;seedance-2.0 和 seedance-2.0-fast 改走普通参考素材上传。
422 reference_media_compliance_incomplete不要把它解读为素材违规;确认任务已退款后,再检查素材格式、登记状态或稍后使用新的幂等键重试。
422 provider_generated_output_safety_rejected生成结果未通过安全检查。修改提示词或随机种子后,使用新的幂等键重新提交。
429 / 503按指数退避重试任务查询;提交接口不要高频重复打。
refunded任务已结束且退款完成,可以用新的幂等键重新提交。
succeeded 但下载失败先 HEAD output.video_url;如果非 200,把 task_id 发给平台排查下载链路。
NODE/v1/video/generations

Node.js 提交并轮询

适用于 Node.js 18+,API Key 从服务端环境变量读取。

const BASE_URL = "https://api.example.com";
const API_KEY = process.env.SEEAPI_API_KEY;

async function main() {
  const submit = await fetch(`${BASE_URL}/v1/video/generations`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": "order-20260510-0001"
    },
    body: JSON.stringify({
      "model": "seedance-2.0",
      "prompt": "基于产品参考图生成一段自然柔光下的展示视频。",
      "reference_image_urls": [
            "asset://ref_image_xxx"
      ],
      "reference_video_urls": [
            "asset://ref_video_xxx"
      ],
      "reference_audio_urls": [
            "asset://ref_audio_mp3_xxx"
      ],
      "duration": 5,
      "aspect_ratio": "9:16",
      "resolution": "720p",
      "count": 1,
      "mode": "mixed2video",
      "generate_audio": true,
      "search_enabled": true,
      "callback_url": "https://client.example.com/webhooks/seeapi"
})
  });

  const task = await submit.json();
  if (!submit.ok) throw new Error(JSON.stringify(task));

  while (true) {
    const res = await fetch(`${BASE_URL}/v1/tasks/${task.id}`, {
      headers: { Authorization: `Bearer ${API_KEY}` }
    });
    const current = await res.json();
    if (!res.ok) throw new Error(JSON.stringify(current));

    if (["succeeded", "refunded", "failed", "canceled"].includes(current.status)) {
      console.log(current);
      return;
    }
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
PYTHON/v1/video/generations

Python 提交并轮询

示例使用 requests;API Key 从服务端环境变量 SEEAPI_API_KEY 读取。

import os
import time
import requests

BASE_URL = "https://api.example.com"
API_KEY = os.environ["SEEAPI_API_KEY"]

payload = {
  "model": "seedance-2.0",
  "prompt": "基于产品参考图生成一段自然柔光下的展示视频。",
  "reference_image_urls": [
    "asset://ref_image_xxx"
  ],
  "reference_video_urls": [
    "asset://ref_video_xxx"
  ],
  "reference_audio_urls": [
    "asset://ref_audio_mp3_xxx"
  ],
  "duration": 5,
  "aspect_ratio": "9:16",
  "resolution": "720p",
  "count": 1,
  "mode": "mixed2video",
  "generate_audio": True,
  "search_enabled": True,
  "callback_url": "https://client.example.com/webhooks/seeapi"
}

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
    "Idempotency-Key": "order-20260510-0001",
}

submit = requests.post(f"{BASE_URL}/v1/video/generations", json=payload, headers=headers, timeout=30)
submit.raise_for_status()
task = submit.json()

while True:
    res = requests.get(
        f"{BASE_URL}/v1/tasks/{task['id']}",
        headers={"Authorization": f"Bearer {API_KEY}"},
        timeout=30,
    )
    res.raise_for_status()
    current = res.json()
    if current["status"] in ["succeeded", "refunded", "failed", "canceled"]:
        print(current)
        break
    time.sleep(3)