生成图像
- 以 Seedream 原生结构提交图像任务
- 同步返回,一次响应给出全部结果
- 文生图、单图编辑、多图融合由 image 决定
认证
所有接口均使用 Bearer Token 进行认证。
Seedream 系列的接口需要在 ark 站 单独获取 Key,与 api 站的 Key 不通用。
请求时在请求头中添加:
Authorization: Bearer YOUR_ARK_KEYAll endpoints authenticate with a Bearer token.
Seedream series endpoints require a key obtained separately from the ark site; it isn't shared with the api site's key.
Add it to the request header:
Authorization: Bearer YOUR_ARK_KEY请求结构
把客户端 base_url 配成 https://ark.oairoute.com/doubao/api/v3,即可沿用方舟的字段名直接对接。
请求体是平铺的 JSON,没有 content 数组。字段与方舟 API 一致并原样透传,上游新增参数无需网关升级。
文生图、图生图还是多图融合,只由 image 字段决定:
| 场景 | image |
|---|---|
| 文生图 | 不传 |
| 单图编辑 | 字符串,公网 URL 或 data: URI |
| 多图融合 | 字符串数组,最多 10 张 |
model 必须写全名。seedream-5 之类的缩写会返回 400。
Point the client's base_url at https://ark.oairoute.com/doubao/api/v3 and Ark's field names work as-is.
The body is flat JSON with no content array. Fields match the Ark API and pass through unchanged, so new upstream parameters need no gateway upgrade.
Text-to-image, single-image edit, or multi-image fusion is decided solely by image:
| Scenario | image |
|---|---|
| Text to image | Omitted |
| Single-image edit | A string: public URL or data: URI |
| Multi-image fusion | A string array, up to 10 |
model must be the full name. Abbreviations such as seedream-5 return 400.
支持的场景
| 场景 | 字段组合 |
|---|---|
| 文生图 | prompt |
| 文生图-指定像素 | prompt + size: "2048x2048" |
| 单图编辑 | prompt + image(字符串) |
| 多图融合 | prompt + image(2 到 10 张数组) |
| 按坐标编辑 | prompt 中带 [x1, y1, x2, y2] 坐标 + image |
| 生成组图 | sequential_image_generation: "auto" + sequential_image_generation_options.max_images |
| Base64 输入 | image 传 data:image/<格式>;base64,... |
| 图层拆分 | image(恰好 1 张)+ layer_decomposition: true |
| 透明背景 | image(1 张)+ background: transparent + output_format: png |
| Scenario | Field combination |
|---|---|
| Text to image | prompt |
| Text to image at exact pixels | prompt + size: "2048x2048" |
| Single-image edit | prompt + image (a string) |
| Multi-image fusion | prompt + image (2 to 10 array) |
| Coordinate edit | prompt carrying [x1, y1, x2, y2] + image |
| Image group | sequential_image_generation: "auto" + sequential_image_generation_options.max_images |
| Base64 input | image set to a data:image/<format>;base64,... URI |
| Layer decomposition | image (exactly 1) + layer_decomposition: true |
| Transparent background | image (1) + background: transparent + output_format: png |
请求参数
图像模型 ID,必须写全名。取值见下方模型列表。
图像描述。图生图时描述你想要的改动;layer_decomposition 为 true 时可不传。
参考图。每一项是公网 URL 或格式小写的 data:image/<format>;base64,... URI。最多 10 张,单张不超过 30MB。从第二张参考图起额外计费。
输出尺寸,两种写法二选一:档位 1K、1.5K、2K;或具体像素 宽x高,范围 1024x1024 到 4096x4096,宽高比 1:16 到 16:1。默认 2K。layer_decomposition 为 true 时只接受 1K、1.5K、2K 或 auto。
默认 url,返回有效期 24 小时的临时链接。本路径只支持 url,传 b64_json 会被拒绝;需要 Base64 请改用 POST /v1/images/generations。
默认 true,为 true 时在右下角添加「AI 生成」水印。需要无水印必须显式传 false。
随机种子,用于复现结果,取值 -1 到 2147483647,-1 为随机。
提示词遵循强度,值越高越严格贴合提示词。
输出图片格式,取值 jpeg(默认)或 png。
opaque(默认)为正常背景;transparent 为透明背景,要求恰好一张参考图,且不能与 output_format: jpeg 同时使用。
生成前由模型扩写并优化提示词。
提示词优化设置,仅在启用提示词优化时生效。mode 取 standard 或 fast,fast 仅 pro 支持。
默认 false。把输入拆成底图与若干独立图层,要求恰好一张参考图,每个输出图层单独计费。为 true 时 prompt 可省略。
取值 auto 开启组图,或 disabled 关闭。配合 sequential_image_generation_options.max_images 控制张数,参考图与生成图合计不超过 15 张。
不支持,已废弃。网关始终一次性返回完整 JSON,传 true 会被拒绝。
The image model ID. It must be the full name; see the model list below.
The image description. For image-to-image, describe the change you want. Can be omitted when layer_decomposition is true.
The reference image(s). Each entry is a public URL or a data:image/<format>;base64,... URI with a lowercase format. Up to 10 images, each under 30MB. Images past the first are billed extra.
Output size, written either as a tier (1K, 1.5K, 2K) or exact pixels widthxheight from 1024x1024 to 4096x4096, with an aspect ratio between 1:16 and 16:1. Defaults to 2K. With layer_decomposition: true only 1K, 1.5K, 2K, or auto are accepted.
Defaults to url, which returns a temporary link valid for 24 hours. This path accepts only url; b64_json is rejected. Use POST /v1/images/generations for Base64.
Defaults to true, which stamps an "AI generated" mark in the bottom-right corner. Pass false explicitly to remove it.
Random seed for reproducing results, from -1 to 2147483647; -1 means random.
Prompt adherence strength. Higher values follow the prompt more strictly.
Output format: jpeg (default) or png.
opaque (default) keeps a normal background. transparent requires exactly one reference image and can't be combined with output_format: jpeg.
Lets the model expand and refine the prompt before generating.
Prompt-optimizer settings, used only when prompt optimization is on. mode is standard or fast; fast is supported by pro only.
Defaults to false. Splits the input into a base image plus separate layers. Requires exactly one reference image, and each output layer is billed separately. When true, prompt can be omitted.
Set to auto for an image group or disabled to turn it off. Pair with sequential_image_generation_options.max_images; references plus outputs stay within 15.
Not supported and deprecated. The gateway always returns complete JSON; true is rejected.
响应
同步返回,data 中每项对应一张生成的图片:
{
"data": [
{
"url": "https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/seedream/xxx.jpeg",
"size": "2048x2048",
"output_format": "jpeg"
}
],
"created": 1757469067,
"usage": {
"generated_images": 1,
"output_tokens": 15908,
"total_tokens": 15908
}
}data[].url(string) — 有效期 24 小时的图片链接,response_format为url时返回。data[].b64_json(string) —response_format为b64_json时返回的 Base64 内容。data[].size(string) — 该张图片的实际像素尺寸。data[].output_format(string) — 文件格式。图层固定为png,底图跟随请求中的output_format。data[].z_index(integer) — 图层叠放顺序,仅图层拆分时返回。底图固定为0,图层从1起递增。data[].name/data[].description(string) — 图层名称与描述,仅图层拆分时返回。data[].bounding_box(object) — 图层在底图坐标系中的区域,含absolute与normalized两套坐标。data[].error(object) — 单图失败信息,仅组图场景中某一张失败时出现。created(integer) — 完成时间,Unix 秒。usage(object) — 用量信息,含generated_images、input_images、output_tokens、total_tokens。
生成是同步的,请求会阻塞到全部图片出完。1K 通常几十秒内返回,2K 更久,客户端超时建议设到 5 分钟以上。
The response is synchronous; each entry in data is one generated image:
{
"data": [
{
"url": "https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/seedream/xxx.jpeg",
"size": "2048x2048",
"output_format": "jpeg"
}
],
"created": 1757469067,
"usage": {
"generated_images": 1,
"output_tokens": 15908,
"total_tokens": 15908
}
}data[].url(string) — an image link valid for 24 hours, returned whenresponse_formatisurl.data[].b64_json(string) — inline Base64, returned whenresponse_formatisb64_json.data[].size(string) — the actual pixel size of that image.data[].output_format(string) — the file format. Layers are alwayspng; the base image follows the request.data[].z_index(integer) — layer stacking order, layer decomposition only. The base image is0; layers count up from1.data[].name/data[].description(string) — layer name and description, layer decomposition only.data[].bounding_box(object) — the layer's region in base-image coordinates, withabsoluteandnormalizedsets.data[].error(object) — per-image failure, present only when one image in a group fails.created(integer) — completion time in Unix seconds.usage(object) — usage facts:generated_images,input_images,output_tokens,total_tokens.
Generation is synchronous: the request blocks until every image is done. 1K usually returns within tens of seconds and 2K takes longer, so set the client timeout to at least 5 minutes.
错误码
| HTTP | 含义 |
|---|---|
| 400 | 请求参数错误:模型未知、size 超出模型范围、参考图过多、该模型不支持的字段,或 response_format 不是 url |
| 401 | Token 缺失或无效,type 为 authentication_error |
| 429 | 触发限流 |
| HTTP | Meaning |
|---|---|
| 400 | Invalid parameters: unknown model, size outside the model's range, too many reference images, a field the model doesn't support, or a response_format other than url |
| 401 | Token missing or invalid, with type authentication_error |
| 429 | Rate limit hit |
For more status codes and retry guidance see Error codes and rate limits; for troubleshooting steps see the FAQ.
支持的模型列表
以下图像模型均可通过本接口提交任务,清单只列各厂商最新一代,实际可用范围以你的账号分组为准:
Midjourney 系列
Midjourney 走操作型接口,模型只有一档,具体动作(放大、扩图、变体等)见图像系列文档。
OpenAI 图像 系列
gpt-image-2.5-flare最新一代,支持参考图编辑gpt-image-2上一代主力gpt-image-1.5轻量,出图快gpt-image-1-mini成本最低 等
Google 图像 系列
gemini-3-pro-image旗舰,4K 输出与文字渲染强gemini-3.1-flash-image轻量,适合批量 等
Seedream 系列
seedream-5.0-pro旗舰,画质与文字准确度最好seedream-5.0-flash轻量,出图快 等
更多模型持续更新中…
GET https://ark.oairoute.com/api/pricing。Every image model below can be submitted through this endpoint; the list shows only each vendor's latest generation, and what your account group actually allows takes precedence:
Midjourney 系列
Midjourney 走操作型接口,模型只有一档,具体动作(放大、扩图、变体等)见图像系列文档。
OpenAI 图像 系列
gpt-image-2.5-flare最新一代,支持参考图编辑gpt-image-2上一代主力gpt-image-1.5轻量,出图快gpt-image-1-mini成本最低 等
Google 图像 系列
gemini-3-pro-image旗舰,4K 输出与文字渲染强gemini-3.1-flash-image轻量,适合批量 等
Seedream 系列
seedream-5.0-pro旗舰,画质与文字准确度最好seedream-5.0-flash轻量,出图快 等
更多模型持续更新中…
GET https://ark.oairoute.com/api/pricing.使用示例
同步返回,无需轮询
提交后直接在响应里拿 data[].url。链接 24 小时有效,需要长期保存请及时转存。
组图
sequential_image_generation: "auto" 一次最多返回 4 张同主题图片,例如同一角色在早晨、正午、傍晚的样子。某一张失败时该数组项只带 error,其余照常返回。
图层还原
拆分得到的图层按 z_index 从小到大叠放。绝对坐标换算为 x=left、y=top、w=right−left、h=bottom−top;任意 W×H 画布用归一化值除以 1000 再乘画布尺寸。
关闭水印
默认带「AI 生成」水印,商用场景必须显式传 watermark: false。是否允许去水印取决于你的账号分组。
Synchronous, no polling
Read data[].url straight from the response. Links last 24 hours, so download anything you need to keep.
Image groups
sequential_image_generation: "auto" returns up to 4 images on one theme, such as the same character in the morning, at noon, and in the evening. If one fails, that array entry carries only error while the rest still return.
Layer reconstruction
Stack the returned layers by ascending z_index. Convert absolute boxes with x=left, y=top, w=right−left, h=bottom−top; on an arbitrary W×H canvas, divide the normalized values by 1000 and multiply by the canvas size.
Turn off the watermark
An "AI generated" watermark is on by default; commercial use must pass watermark: false explicitly. Whether removal is allowed depends on your account group.