Create image edit
Use POST /v1/images/edits in CometAPI to edit images with multipart uploads, masks, GPT image models, and encoded image output controls.
Use this route when
- You already have a source image and want a prompt-driven edit
- You may need a mask for targeted changes
- You can handle multipart file upload instead of a plain JSON request
Safe first request
- Start with one PNG or JPG file
- Skip the mask until the base edit flow works
- Use
model: "gpt-image-2"for GPT image edit requests on this route - Use one short instruction that asks for one visible change
- Read the edited result from
data[0].b64_json - Set
output_format: "jpeg"when you want a JPEG payload - Expect longer latency than plain image generation
Model behavior
- GPT image edit models on this route return inline base64 image data
output_formatcontrols the encoded image type insideb64_jsonresponse_formatonly matters when a model supports URL outputqwen-image-editfollows provider-specific edit behavior behind the same CometAPI route
Authorizations
Bearer token authentication. Use your CometAPI key.
Body
Source image file. Start with one PNG or JPG input for the simplest flow.
Edit instruction describing the change you want.
"Add a small red ribbon to the paper boat."
The image editing model to use. Choose a supported model from the Models page.
Optional PNG mask. Transparent areas mark the regions to edit. The mask dimensions must match the source image exactly.
Number of edited images to return.
Quality setting for models that support it.
high, medium, low Requested response container when supported by the selected model. GPT image edit models return data[].b64_json; use output_format to choose the encoded image type.
url, b64_json Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.
"jpeg"
Requested output size when supported by the selected model.
Response
Edited image result.
Background mode returned by models that expose it.
Encoded image type returned by GPT image models.
Quality level returned by models that expose it.
Output size returned by models that expose it.