Edit image
Image-to-image / image editing: GPT Image (supports mask), Seedream, and Gemini in the "Gemini (all models, incl. image)" group.
/v1/images/editsGenerates from reference images or edits locally. multipart/form-data is recommended (local files; reference image field image / image[], repeatable); JSON is also accepted (reference images as HTTP(S) URLs or Data URLs). Field names are the same in both. The example on the right uses JSON; for multipart see the Image generation guide.
JSON edits and async tasks do not keep output_compression, moderation, user or response_format. The "Gemini Official Direct" group has no such endpoint; pass reference images to Create image instead.
Headers
Bearer sk-…: an API key created in the console under API keys; its group must include the requested model
respond-async: GPT Image / Gemini immediately return 202 Accepted with task_id and status_url; then poll GET /v1/images/tasks?task_id=…. Recommended for large 2K / 4K images. Seedream ignores this header and returns synchronously as usual
Valuesrespond-async
Body parametersJSON
data[].b64_json. Up to 16 reference images.First confirm that GET /v1/models for the current key includes this ID
Generation or editing instruction; empty returns 400 prompt must not be empty. The gateway sets no length limit; the official cap applies
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length1–32000 chars
E.g. 1024x1024, 2048x2048, 3840x2160. Invalid sizes return 400 before generation and are not billed; 1K / 2K / 4K are not accepted
Limitsauto or WxH: sides multiples of 16, each side ≤ 3840, long-to-short ratio ≤ 3:1, total pixels 655360–8294400
Higher tiers produce more output tokens and cost more: at 1024x1024, measured output is about 200 tokens for low, 1,760 for high, 3,120 for xhigh and 7,020 for max
Valuesautolowmediumhigh
LimitsNot validated by the gateway, forwarded as-is; higher tiers produce more output tokens
Some groups support only 1; larger values return 400. Values ≤ 0 are treated as 1
Range1–10Default1
transparent requires png or webp; transparent backgrounds on 2.0 are a preview capability
Valuesautoopaquetransparent
Sets the format of the decoded b64_json
Valuespngjpegwebp
jpeg / webp only; kept only in synchronous generations JSON and multipart edits
Range0–100Default100
Does not turn off content safety checks
Valuesautolow
End-user identifier string; not a HopBase account ID, and it does not change billing attribution
Always returned as b64_json whatever you pass; you cannot get a download link via url, so omit it
true switches to HopBase Images SSE (keepalives are sent meanwhile; only the last data: event is the Images JSON, ending with [DONE]), not OpenAI's native per-image preview events. Keep it false in SDKs
Limitstrue returns HopBase Images SSE; keep false in SDKsDefaultfalse
Compatibility field; GPT Image 2 processes reference images at high fidelity by default, so omit it
Valueslowhigh
Multipart files (image / image[]), or in JSON an HTTP(S) URL / Data URL string or array of strings. images is not read; raw base64 and file_id are not accepted; images may be compressed before forwarding
Limits1–16 images (official cap); remote URLs ≤ 26214400 bytes each and must return image/*. Only image is read, not images
Transparent areas mark what to edit; the gateway scales the mask to the size of the first reference image. Pixels outside the mask are not guaranteed to stay identical
LimitsPNG with an alpha channel; transparent areas mark what to edit
- transparent requires png or webp
- output_compression applies only to jpeg / webp
First confirm that GET /v1/models for the current key includes this ID
Generation or editing instruction; empty returns 400 prompt must not be empty. The gateway sets no length limit; the official cap applies
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length1–32000 chars
E.g. 1024x1024, 2048x2048, 3840x2160. Invalid sizes return 400 before generation and are not billed; 1K / 2K / 4K are not accepted
Limitsauto or WxH: sides multiples of 16, each side ≤ 3840, long-to-short ratio ≤ 3:1, total pixels 655360–8294400
Higher tiers produce more output tokens and cost more: at 1024x1024, measured output is about 200 tokens for low, 1,760 for high, 3,120 for xhigh and 7,020 for max
Valuesautolowmediumhighxhighmax
LimitsNot validated by the gateway, forwarded as-is; higher tiers produce more output tokens
Some groups support only 1; larger values return 400. Values ≤ 0 are treated as 1
Range1–10Default1
transparent requires png or webp; transparent backgrounds on 2.0 are a preview capability
Valuesautoopaquetransparent
Sets the format of the decoded b64_json
Valuespngjpegwebp
jpeg / webp only; kept only in synchronous generations JSON and multipart edits
Range0–100Default100
Does not turn off content safety checks
Valuesautolow
End-user identifier string; not a HopBase account ID, and it does not change billing attribution
Always returned as b64_json whatever you pass; you cannot get a download link via url, so omit it
true switches to HopBase Images SSE (keepalives are sent meanwhile; only the last data: event is the Images JSON, ending with [DONE]), not OpenAI's native per-image preview events. Keep it false in SDKs
Limitstrue returns HopBase Images SSE; keep false in SDKsDefaultfalse
Compatibility field; GPT Image 2 processes reference images at high fidelity by default, so omit it
Valueslowhigh
Multipart files (image / image[]), or in JSON an HTTP(S) URL / Data URL string or array of strings. images is not read; raw base64 and file_id are not accepted; images may be compressed before forwarding
Limits1–16 images (official cap); remote URLs ≤ 26214400 bytes each and must return image/*. Only image is read, not images
Transparent areas mark what to edit; the gateway scales the mask to the size of the first reference image. Pixels outside the mask are not guaranteed to stay identical
LimitsPNG with an alpha channel; transparent areas mark what to edit
- transparent requires png or webp
- output_compression applies only to jpeg / webp
First confirm that GET /v1/models for the current key includes this ID
Generation or editing instruction; empty returns 400 prompt must not be empty. The gateway sets no length limit; the official cap applies
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length1–32000 chars
E.g. 1024x1024, 2048x2048, 3840x2160. Invalid sizes return 400 before generation and are not billed; 1K / 2K / 4K are not accepted
Limitsauto or WxH: sides multiples of 16, each side ≤ 3840, long-to-short ratio ≤ 3:1, total pixels 655360–8294400
Higher tiers produce more output tokens and cost more: at 1024x1024, measured output is about 200 tokens for low, 1,760 for high, 3,120 for xhigh and 7,020 for max
Valuesautolowmediumhighxhighmax
LimitsNot validated by the gateway, forwarded as-is; higher tiers produce more output tokens
Some groups support only 1; larger values return 400. Values ≤ 0 are treated as 1
Range1–10Default1
transparent requires png or webp; transparent backgrounds on 2.0 are a preview capability
Valuesautoopaquetransparent
Sets the format of the decoded b64_json
Valuespngjpegwebp
jpeg / webp only; kept only in synchronous generations JSON and multipart edits
Range0–100Default100
Does not turn off content safety checks
Valuesautolow
End-user identifier string; not a HopBase account ID, and it does not change billing attribution
Always returned as b64_json whatever you pass; you cannot get a download link via url, so omit it
true switches to HopBase Images SSE (keepalives are sent meanwhile; only the last data: event is the Images JSON, ending with [DONE]), not OpenAI's native per-image preview events. Keep it false in SDKs
Limitstrue returns HopBase Images SSE; keep false in SDKsDefaultfalse
Compatibility field; GPT Image 2 processes reference images at high fidelity by default, so omit it
Valueslowhigh
Multipart files (image / image[]), or in JSON an HTTP(S) URL / Data URL string or array of strings. images is not read; raw base64 and file_id are not accepted; images may be compressed before forwarding
Limits1–16 images (official cap); remote URLs ≤ 26214400 bytes each and must return image/*. Only image is read, not images
Transparent areas mark what to edit; the gateway scales the mask to the size of the first reference image. Pixels outside the mask are not guaranteed to stay identical
LimitsPNG with an alpha channel; transparent areas mark what to edit
- transparent requires png or webp
- output_compression applies only to jpeg / webp
GET /v1/models for the current key is authoritative
If the model refuses or replies with text only, returns 400 (the message quotes that text) or 502: rephrase the prompt
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length≥ 1 chars
Generated in parallel. All or nothing: if any image fails, the whole request fails and is not billed
LimitsCapped by output tier: 1K ≤ 10, 2K ≤ 5Range1–10Default1
Flat top-level form, equivalent to google.image_config.image_size; overrides the tier derived from size
Values1K2K
Default"1K"
Flat top-level form, equivalent to google.image_config.aspect_ratio; takes precedence over size
Values1:12:33:23:44:34:55:49:1616:921:9
Default"1:1"
WxH is never rejected for its ratio: it maps to the closest official ratio, and the tier is derived from the long edge and silently lowered to the model's highest tier. An explicit 1K / 2K / 4K above the model's tier returns 400; if image_size is also sent, it wins
Values1K2K
Limitsauto, WxH at any ratio (mapped to the closest official ratio; the tier is derived from the long edge and silently lowered to the model's highest tier), or a model tier
In SDKs it can be written as extra_body.google.image_config; all three forms are equivalent
Values1:12:33:23:44:34:55:49:1616:921:9
Values1K2K
Reference images, placed directly in the generations request body; if both are sent, images wins. On "Gemini Official Direct" each image must be ≤ 20 MiB decoded, and there is no /v1/images/edits
Same as image; if both are sent, images wins
LimitsReference images: a string or array of strings, up to 14
Not supported: sending mask returns 400; describe the region to change in the prompt instead
transparent is not supported (returns 400)
Must not be"transparent"
Not supported; omit it or pass false
Must not betrue
- At most 5 images per request for 2K output (response size limit)
GET /v1/models for the current key is authoritative
If the model refuses or replies with text only, returns 400 (the message quotes that text) or 502: rephrase the prompt
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length≥ 1 chars
Generated in parallel. All or nothing: if any image fails, the whole request fails and is not billed
LimitsCapped by output tier: 1K ≤ 10, 2K ≤ 5Range1–10Default1
Flat top-level form, equivalent to google.image_config.image_size; overrides the tier derived from size
Values1K2K
Default"1K"
Flat top-level form, equivalent to google.image_config.aspect_ratio; takes precedence over size
Values1:12:33:23:44:34:55:49:1616:921:9
Default"1:1"
WxH is never rejected for its ratio: it maps to the closest official ratio, and the tier is derived from the long edge and silently lowered to the model's highest tier. An explicit 1K / 2K / 4K above the model's tier returns 400; if image_size is also sent, it wins
Values1K2K
Limitsauto, WxH at any ratio (mapped to the closest official ratio; the tier is derived from the long edge and silently lowered to the model's highest tier), or a model tier
In SDKs it can be written as extra_body.google.image_config; all three forms are equivalent
Values1:12:33:23:44:34:55:49:1616:921:9
Values1K2K
Reference images, placed directly in the generations request body; if both are sent, images wins. On "Gemini Official Direct" each image must be ≤ 20 MiB decoded, and there is no /v1/images/edits
Same as image; if both are sent, images wins
LimitsReference images: a string or array of strings, up to 14
Not supported: sending mask returns 400; describe the region to change in the prompt instead
transparent is not supported (returns 400)
Must not be"transparent"
Not supported; omit it or pass false
Must not betrue
- At most 5 images per request for 2K output (response size limit)
GET /v1/models for the current key is authoritative
If the model refuses or replies with text only, returns 400 (the message quotes that text) or 502: rephrase the prompt
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length≥ 1 chars
Generated in parallel. All or nothing: if any image fails, the whole request fails and is not billed
LimitsCapped by output tier: 1K ≤ 10, 2K ≤ 5, 4K ≤ 2Range1–10Default1
Flat top-level form, equivalent to google.image_config.image_size; overrides the tier derived from size
Values1K2K4K
Default"1K"
Flat top-level form, equivalent to google.image_config.aspect_ratio; takes precedence over size
Values1:12:33:23:44:34:55:49:1616:921:9
Default"1:1"
WxH is never rejected for its ratio: it maps to the closest official ratio, and the tier is derived from the long edge and silently lowered to the model's highest tier. An explicit 1K / 2K / 4K above the model's tier returns 400; if image_size is also sent, it wins
Values1K2K4K
Limitsauto, WxH at any ratio (mapped to the closest official ratio; the tier is derived from the long edge and silently lowered to the model's highest tier), or a model tier
In SDKs it can be written as extra_body.google.image_config; all three forms are equivalent
Values1:12:33:23:44:34:55:49:1616:921:9
Values1K2K4K
Reference images, placed directly in the generations request body; if both are sent, images wins. On "Gemini Official Direct" each image must be ≤ 20 MiB decoded, and there is no /v1/images/edits
Same as image; if both are sent, images wins
LimitsReference images: a string or array of strings, up to 14
Not supported: sending mask returns 400; describe the region to change in the prompt instead
transparent is not supported (returns 400)
Must not be"transparent"
Not supported; omit it or pass false
Must not betrue
- At most 5 images per request for 2K output (response size limit)
- At most 2 images per request for 4K output (response size limit)
GET /v1/models for the current key is authoritative
If the model refuses or replies with text only, returns 400 (the message quotes that text) or 502: rephrase the prompt
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length≥ 1 chars
Generated in parallel. All or nothing: if any image fails, the whole request fails and is not billed
LimitsCapped by output tier: 1K ≤ 10Range1–10Default1
Flat top-level form, equivalent to google.image_config.image_size; overrides the tier derived from size
Values1K
Default"1K"
Flat top-level form, equivalent to google.image_config.aspect_ratio; takes precedence over size
Values1:12:33:23:44:34:55:49:1616:921:9
Default"1:1"
WxH is never rejected for its ratio: it maps to the closest official ratio, and the tier is derived from the long edge and silently lowered to the model's highest tier. An explicit 1K / 2K / 4K above the model's tier returns 400; if image_size is also sent, it wins
Values1K
Limitsauto, WxH at any ratio (mapped to the closest official ratio; the tier is derived from the long edge and silently lowered to the model's highest tier), or a model tier
In SDKs it can be written as extra_body.google.image_config; all three forms are equivalent
Values1:12:33:23:44:34:55:49:1616:921:9
Values1K
Reference images, placed directly in the generations request body; if both are sent, images wins. On "Gemini Official Direct" each image must be ≤ 20 MiB decoded, and there is no /v1/images/edits
Same as image; if both are sent, images wins
LimitsReference images: a string or array of strings, up to 14
Not supported: sending mask returns 400; describe the region to change in the prompt instead
transparent is not supported (returns 400)
Must not be"transparent"
Not supported; omit it or pass false
Must not betrue
GET /v1/models for the current key is authoritative
If the model refuses or replies with text only, returns 400 (the message quotes that text) or 502: rephrase the prompt
LimitsMust not be empty after trimming whitespace, otherwise 400 "prompt must not be empty"Length≥ 1 chars
Generated in parallel. All or nothing: if any image fails, the whole request fails and is not billed
LimitsCapped by output tier: 1K ≤ 10Range1–10Default1
Flat top-level form, equivalent to google.image_config.image_size; overrides the tier derived from size
Values1K
Default"1K"
Flat top-level form, equivalent to google.image_config.aspect_ratio; takes precedence over size
Values1:12:33:23:44:34:55:49:1616:921:9
Default"1:1"
WxH is never rejected for its ratio: it maps to the closest official ratio, and the tier is derived from the long edge and silently lowered to the model's highest tier. An explicit 1K / 2K / 4K above the model's tier returns 400; if image_size is also sent, it wins
Values1K
Limitsauto, WxH at any ratio (mapped to the closest official ratio; the tier is derived from the long edge and silently lowered to the model's highest tier), or a model tier
In SDKs it can be written as extra_body.google.image_config; all three forms are equivalent
Values1:12:33:23:44:34:55:49:1616:921:9
Values1K
Reference images, placed directly in the generations request body; if both are sent, images wins. On "Gemini Official Direct" each image must be ≤ 20 MiB decoded, and there is no /v1/images/edits
Same as image; if both are sent, images wins
LimitsReference images: a string or array of strings, up to 3
Not supported: sending mask returns 400; describe the region to change in the prompt instead
transparent is not supported (returns 400)
Must not be"transparent"
Not supported; omit it or pass false
Must not betrue
Use the full ID returned by GET /v1/models for the current key
Image content, composition, style or editing instruction; for local edits you can describe coordinates, a bbox, arrows or areas drawn on the reference image
LimitsMust not be empty after trimming whitespace, otherwise 400 "missing prompt"Length≥ 1 chars
Invalid values return 400 before generation with the valid range, and are not billed
Values1K1.5K2K
LimitsShorthand 1K / 1.5K / 2K, or WxH: total pixels 921600–4624220, aspect ratio 1:16–16:1
Other values (including null) return 400
Limitsonly a single output is supported (n=1)Default1
Returns a signed direct link valid for 24 hours
Valuesurl
Default"url"
jpeg only on 4.5
Valuespngjpeg
Must be an object
Valuesstandardfast
Passing it triggers single- or multi-image image-to-image or editing; /v1/images/edits requires at least 1. URLs are not downloaded or size-checked at submission
LimitsReference images (passing them triggers image-to-image / editing): up to 10; Data URLs ≤ 31457280 bytes each; URLs are not downloaded at submission
Always false server-side
LimitsAlways false server-side; passing it has no effect
Not supported: /v1/images/edits with mask returns 400 (null too)
Use the full ID returned by GET /v1/models for the current key
Image content, composition, style or editing instruction; for local edits you can describe coordinates, a bbox, arrows or areas drawn on the reference image
LimitsMust not be empty after trimming whitespace, otherwise 400 "missing prompt"Length≥ 1 chars
Invalid values return 400 before generation with the valid range, and are not billed
Values2K3K4K
LimitsShorthand 2K / 3K / 4K, or WxH: total pixels 3686400–16777216, aspect ratio 1:16–16:1
Other values (including null) return 400
Limitsonly a single output is supported (n=1)Default1
Returns a signed direct link valid for 24 hours
Valuesurl
Default"url"
jpeg only on 4.5
Valuespngjpeg
Must be an object
Valuesstandard
Passing it triggers single- or multi-image image-to-image or editing; /v1/images/edits requires at least 1. URLs are not downloaded or size-checked at submission
LimitsReference images (passing them triggers image-to-image / editing): up to 14; Data URLs ≤ 31457280 bytes each; URLs are not downloaded at submission
Always false server-side
LimitsAlways false server-side; passing it has no effect
Not supported: /v1/images/edits with mask returns 400 (null too)
Use the full ID returned by GET /v1/models for the current key
Image content, composition, style or editing instruction; for local edits you can describe coordinates, a bbox, arrows or areas drawn on the reference image
LimitsMust not be empty after trimming whitespace, otherwise 400 "missing prompt"Length≥ 1 chars
Invalid values return 400 before generation with the valid range, and are not billed
Values2K4K
LimitsShorthand 2K / 4K, or WxH: total pixels 3686400–16777216, aspect ratio 1:16–16:1
Other values (including null) return 400
Limitsonly a single output is supported (n=1)Default1
Returns a signed direct link valid for 24 hours
Valuesurl
Default"url"
jpeg only on 4.5
Valuesjpeg
Must be an object
Valuesstandard
Passing it triggers single- or multi-image image-to-image or editing; /v1/images/edits requires at least 1. URLs are not downloaded or size-checked at submission
LimitsReference images (passing them triggers image-to-image / editing): up to 14; Data URLs ≤ 31457280 bytes each; URLs are not downloaded at submission
Always false server-side
LimitsAlways false server-side; passing it has no effect
Not supported: /v1/images/edits with mask returns 400 (null too)
Returns
200Synchronous success
202With Prefer: respond-async
Unix seconds
One entry per image
GPT Image / Gemini: Base64 image data; save it after decoding according to output_format. Gemini may return JPEG, so check mime_type
Seedream: signed direct link valid for 24 hours; once expired, the only option is to regenerate
Image MIME type
Prompt as rewritten by the model (some models)
May be returned
Input tokens
Output tokens
Total
Errors
missing_api_key / invalid_api_key / api_key_expired)insufficient_quota)model_not_found), or the path does not belong to the group (route_not_found)request_too_large)user_concurrency_limit / apikey_concurrency_limit), with Retry-After