> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apigo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# /v1/images/edits

> OpenAI 호환 이미지 편집 모델을 사용하여 이미지를 편집하거나 인페인트합니다.

Use this endpoint for image edits, inpainting, and source-image transformations.

* Authenticate with `Authorization: Bearer {API_KEY}`
* This endpoint commonly uses `multipart/form-data`
* The required inputs are typically `image` and `prompt`, while `mask` narrows the editable region
* `gpt-image-1` and `dall-e-2` differ materially on file-size limits, multi-image support, and `input_fidelity`
* If the response contains temporary `url` values, mirror them quickly. If it contains `b64_json`, avoid decoding too many large images on the main thread


## OpenAPI

````yaml POST /v1/images/edits
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://maas.apigo.ai
security:
  - bearerAuth: []
paths:
  /v1/images/edits:
    post:
      summary: OpenAI image edits
      description: Edits or inpaints images with OpenAI-compatible image editing models.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OpenAIImagesEditsRequest'
      responses:
        '200':
          description: Successful image edit response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIImagesResponse'
              example:
                created: 1589478378
                background: auto
                output_format: png
                quality: high
                size: 1024x1024
                data:
                  - url: https://example.com/edited-image.png
                usage:
                  input_tokens: 18
                  input_tokens_details:
                    image_tokens: 5
                    text_tokens: 13
                  output_tokens: 1
                  total_tokens: 19
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    OpenAIImagesEditsRequest:
      type: object
      required:
        - image
        - prompt
      properties:
        image:
          oneOf:
            - type: string
              format: binary
              description: Single source image file.
            - type: array
              maxItems: 16
              items:
                type: string
                format: binary
              description: Multiple source image files. Primarily supported by gpt-image-1.
          description: Input image or images to edit.
        prompt:
          type: string
          description: Text instruction describing the desired edit.
          example: 在图片中添加一朵红色的玫瑰花
        background:
          type: string
          enum:
            - transparent
            - opaque
            - auto
          description: Only supported by gpt-image-1.
        input_fidelity:
          type: string
          enum:
            - high
            - low
          description: Only supported by gpt-image-1.
        mask:
          type: string
          format: binary
          description: Optional PNG mask file. Usually must match the image dimensions.
        model:
          type: string
          enum:
            - gpt-image-1
            - dall-e-2
          description: Image editing model.
        'n':
          type: integer
          minimum: 1
          maximum: 10
          default: 1
          description: Number of edited images to generate.
        output_compression:
          type: integer
          minimum: 0
          maximum: 100
          default: 100
          description: Compression level for gpt-image-1 jpeg/webp output.
        output_format:
          type: string
          enum:
            - png
            - jpeg
            - webp
          description: Only supported by gpt-image-1.
        partial_images:
          type: integer
          minimum: 0
          maximum: 3
          default: 0
          description: Number of partial images for streaming previews.
        quality:
          type: string
          enum:
            - auto
            - high
            - medium
            - low
            - standard
          description: Supported values vary by model.
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: Only applies to dall-e-2.
        size:
          type: string
          enum:
            - 1024x1024
            - 1536x1024
            - 1024x1536
            - auto
            - 256x256
            - 512x512
          description: Allowed values depend on the selected model.
        stream:
          type: boolean
          default: false
          description: Streams edited image output when supported.
        user:
          type: string
          description: Unique identifier for the end user.
    OpenAIImagesResponse:
      type: object
      required:
        - created
        - data
      properties:
        created:
          type: integer
          format: int64
          description: Unix timestamp in seconds.
        background:
          type: string
          enum:
            - transparent
            - opaque
            - auto
        output_format:
          type: string
          enum:
            - png
            - jpeg
            - webp
        quality:
          type: string
          enum:
            - auto
            - high
            - medium
            - low
            - hd
            - standard
        size:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/OpenAIImageData'
        usage:
          $ref: '#/components/schemas/OpenAIImageUsage'
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    OpenAIImageData:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Temporary URL for the generated image.
        b64_json:
          type: string
          description: Base64-encoded image payload.
        revised_prompt:
          type: string
          description: Provider-revised prompt when available.
    OpenAIImageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        input_tokens_details:
          $ref: '#/components/schemas/OpenAIImageTokenDetails'
        output_tokens:
          type: integer
        total_tokens:
          type: integer
    OpenAIImageTokenDetails:
      type: object
      properties:
        image_tokens:
          type: integer
        text_tokens:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````