编辑图像
- 请求体与生成接口相同,必须带 image
- 没有 mask 字段,局部改动用坐标标记
- 同步返回,一次响应给出结果
认证
所有接口均使用 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请求结构
请求体与生成图像完全相同,唯一区别是必须提供至少一张参考图,通过 image 字段传入。
用 multipart/form-data 上传源图文件,或用 JSON 把 image 设为 URL 或 data: URI。
本接口没有独立的蒙版字段。需要只改局部时,改用坐标编辑:在 prompt 里写 <bbox> 或 [x1, y1, x2, y2] 指定区域。
The body is identical to Generate image; the one difference is that at least one reference image must be supplied through image.
Upload the source file with multipart/form-data, or set image to a URL or data: URI in JSON.
This endpoint has no dedicated mask field. To change only part of the image, use a coordinate edit instead: put <bbox> or [x1, y1, x2, y2] in prompt.
支持的场景
| 场景 | 字段组合 |
|---|---|
| 整体重绘 | image + prompt |
| 多图参考 | image(2 到 10 张数组)+ prompt |
| 局部修改 | image + prompt 内带坐标标记 |
| 上传文件 | multipart/form-data,image 传文件 |
| Scenario | Field combination |
|---|---|
| Full redraw | image + prompt |
| Multi-image reference | image (2 to 10 array) + prompt |
| Partial change | image + a coordinate marker inside prompt |
| File upload | multipart/form-data with image as a file |
请求参数
图像模型 ID,必须写全名。取值见下方模型列表。
待编辑的底图。公网 URL、data:image/<格式>;base64,...,或用 multipart 直接上传文件。格式标识须小写,最多 10 张,单张不超过 30MB。
编辑描述。写清要改什么、改成什么样,不要重复描述没变的部分。layer_decomposition 为 true 时可不传。
输出尺寸,档位 1K、1.5K、2K,或具体像素 宽x高,默认 2K。
url(默认,24 小时有效)或 b64_json。
默认 true。需要无水印必须显式传 false。
jpeg(默认)或 png。
transparent 配合 output_format: png 可保留透明背景,要求恰好一张参考图。
随机种子,-1 为随机。
提示词遵循强度。
只能是 1,传大于 1 会返回 400。
图层拆分,要求恰好一张参考图。
不支持,传 true 会被拒绝。
The image model ID; it must be the full name. See the model list below.
The base image to edit: a public URL, a data:image/<format>;base64,... URI, or a file uploaded via multipart. The format must be lowercase. Up to 10 images, each under 30MB.
What to change and how. Don't restate what stays the same. Can be omitted when layer_decomposition is true.
Output size as a tier (1K, 1.5K, 2K) or exact pixels widthxheight. Defaults to 2K.
url (default, valid 24 hours) or b64_json.
Defaults to true. Pass false explicitly to remove it.
jpeg (default) or png.
transparent with output_format: png keeps a transparent background; requires exactly one reference image.
Random seed; -1 means random.
Prompt adherence strength.
Must be 1; values above 1 return 400.
Layer decomposition; requires exactly one reference image.
Not supported; true is rejected.
用 multipart 上传本地文件
请求体可以走 multipart/form-data,用文件而非 URL 提交底图。所有标量字段都是字符串。
curl --request POST \
--url 'https://ark.oairoute.com/v1/images/edits' \
--header 'Authorization: Bearer YOUR_ARK_KEY' \
--form 'model=doubao-seedream-5-0-pro-260628' \
--form '[email protected]' \
--form 'prompt=Turn this photo into a night scene' \
--form 'size=2K'The body can use multipart/form-data to send the base image as a file rather than a URL. Every scalar field is a string.
curl --request POST \
--url 'https://ark.oairoute.com/v1/images/edits' \
--header 'Authorization: Bearer YOUR_ARK_KEY' \
--form 'model=doubao-seedream-5-0-pro-260628' \
--form '[email protected]' \
--form 'prompt=Turn this photo into a night scene' \
--form 'size=2K'局部修改怎么做
本接口没有 mask。要只改画面中的一块区域,把区域写进提示词:
- 框选:
把框 [225, 442, 796, 1414] 内的区域替换成一把红色纸伞 - 或在图片上先画好标记再上传,用自然语言描述要改的地方
坐标是该图的像素坐标,原点在左上角。模型只处理描述到的区域,其余保持不变。
mask、mask_url、image_url 都不是本接口的字段,传了不会生效。
This endpoint has no mask. To change only one region, describe the region in the prompt:
- Box selection:
Replace the area inside [225, 442, 796, 1414] with a red paper umbrella - Or draw marks on the image first and upload it, then describe the change in words
Coordinates are that image's pixels with the origin at the top-left. The model touches only the described region and leaves the rest alone.
mask, mask_url, and image_url are not fields of this endpoint and have no effect.
编辑技巧
提示词描述目标状态
与其写「把红衣服改成蓝衣服」,不如写「人物穿蓝色外套,其余不变」。
保留构图
希望整体风格不动、只微调细节时,在提示词里强调「保持构图、光线与人物不变」。
多轮编辑会累积失真
每次编辑都重新编码,反复五次以上画质会明显下降。需要多步修改时尽量一次说清,或从原图重新开始。
Describe the target state
Rather than "change the red shirt to blue", write "the person wears a blue coat; everything else unchanged".
Preserve the composition
When the overall look should stay and only details change, stress "keep the composition, lighting, and subject unchanged".
Repeated edits accumulate loss
Each edit re-encodes the image; beyond about five rounds quality drops noticeably. Batch changes into one prompt or restart from the original.
响应
同步返回,结构与生成图像一致:
{
"data": [
{
"url": "https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/seedream/edit-xxx.jpeg",
"size": "2048x2048",
"output_format": "jpeg"
}
],
"created": 1757469067,
"usage": {
"generated_images": 1,
"input_images": 1,
"output_tokens": 15908,
"total_tokens": 15908
}
}data[].url(string) — 图片地址,response_format为url时返回,24 小时有效。data[].b64_json(string) —response_format为b64_json时返回。data[].size(string) — 实际像素尺寸。data[].output_format(string) — 文件格式。usage.input_images(integer) — 实际接收的参考图张数。
从第二张参考图起额外计费,usage.input_images 是计费依据。失败自动全额退款。
The response is synchronous and shaped like Generate image:
{
"data": [
{
"url": "https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/seedream/edit-xxx.jpeg",
"size": "2048x2048",
"output_format": "jpeg"
}
],
"created": 1757469067,
"usage": {
"generated_images": 1,
"input_images": 1,
"output_tokens": 15908,
"total_tokens": 15908
}
}data[].url(string) — the image link, returned whenresponse_formatisurl, valid 24 hours.data[].b64_json(string) — returned whenresponse_formatisb64_json.data[].size(string) — actual pixel size.data[].output_format(string) — the file format.usage.input_images(integer) — how many reference images were actually received.
Images past the first are billed extra, and usage.input_images is the basis. Failures are refunded in full.
错误码
| HTTP | 含义 |
|---|---|
| 400 | 参数错误,type 为 invalid_request_error |
| 401 | Token 缺失或无效,type 为 authentication_error |
| 429 | 触发限流 |
常见 400 原因:没有传 image;image 不是可访问的地址或 Base64 格式标识未小写;n 大于 1;参考图超过 10 张。
| HTTP | Meaning |
|---|---|
| 400 | Invalid parameters, with type invalid_request_error |
| 401 | Token missing or invalid, with type authentication_error |
| 429 | Rate limit hit |
Common 400 causes: no image; an unreachable URL or a Base64 format not in lowercase; n above 1; more than 10 reference images.
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 supports reference-image editing; 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.使用示例
整体重绘
只传原图与提示词,模型会在保留主体构图的前提下重画整张图。适合换风格、换材质这类改动。
返回 Base64
需要把结果直接存进数据库或内网服务时,用 b64_json 避免二次下载。
Full redraw
Send the source image and a prompt; the model repaints the whole frame while keeping the subject composition. Good for style or material changes.
Base64 output
When results go straight into a database or an internal service, use b64_json to avoid a second download.