Skip to Content
API ReferenceImageImage Editing

Create image editing

Use this interface to edit input images. The interface format is compatible with the OpenAI edits  protocol.

Authorization

Authorization

  • Type: HTTP Bearer Auth, value type string
  • Required
  • Description: Used to verify account information. Go to API Console , click Create Token to obtain.
Authorization: Bearer <YOUR_API_KEY>

Request Headers

Content-Type

  • Type: enum<string>
  • Required, fixed value multipart/form-data
  • Description: The media type of the request body. Must be multipart/form-data because image files are uploaded as form data. Client SDKs usually set this header automatically.

Request Body

Overview

ParameterTypeRequiredDefaultDescription
modelstringYes—Image editing model ID
imagefile[]Yes—Input image list. The field name is image[]
promptstringYes—Editing or layer-decoupling description
output_formatstringNopngOutput image format
response_formatstringNob64_jsonImage return format
sizestringNoautoOutput image size
watermarkbooleanNofalseWhether to add watermark

model

  • Type: string
  • Required
  • Description: The image editing model to use.
  • Options:
    • Ming-Image-0.1-Design — Supports general image editing.
    • Ming-Image-0.1-Design-Layer — Supports layer decoupling only.

image

  • Type: file[]
  • Required
  • Description: The input image list, which supports 1 to N images. Pass this field as image[] in form-data.
Ming-Image-0.1-Design-Layer supports only 1 input image.

prompt

  • Type: string
  • Required
  • Description: The description of the target editing result. When using Ming-Image-0.1-Design-Layer, use this parameter to guide layer decoupling, such as "Split into three layers".

output_format

  • Type: string
  • Optional, default png
  • Description: The output format of the generated image.
  • Options: png, jpeg, webp

Layers generated by Ming-Image-0.1-Design-Layer are always output in png format.


response_format

  • Type: string
  • Optional, default b64_json
  • Description: The format of the returned image.
  • Options:
    • url — Returns an image URL. The URL is valid for 24 hours.
    • b64_json — Returns Base64-encoded image data.

size

  • Type: string
  • Optional, default auto
  • Description: The output image size. Set to auto to let the model choose automatically; or specify it using the {w}x{h} format, such as "512x512".

Ming-Image-0.1-Design-Layer supports image sizes of 512 and above, such as "512x512" and "2048x2048".

Ming-Image-0.1-Design supports image sizes of 1K and above, such as "1024x1024" and "2048x2048".


watermark

  • Type: boolean
  • Optional, default false
  • Description: Whether to add watermarks to AI-generated images.
  • Options:
    • true — Enable the explicit watermark and implicit digital watermark generated by AI to comply with policy requirements.
    • false — Disable all watermarks.

Unsupported Parameters

The following OpenAI images/edits parameters are not supported by this interface:

  • background
  • n
  • input_fidelity
  • output_compression
  • partial_images
  • quality
  • stream

Response Body

created

  • Type: integer
  • Description: Unix timestamp in seconds representing when the response was generated.

id

  • Type: string
  • Description: The unique identifier of this request.

model

  • Type: string
  • Description: The model ID used for this request.

data

  • Type: object[]
  • Description: The edited image list.

data[].b64_json

  • Type: string
  • Description: Base64-encoded image data, returned when response_format is b64_json.

data[].url

  • Type: string
  • Description: Image URL, returned when response_format is url. The URL is valid for 24 hours.

data[].revised_prompt

  • Type: string
  • Optional
  • Description: The image description revised or supplemented by the model.

usage

  • Type: object
  • Description: Token and image-count usage statistics for this request. When billing is based on image count, use input_image_count and output_image_count.

usage.input_tokens

  • Type: integer
  • Description: Number of input tokens consumed, including image and text tokens.

usage.input_tokens_details

  • Type: object
  • Description: Breakdown of input tokens.
  • Fields:
    • image_tokens — Number of tokens consumed by image input.
    • text_tokens — Number of tokens consumed by text input.

usage.output_tokens

  • Type: integer
  • Description: Number of output tokens generated.

usage.output_tokens_details

  • Type: object
  • Description: Breakdown of output tokens.
  • Fields:
    • image_tokens — Number of tokens consumed by image output.
    • text_tokens — Number of tokens consumed by text output.

usage.total_tokens

  • Type: integer
  • Description: Total number of tokens consumed.

usage.input_image_count

  • Type: integer
  • Description: Number of input images in this request, equal to the number of images uploaded in image[].

usage.output_image_count

  • Type: integer
  • Description: Number of output images generated in this request. This value is used for image-count billing.

Example


Request Example

curl --location --request POST \ 'https://api.ant-ling.com/v1/images/edits' \ --header 'Authorization: Bearer <YOUR_API_KEY>' \ --form 'model="Ming-Image-0.1-Design-Layer"' \ --form 'prompt="Split into three layers"' \ --form 'image[]=@"/path/to/image.png"' \ --form 'size="1024x1024"'

Response Example

{ "created": 1713833628, "id": "0b446a1717930916439978967edcf9", "model": "Ming-Image-0.1-Design-Layer", "data": [ { "b64_json": "...", "revised_prompt": "..." } ], "usage": { "input_tokens": 0, "input_tokens_details": { "image_tokens": 0, "text_tokens": 0 }, "output_tokens": 4096, "output_tokens_details": { "image_tokens": 4096, "text_tokens": 0 }, "total_tokens": 4096, "input_image_count": 1, "output_image_count": 1 } }
Was this page helpful?
Last updated on