生成图片
OpenAI Images 兼容的文生图:GPT Image、Gemini Banana 与 Seedream;Seedream 与 Gemini 也在这里传参考图。
/v1/images/generations按提示词生成图片。GPT Image 与 Gemini 返回 data[].b64_json,Seedream 默认返回 data[].url(24 小时有效),也可用 response_format: b64_json。Seedream 与两个 Gemini 分组也在这个端点用 image / images 做图生图。
每个模型的参数与上限不同:在下方选择模型,参数表随之切换,数字取自插件校验代码导出的规格(与 /spec/models/<model>.json 同源)。GPT Image 生成超过约 40 秒时服务端先回 200 并写空白保活,此后失败也仍是 200——请以响应体是否含 error 判断成败,客户端读超时不少于 300 秒。
可灵与 Midjourney 也在这个端点提交,但一律异步(202 + id,用查询视频任务轮询),在模型选择里选「可灵」「Midjourney」查看;Grok Imagine 见 Grok Imagine 生图。
- GPT Image 不支持官方流式字段
partial_images,请省略;stream: true返回的是 HopBase Images SSE,不是逐张预览事件。 output_compression、moderation、user、response_format只在同步文生图 JSON 与同步 multipart 编辑中透传;JSON 编辑与异步任务不保留这些字段。GPT Image 异步只保留model、prompt、n、size、quality、background、output_format、input_fidelity和编辑用的图片 / mask。- Gemini 计费:「Gemini 特价版(AI Studio / Vertex)」按张计费,按官方各尺寸单价 × 分组折扣(1K / 2K / 4K 各按官方价);「Gemini 官方直连(企业级)」按 token 计费(输出 token × 单价)。
- Chat Completions 转 Images 的桥接路径只保留前 6 张参考图;要用 14 张请直接调本端点。
产生扣费的非流式响应会返回本次实际扣费:响应头 X-HopBase-Cost / X-HopBase-Cost-USD / X-HopBase-Currency,以及响应体根对象 usage 里的 cost / cost_usd / currency(usage 原有字段保留)。cost_usd 为本次从余额实际扣除的美元金额,cost 为同一笔扣费的人民币金额,currency 恒为 CNY。流式(SSE)不返回,请到控制台「使用记录」查看;未扣费的响应(如错误)不带。详见账户 API · 扣费。
请求头
Bearer sk-…:控制台「API 密钥」里创建的密钥,所属分组须包含请求的模型
respond-async:GPT Image / Gemini 立即返回 202 Accepted、task_id 与 status_url,再用 GET /v1/images/tasks?task_id=… 轮询。生成 2K / 4K 大图时建议使用;Seedream 忽略此头、照常同步返回
可选值respond-async
请求体参数JSON
data[].b64_json。 参考图最多 16 张。先确认当前密钥的 GET /v1/models 包含此 ID
生成或编辑指令;为空返回 400 prompt must not be empty。网关不限长度,上限为官方上限
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度1–32000 字符
例:1024x1024、2048x2048、3840x2160。不合规在生成前返回 400、不计费;不接受 1K / 2K / 4K
限制auto 或 宽x高:边长为 16 的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、总像素 655360–8294400
档位越高输出 token 越多、费用越高:1024x1024 实测 low 约 200、high 约 1,760、xhigh 约 3,120、max 约 7,020 输出 token
可选值autolowmediumhigh
限制网关不校验、原样转发;档位越高输出 token 越多
部分分组只支持 1,传更大值返回 400;≤ 0 按 1 处理
范围1–10默认1
transparent 需配合 png 或 webp;2.0 透明背景属预览能力
可选值autoopaquetransparent
决定 b64_json 解码后的格式
可选值pngjpegwebp
仅 jpeg / webp;只在同步 generations JSON 与 multipart 编辑中保留
范围0–100默认100
不会关闭内容安全检查
可选值autolow
终端用户识别字符串,不是 HopBase 账户 ID,也不改变计费归属
传什么都以 b64_json 返回,不能靠 url 取得下载链接,请省略
限制传什么都以 b64_json 返回,请省略
true 改为 HopBase Images SSE(期间发送 keepalive,最后一个 data: 事件才是 Images JSON,以 [DONE] 结束),不是 OpenAI 原生逐张预览事件;SDK 请保持 false
限制true 返回 HopBase Images SSE,SDK 请保持 false默认false
兼容字段;GPT Image 2 默认高保真处理参考图,请省略
可选值lowhigh
- transparent 需要 png 或 webp
- output_compression 只对 jpeg / webp 生效
先确认当前密钥的 GET /v1/models 包含此 ID
生成或编辑指令;为空返回 400 prompt must not be empty。网关不限长度,上限为官方上限
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度1–32000 字符
例:1024x1024、2048x2048、3840x2160。不合规在生成前返回 400、不计费;不接受 1K / 2K / 4K
限制auto 或 宽x高:边长为 16 的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、总像素 655360–8294400
档位越高输出 token 越多、费用越高:1024x1024 实测 low 约 200、high 约 1,760、xhigh 约 3,120、max 约 7,020 输出 token
可选值autolowmediumhighxhighmax
限制网关不校验、原样转发;档位越高输出 token 越多
部分分组只支持 1,传更大值返回 400;≤ 0 按 1 处理
范围1–10默认1
transparent 需配合 png 或 webp;2.0 透明背景属预览能力
可选值autoopaquetransparent
决定 b64_json 解码后的格式
可选值pngjpegwebp
仅 jpeg / webp;只在同步 generations JSON 与 multipart 编辑中保留
范围0–100默认100
不会关闭内容安全检查
可选值autolow
终端用户识别字符串,不是 HopBase 账户 ID,也不改变计费归属
传什么都以 b64_json 返回,不能靠 url 取得下载链接,请省略
限制传什么都以 b64_json 返回,请省略
true 改为 HopBase Images SSE(期间发送 keepalive,最后一个 data: 事件才是 Images JSON,以 [DONE] 结束),不是 OpenAI 原生逐张预览事件;SDK 请保持 false
限制true 返回 HopBase Images SSE,SDK 请保持 false默认false
兼容字段;GPT Image 2 默认高保真处理参考图,请省略
可选值lowhigh
- transparent 需要 png 或 webp
- output_compression 只对 jpeg / webp 生效
先确认当前密钥的 GET /v1/models 包含此 ID
生成或编辑指令;为空返回 400 prompt must not be empty。网关不限长度,上限为官方上限
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度1–32000 字符
例:1024x1024、2048x2048、3840x2160。不合规在生成前返回 400、不计费;不接受 1K / 2K / 4K
限制auto 或 宽x高:边长为 16 的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、总像素 655360–8294400
档位越高输出 token 越多、费用越高:1024x1024 实测 low 约 200、high 约 1,760、xhigh 约 3,120、max 约 7,020 输出 token
可选值autolowmediumhighxhighmax
限制网关不校验、原样转发;档位越高输出 token 越多
部分分组只支持 1,传更大值返回 400;≤ 0 按 1 处理
范围1–10默认1
transparent 需配合 png 或 webp;2.0 透明背景属预览能力
可选值autoopaquetransparent
决定 b64_json 解码后的格式
可选值pngjpegwebp
仅 jpeg / webp;只在同步 generations JSON 与 multipart 编辑中保留
范围0–100默认100
不会关闭内容安全检查
可选值autolow
终端用户识别字符串,不是 HopBase 账户 ID,也不改变计费归属
传什么都以 b64_json 返回,不能靠 url 取得下载链接,请省略
限制传什么都以 b64_json 返回,请省略
true 改为 HopBase Images SSE(期间发送 keepalive,最后一个 data: 事件才是 Images JSON,以 [DONE] 结束),不是 OpenAI 原生逐张预览事件;SDK 请保持 false
限制true 返回 HopBase Images SSE,SDK 请保持 false默认false
兼容字段;GPT Image 2 默认高保真处理参考图,请省略
可选值lowhigh
- transparent 需要 png 或 webp
- output_compression 只对 jpeg / webp 生效
先确认当前密钥的 GET /v1/models 包含此 ID
生成或编辑指令;为空返回 400 prompt must not be empty。网关不限长度,上限为官方上限
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度1–32000 字符
例:1024x1024、2048x2048、3840x2160。不合规在生成前返回 400、不计费;不接受 1K / 2K / 4K
限制auto 或 宽x高:边长为 16 的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、总像素 655360–8294400
档位越高输出 token 越多、费用越高:1024x1024 实测 low 约 200、high 约 1,760、xhigh 约 3,120、max 约 7,020 输出 token
可选值autolowmediumhighxhighmax
限制网关不校验、原样转发;档位越高输出 token 越多
部分分组只支持 1,传更大值返回 400;≤ 0 按 1 处理
范围1–10默认1
transparent 需配合 png 或 webp;2.0 透明背景属预览能力
可选值autoopaquetransparent
决定 b64_json 解码后的格式
可选值pngjpegwebpsvggif
仅 jpeg / webp;只在同步 generations JSON 与 multipart 编辑中保留
范围0–100默认100
不会关闭内容安全检查
可选值autolow
终端用户识别字符串,不是 HopBase 账户 ID,也不改变计费归属
传什么都以 b64_json 返回,不能靠 url 取得下载链接,请省略
限制传什么都以 b64_json 返回,请省略
true 改为 HopBase Images SSE(期间发送 keepalive,最后一个 data: 事件才是 Images JSON,以 [DONE] 结束),不是 OpenAI 原生逐张预览事件;SDK 请保持 false
限制true 返回 HopBase Images SSE,SDK 请保持 false默认false
兼容字段;GPT Image 2 默认高保真处理参考图,请省略
可选值lowhigh
出图前的规划强度,不单独收费;其他取值网关返回 400
可选值lowmediumhigh
默认"high"
仅 output_format=gif:动图帧数。gif 的 size 是单帧尺寸,所有帧拼在一张边长不超过 3840 的图上,请用 auto 或 512x512 这类小尺寸
范围2–16默认9
仅 output_format=gif:每帧时长(毫秒)
范围20–2000默认200
- transparent 需要 png 或 webp
- output_compression 只对 jpeg / webp 生效
- output_format=svg 时 n 只能为 1
先确认当前密钥的 GET /v1/models 包含此 ID
生成或编辑指令;为空返回 400 prompt must not be empty。网关不限长度,上限为官方上限
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度1–32000 字符
例:1024x1024、2048x2048、3840x2160。不合规在生成前返回 400、不计费;不接受 1K / 2K / 4K
限制auto 或 宽x高:边长为 16 的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、总像素 655360–8294400
档位越高输出 token 越多、费用越高:1024x1024 实测 low 约 200、high 约 1,760、xhigh 约 3,120、max 约 7,020 输出 token
可选值autolowmediumhighxhighmax
限制网关不校验、原样转发;档位越高输出 token 越多
部分分组只支持 1,传更大值返回 400;≤ 0 按 1 处理
范围1–10默认1
transparent 需配合 png 或 webp;2.0 透明背景属预览能力
可选值autoopaquetransparent
决定 b64_json 解码后的格式
可选值pngjpegwebpsvggif
仅 jpeg / webp;只在同步 generations JSON 与 multipart 编辑中保留
范围0–100默认100
不会关闭内容安全检查
可选值autolow
终端用户识别字符串,不是 HopBase 账户 ID,也不改变计费归属
传什么都以 b64_json 返回,不能靠 url 取得下载链接,请省略
限制传什么都以 b64_json 返回,请省略
true 改为 HopBase Images SSE(期间发送 keepalive,最后一个 data: 事件才是 Images JSON,以 [DONE] 结束),不是 OpenAI 原生逐张预览事件;SDK 请保持 false
限制true 返回 HopBase Images SSE,SDK 请保持 false默认false
兼容字段;GPT Image 2 默认高保真处理参考图,请省略
可选值lowhigh
出图前的规划强度,不单独收费;其他取值网关返回 400
可选值lowmediumhigh
默认"high"
仅 output_format=gif:动图帧数。gif 的 size 是单帧尺寸,所有帧拼在一张边长不超过 3840 的图上,请用 auto 或 512x512 这类小尺寸
范围2–16默认9
仅 output_format=gif:每帧时长(毫秒)
范围20–2000默认200
- transparent 需要 png 或 webp
- output_compression 只对 jpeg / webp 生效
- output_format=svg 时 n 只能为 1
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10,2K ≤ 5范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K2K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K2K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K2K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 14 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 14 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
- 2K 输出每次最多 5 张(响应体积上限)
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10,2K ≤ 5范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K2K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K2K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K2K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 14 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 14 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
- 2K 输出每次最多 5 张(响应体积上限)
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10,2K ≤ 5,4K ≤ 2范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K2K4K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K2K4K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K2K4K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 14 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 14 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
- 2K 输出每次最多 5 张(响应体积上限)
- 4K 输出每次最多 2 张(响应体积上限)
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10,2K ≤ 5,4K ≤ 2范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K2K4K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K2K4K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K2K4K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 14 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 14 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
- 2K 输出每次最多 5 张(响应体积上限)
- 4K 输出每次最多 2 张(响应体积上限)
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 14 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 14 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
以当前密钥 GET /v1/models 的返回为准
模型拒答或只回文字时返回 400(消息引用该段文字)或 502:请改写提示词
限制去除首尾空白后不能为空,否则 400「prompt must not be empty」长度≥ 1 字符
并行生成。全有或全无:任一张失败则整个请求失败、不计费
限制按输出档位封顶:1K ≤ 10范围1–10默认1
顶层扁平写法,等价于 google.image_config.image_size;覆盖 size 推导的档位
可选值1K
默认"1K"
顶层扁平写法,等价于 google.image_config.aspect_ratio,优先于 size
可选值1:12:33:23:44:34:55:49:1616:921:9
默认"1:1"
宽x高 从不因比例被拒:映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位。显式写出超过型号档位的 1K / 2K / 4K 返回 400;同时传 image_size 时以它为准
可选值1K
限制auto、任意比例的 宽x高(映射到最接近的官方比例,档位按长边推导并静默降到型号最高档位),或型号档位
SDK 可写成 extra_body.google.image_config;三种写法等价
可选值1:12:33:23:44:34:55:49:1616:921:9
可选值1K
参考图,放在 generations 请求体即可;同时传时以 images 为准。「Gemini 官方直连(企业级)」单张解码后 ≤ 20 MiB,没有 /v1/images/edits
限制参考图:字符串或字符串数组,最多 3 张
同 image,同时传时以 images 为准
限制参考图:字符串或字符串数组,最多 3 张
不支持:传 mask 返回 400;局部修改请在 prompt 中描述区域
不支持 transparent(返回 400)
不能为"transparent"
不支持,请省略或传 false
不能为true
使用当前密钥 GET /v1/models 返回的完整 ID
图片内容、构图、风格或编辑指令;局部编辑可描述坐标、bbox、箭头或参考图中的涂画区域
限制去除首尾空白后不能为空,否则 400「missing prompt」长度≥ 1 字符
不合规在生成前返回 400 并提示合法区间、不计费
可选值1K1.5K2K
限制简写 1K / 1.5K / 2K,或 宽x高:总像素 921600–4624220,宽高比 1:16–16:1
其他值(含 null)返回 400
限制only a single output is supported (n=1)默认1
url 返回 24 小时有效的签名直链;b64_json 返回 data[].b64_json。非流式组图不能用 b64_json(须 stream: true)
可选值urlb64_json
默认"url"
4.5 仅 jpeg
可选值pngjpeg
必须是对象
可选值standard
传入后触发单图 / 多图图生图或编辑;/v1/images/edits 必须至少 1 张。URL 在提交时不下载、不检查大小
限制参考图(传入即图生图 / 编辑):最多 10 张;Data URL 单张 ≤ 31457280 字节;URL 提交时不下载
仅 seedream-5-0-pro:true 把 1 张 PNG / JPEG 输入图拆成底图 + 至多 16 个透明 PNG 图层;此时 prompt 可省略、size 只认 1K / 1.5K / 2K / auto(缺省 auto)。1K 约需 1.5 分钟,客户端超时请设 ≥ 5 分钟。详见 Seedream · 图层拆分
限制不支持图层拆分:传 true 返回 400「model seedream-5-5 does not support layer_decomposition」不能为true
本站默认 false(官方默认 true),传 true 才加水印
限制本站默认 false(官方默认 true);传 true 才加水印默认false
仅 seedream-5-5 / seedream-5-0-pro:transparent 只用于图生图,须恰好 1 张带透明通道的输入图(JPEG / BMP Data URL 返回 400),输出 PNG,不可配 output_format: jpeg。详见 Seedream · 透明背景
可选值opaquetransparent
默认"opaque"
仅 seedream-5-0-lite / seedream-4-5:auto 开组图,模型按 prompt 决定出几张(不超过 max_images);单张失败放在 data[].error、不计费,全部失败返回 400。非流式组图服务端最多等约 280 秒,建议配 stream: true。详见 Seedream · 组图
max_images 为 1–15 的整数,参考图数 + max_images ≤ 15;multipart 写 sequential_image_generation_options[max_images] 或 max_images
仅 seedream-5-0-lite / seedream-4-5:true 返回 SSE,逐张推 image_generation.partial_succeeded / image_generation.partial_failed,最后 image_generation.completed 与 data: [DONE];按成功张数计费,流式响应不带本次扣费字段。详见 Seedream · 流式
限制不支持:传 true 返回 400「model seedream-5-5 does not support stream」不能为true
联网搜索暂不支持,传入返回 400
- background transparent:恰好 1 张带透明通道的输入图,输出 png
使用当前密钥 GET /v1/models 返回的完整 ID
图片内容、构图、风格或编辑指令;局部编辑可描述坐标、bbox、箭头或参考图中的涂画区域
限制去除首尾空白后不能为空,否则 400「missing prompt」;layer_decomposition: true 时可省略长度≥ 1 字符
不合规在生成前返回 400 并提示合法区间、不计费
可选值1K1.5K2K
限制简写 1K / 1.5K / 2K,或 宽x高:总像素 921600–4624220,宽高比 1:16–16:1;图层拆分只认 1K / 1.5K / 2K / auto(缺省 auto)
其他值(含 null)返回 400
限制only a single output is supported (n=1)默认1
url 返回 24 小时有效的签名直链;b64_json 返回 data[].b64_json。非流式组图不能用 b64_json(须 stream: true)
可选值urlb64_json
默认"url"
4.5 仅 jpeg
可选值pngjpeg
必须是对象
可选值standardfast
传入后触发单图 / 多图图生图或编辑;/v1/images/edits 必须至少 1 张。URL 在提交时不下载、不检查大小
限制参考图(传入即图生图 / 编辑):最多 10 张;Data URL 单张 ≤ 31457280 字节;URL 提交时不下载
仅 seedream-5-0-pro:true 把 1 张 PNG / JPEG 输入图拆成底图 + 至多 16 个透明 PNG 图层;此时 prompt 可省略、size 只认 1K / 1.5K / 2K / auto(缺省 auto)。1K 约需 1.5 分钟,客户端超时请设 ≥ 5 分钟。详见 Seedream · 图层拆分
限制图层拆分:把 1 张输入图拆成底图 + 至多 16 个透明 PNG 图层默认false
本站默认 false(官方默认 true),传 true 才加水印
限制本站默认 false(官方默认 true);传 true 才加水印默认false
仅 seedream-5-5 / seedream-5-0-pro:transparent 只用于图生图,须恰好 1 张带透明通道的输入图(JPEG / BMP Data URL 返回 400),输出 PNG,不可配 output_format: jpeg。详见 Seedream · 透明背景
可选值opaquetransparent
默认"opaque"
仅 seedream-5-0-lite / seedream-4-5:auto 开组图,模型按 prompt 决定出几张(不超过 max_images);单张失败放在 data[].error、不计费,全部失败返回 400。非流式组图服务端最多等约 280 秒,建议配 stream: true。详见 Seedream · 组图
max_images 为 1–15 的整数,参考图数 + max_images ≤ 15;multipart 写 sequential_image_generation_options[max_images] 或 max_images
仅 seedream-5-0-lite / seedream-4-5:true 返回 SSE,逐张推 image_generation.partial_succeeded / image_generation.partial_failed,最后 image_generation.completed 与 data: [DONE];按成功张数计费,流式响应不带本次扣费字段。详见 Seedream · 流式
限制不支持:传 true 返回 400「model seedream-5-0-pro does not support stream」不能为true
联网搜索暂不支持,传入返回 400
- 图层拆分:prompt 可省略、size 只认档位(缺省 auto)、恰好 1 张 PNG / JPEG 输入图
- background transparent:恰好 1 张带透明通道的输入图,输出 png
使用当前密钥 GET /v1/models 返回的完整 ID
图片内容、构图、风格或编辑指令;局部编辑可描述坐标、bbox、箭头或参考图中的涂画区域
限制去除首尾空白后不能为空,否则 400「missing prompt」长度≥ 1 字符
不合规在生成前返回 400 并提示合法区间、不计费
可选值2K3K4K
限制简写 2K / 3K / 4K,或 宽x高:总像素 3686400–16777216,宽高比 1:16–16:1
其他值(含 null)返回 400
限制only a single output is supported (n=1)默认1
url 返回 24 小时有效的签名直链;b64_json 返回 data[].b64_json。非流式组图不能用 b64_json(须 stream: true)
可选值urlb64_json
默认"url"
4.5 仅 jpeg
可选值pngjpeg
必须是对象
可选值standard
传入后触发单图 / 多图图生图或编辑;/v1/images/edits 必须至少 1 张。URL 在提交时不下载、不检查大小
限制参考图(传入即图生图 / 编辑):最多 14 张;Data URL 单张 ≤ 31457280 字节;URL 提交时不下载
仅 seedream-5-0-pro:true 把 1 张 PNG / JPEG 输入图拆成底图 + 至多 16 个透明 PNG 图层;此时 prompt 可省略、size 只认 1K / 1.5K / 2K / auto(缺省 auto)。1K 约需 1.5 分钟,客户端超时请设 ≥ 5 分钟。详见 Seedream · 图层拆分
限制不支持图层拆分:传 true 返回 400「model seedream-5-0-lite does not support layer_decomposition」不能为true
本站默认 false(官方默认 true),传 true 才加水印
限制本站默认 false(官方默认 true);传 true 才加水印默认false
仅 seedream-5-5 / seedream-5-0-pro:transparent 只用于图生图,须恰好 1 张带透明通道的输入图(JPEG / BMP Data URL 返回 400),输出 PNG,不可配 output_format: jpeg。详见 Seedream · 透明背景
仅 seedream-5-0-lite / seedream-4-5:auto 开组图,模型按 prompt 决定出几张(不超过 max_images);单张失败放在 data[].error、不计费,全部失败返回 400。非流式组图服务端最多等约 280 秒,建议配 stream: true。详见 Seedream · 组图
可选值autodisabled
限制auto 组图:模型按 prompt 决定出几张(不超过 max_images)默认"disabled"
max_images 为 1–15 的整数,参考图数 + max_images ≤ 15;multipart 写 sequential_image_generation_options[max_images] 或 max_images
组图最多张数;参考图数 + max_images ≤ 15
范围1–15
仅 seedream-5-0-lite / seedream-4-5:true 返回 SSE,逐张推 image_generation.partial_succeeded / image_generation.partial_failed,最后 image_generation.completed 与 data: [DONE];按成功张数计费,流式响应不带本次扣费字段。详见 Seedream · 流式
默认false
联网搜索暂不支持,传入返回 400
- 非流式组图不能配 b64_json(要求 stream=true)
使用当前密钥 GET /v1/models 返回的完整 ID
图片内容、构图、风格或编辑指令;局部编辑可描述坐标、bbox、箭头或参考图中的涂画区域
限制去除首尾空白后不能为空,否则 400「missing prompt」长度≥ 1 字符
不合规在生成前返回 400 并提示合法区间、不计费
可选值2K4K
限制简写 2K / 4K,或 宽x高:总像素 3686400–16777216,宽高比 1:16–16:1
其他值(含 null)返回 400
限制only a single output is supported (n=1)默认1
url 返回 24 小时有效的签名直链;b64_json 返回 data[].b64_json。非流式组图不能用 b64_json(须 stream: true)
可选值urlb64_json
默认"url"
4.5 仅 jpeg
可选值jpeg
必须是对象
可选值standard
传入后触发单图 / 多图图生图或编辑;/v1/images/edits 必须至少 1 张。URL 在提交时不下载、不检查大小
限制参考图(传入即图生图 / 编辑):最多 14 张;Data URL 单张 ≤ 31457280 字节;URL 提交时不下载
仅 seedream-5-0-pro:true 把 1 张 PNG / JPEG 输入图拆成底图 + 至多 16 个透明 PNG 图层;此时 prompt 可省略、size 只认 1K / 1.5K / 2K / auto(缺省 auto)。1K 约需 1.5 分钟,客户端超时请设 ≥ 5 分钟。详见 Seedream · 图层拆分
限制不支持图层拆分:传 true 返回 400「model seedream-4-5 does not support layer_decomposition」不能为true
本站默认 false(官方默认 true),传 true 才加水印
限制本站默认 false(官方默认 true);传 true 才加水印默认false
仅 seedream-5-5 / seedream-5-0-pro:transparent 只用于图生图,须恰好 1 张带透明通道的输入图(JPEG / BMP Data URL 返回 400),输出 PNG,不可配 output_format: jpeg。详见 Seedream · 透明背景
仅 seedream-5-0-lite / seedream-4-5:auto 开组图,模型按 prompt 决定出几张(不超过 max_images);单张失败放在 data[].error、不计费,全部失败返回 400。非流式组图服务端最多等约 280 秒,建议配 stream: true。详见 Seedream · 组图
可选值autodisabled
限制auto 组图:模型按 prompt 决定出几张(不超过 max_images)默认"disabled"
max_images 为 1–15 的整数,参考图数 + max_images ≤ 15;multipart 写 sequential_image_generation_options[max_images] 或 max_images
组图最多张数;参考图数 + max_images ≤ 15
范围1–15
仅 seedream-5-0-lite / seedream-4-5:true 返回 SSE,逐张推 image_generation.partial_succeeded / image_generation.partial_failed,最后 image_generation.completed 与 data: [DONE];按成功张数计费,流式响应不带本次扣费字段。详见 Seedream · 流式
默认false
联网搜索暂不支持,传入返回 400
- 非流式组图不能配 b64_json(要求 stream=true)
可灵生图型号 ID;传视频型号返回 400
可选值kling-image-expandkling-image-o1kling-image-v2-1kling-image-v2-1-i2ikling-image-v2-1-multi-refkling-image-v3kling-image-v3-omni
与非空 images 至少提供一个
不区分大小写,OpenAI 风格的 high、standard 等会被拒绝。各型号可选档:kling-image-v3 1k / 2k;kling-image-v3-omni 1k / 2k / 4k;kling-image-o1 1k / 2k / 4k;kling-image-v2-1 1k / 2k;kling-image-v2-1-i2i 1k / 2k;kling-image-v2-1-multi-ref 1k / 2k;kling-image-expand 1k
可选值1k2k4k
默认"1k"
按实际产出张数计费
范围1–9默认1
参考图;每项 url(公网 HTTP(S) 地址)/ file_id 二选一,不能带 usage;file_id 须是当前密钥可用的可灵素材,不是 Seedance 素材 ID。张数:kling-image-v3 0–1 张;kling-image-v3-omni 0–10 张;kling-image-o1 0–10 张;kling-image-v2-1 不接受;kling-image-v2-1-i2i 恰好 1 张;kling-image-v2-1-multi-ref 2–4 张;kling-image-expand 恰好 1 张
公网 HTTP(S) 地址
可灵素材 ID,与 url 二选一
仅扩图 kling-image-expand:四个比例均为 0–2 的数字,省略为 0,不能全为 0;扩展后面积不超过原图 3 倍:(1+左+右) × (1+上+下) ≤ 3。其他型号传非空 extra 返回 400
扩展比例
范围0–2
扩展比例
范围0–2
扩展比例
范围0–2
扩展比例
范围0–2
精确匹配
画面描述,可在描述之后加 -- 参数(--ar 画幅、--hd 原生 2K、--s、--c、--weird、--iw、--sref + --sw、--no、--seed、--tile、--exp)。必须有画面描述,不能只有 -- 参数,也不能含 ::。--ar 比例不超过 14:1,带 --hd 时不超过 4:1;--q、--niji、--repeat、--oref、--cref、--stealth、--stop、--draft、--profile 返回 400
长度≥ 1 字符
参考图,0–1 项;每项 url(公网绝对 HTTP(S) 地址)/ file_id 二选一,不能带 usage
数量≤ 1 项
公网绝对 HTTP(S) 地址
素材 ID,与 url 二选一
只能是 4:每个任务固定出 4 张,按返回的每张图计费
默认4
请省略:非空返回 400;要 2K 请在 prompt 写 --hd
请省略:非空对象返回 400
返回
200同步成功
202异步受理:GPT Image / Gemini 带 Prefer: respond-async 时;可灵与 Midjourney 一律如此
响应头
本次请求扣费的人民币金额(与 X-HopBase-Cost-USD 为同一笔扣费),最多 6 位小数,如 0.0816。只在本次产生扣费时返回;流式(SSE)不返回;生图耗时约 40 秒以上时响应头已提前发出,以响应体 usage.cost 为准
本次请求实际从余额扣除的美元金额,与使用记录里这一条相同,最多 8 位小数,如 0.012;只随 X-HopBase-Cost 一起返回
X-HopBase-Cost 的币种,恒为 CNY
Unix 秒
每张图一项
GPT Image / Gemini:Base64 图片数据,解码后按 output_format 保存;Gemini 可能是 JPEG,请看 mime_type。Seedream 传 response_format: b64_json 时也返回此字段
Seedream:24 小时有效的签名直链,过期只能重新生成
Seedream 组图:这一张生成失败(多为内容审核),不计费
错误码
失败原因
Seedream:实际输出 宽x高
Seedream 图层拆分:底图按请求的 output_format,图层恒为 png
Seedream 图层拆分:底图为 0,图层从 1 起,按升序叠放
Seedream 图层拆分(仅图层):图层在底图中的位置
[left, top, right, bottom],底图像素坐标
同一位置的归一化坐标,0–999
Seedream 图层拆分(仅图层):图层名
Seedream 图层拆分(仅图层):图层内容描述
图片 MIME
模型改写后的提示词(部分模型)
可能返回
输入 Token
输出 Token
合计
Grok Imagine:xAI 官方计量,单位是 1e-10 美元,按官方价折算,不是本次扣费;本次实际从余额扣除的美元金额看 cost_usd,cost 为同一笔扣费的人民币金额
网关附加:本次扣费的人民币金额(与 cost_usd 为同一笔扣费),与响应头 X-HopBase-Cost 相同;流式不返回
网关附加:本次实际从余额扣除的美元金额,与响应头 X-HopBase-Cost-USD 及使用记录相同;流式不返回
网关附加:cost 的币种,恒为 CNY
错误
safety_rejectedmissing_api_key / invalid_api_key / api_key_expired)insufficient_quota)model_not_found),或路径不属于该分组(route_not_found)request_too_large)user_concurrency_limit / apikey_concurrency_limit),带 Retry-AfterGPT Image 报错原文
# size: 按上表尺寸规则修改
size must be WIDTHxHEIGHT or auto
size side length exceeds 3840px (4096x2048)
size width and height must be multiples of 16 (1000x1000)
size aspect ratio must not exceed 3:1 (3840x1024)
size total pixel count must be at least 655360 (512x512=262144)
size total pixel count must not exceed 8294400 (3840x3840=14745600)
# prompt 为空
prompt must not be empty
# edits JSON: 参考图放在 "image",用字符串或 {"url": ...};不读取 "images"
/v1/images/edits requires at least one image
image object is missing the url field
image must be a data URL or an http(s) URL
# 远程参考图:需为返回 image/* 的公开 URL,单张 ≤ 25 MiB
image download returned HTTP 404
image is too large
image Content-Type is not image/*: text/html
reference image URL must not point to an internal address
image is too large, please compress it to under 4MB and retry
# 内容安全拦截 (error.code: safety_rejected)
Your request was rejected by the safety system.
# HTTP 413
Request body exceeds the size limit (60 MB)Gemini 报错原文
# 「Gemini 特价版(AI Studio / Vertex)」
prompt must not be empty
n must be between 1 and 10 for model gemini-3-pro-image
n=3 is too large for 4K output on model gemini-3-pro-image; at most 2 images per request at this size (response size limit); lower n or send separate requests
model gemini-3.1-flash-image does not support tier 4K; supported: 1K, 2K
model gemini-3-pro-image: size "big" is not valid; expected WIDTHxHEIGHT (any aspect ratio, mapped to the nearest official tier) or 1K/2K/4K
aspect_ratio "7:3" is not supported for model gemini-3-pro-image; allowed values: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
image_size "4K" is not supported for model gemini-3.1-flash-image; supported: 1K, 2K
background=transparent is not supported for model gemini-3-pro-image; Gemini image models cannot output transparent images
mask is not supported for Gemini image models; remove mask and describe the region to edit in the prompt
too many reference images: at most 14 are supported for this model, got 15
# 「Gemini 官方直连(企业级)」
missing prompt
Gemini image generation does not support stream=true; send a non-streaming request
n must be at most 10
n=6 is too large for 2K output on model gemini-3.1-flash-image; at most 5 images per request at this size (response size limit); lower n or send separate requests
Images generations only accepts a JSON request body: ...
size 4K is not supported for model gemini-3.1-flash-image; supported tiers: 1K, 2K
size "banana" is not valid for model gemini-3-pro-image; use auto, WIDTHxHEIGHT (e.g. 1024x1024, mapped to the nearest supported aspect ratio and capped at the model's largest tier), or one of: 1K, 2K, 4K
image_config.aspect_ratio "7:3" is not supported; allowed values: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
image_config.image_size "4K" is not supported for model gemini-3.1-flash-image; allowed values: 1K, 2K
mask is not supported for model gemini-3-pro-image; remove mask and describe the region to edit in the prompt
background=transparent is not supported for model gemini-3-pro-image; Gemini image models cannot output transparent images
reference image 1: reference image exceeds the 20MB limit
reference image 1: reference image URL must not point to an internal address
reference image 1: reference image download returned HTTP 404
reference image 1: reference file is not a supported image typeSeedream 报错原文
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or a valid WIDTHxHEIGHT pixel size # 例如 "size": "auto"
model seedream-5-0-lite requires the total pixel count of size to be between 3686400 and 16777216
size aspect ratio must be between 1:16 and 16:1
missing prompt
response_format only supports url or b64_json
only a single output is supported (n=1)
model seedream-4-5 only supports output_format jpeg
optimize_prompt_options must be an object
image must be a URL/data URL string or an array of strings
every item in the image array must be a URL or data URL string
image must not be empty
at most 10 reference images are supported
reference image 1 is invalid: data URL must be base64-encoded
reference image 1 is invalid: unsupported image format image/svg+xml
reference image 1 is invalid: a single image must not exceed 30 MB
image edits require at least one image reference # /v1/images/edits 未带图
seedream does not accept a traditional mask; ... # /v1/images/edits 带 "mask" 即拒,null 也一样
# 图层拆分 layer_decomposition
model seedream-5-0-lite does not support layer_decomposition # 只有 seedream-5-0-pro 支持
layer_decomposition must be a boolean
layer_decomposition requires exactly one image
layer_decomposition only accepts png or jpeg images
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or auto with layer_decomposition
# 透明背景 background
model seedream-5-0-lite does not support background # 仅 seedream-5-5 / seedream-5-0-pro 支持
model seedream-5-0-pro only supports background opaque or transparent
background transparent requires exactly one image with an alpha channel
background transparent outputs png; output_format jpeg is not allowed
background transparent requires an input image with an alpha channel, image/jpeg is not supported
# 组图与流式(仅 seedream-5-0-lite / seedream-4-5)
model seedream-5-0-pro does not support sequential_image_generation
sequential_image_generation only supports auto or disabled
sequential_image_generation_options must be an object
sequential_image_generation_options.max_images must be an integer between 1 and 15
the number of reference images plus max_images must not exceed 15
response_format b64_json with sequential_image_generation auto requires stream=true
model seedream-5-0-pro does not support stream
# 其他
watermark must be a boolean
model seedream-5-0-lite does not support tools # 联网搜索暂不支持