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

# Image Edits

> OpenAI-compatible image-edit endpoint.

Accepts either ``application/json`` (gpt-image-style ``images: [{file_id|image_url}]``)
or ``multipart/form-data`` (OpenAI SDK classic shape: ``image[]`` UploadFile,
optional ``mask`` UploadFile, plus text fields). Content-Type drives dispatch.



## OpenAPI

````yaml /api-reference/v3-openapi.json post /v3/images/edits
openapi: 3.1.0
info:
  title: Eden AI API V3
  version: 3.0.0
servers:
  - url: https://api.edenai.run
    description: Production server
security: []
paths:
  /v3/images/edits:
    post:
      tags:
        - Images
      summary: Image Edits
      description: >-
        OpenAI-compatible image-edit endpoint.


        Accepts either ``application/json`` (gpt-image-style ``images:
        [{file_id|image_url}]``)

        or ``multipart/form-data`` (OpenAI SDK classic shape: ``image[]``
        UploadFile,

        optional ``mask`` UploadFile, plus text fields). Content-Type drives
        dispatch.
      operationId: image_edits_v3_images_edits_post
      requestBody:
        content:
          application/json:
            schema:
              properties:
                model:
                  type: string
                  title: Model
                  description: provider/model, e.g. 'openai/gpt-image-2'
                prompt:
                  type: string
                  maxLength: 32000
                  minLength: 1
                  title: Prompt
                'n':
                  anyOf:
                    - type: integer
                      maximum: 10
                      minimum: 1
                    - type: 'null'
                  title: 'N'
                size:
                  anyOf:
                    - type: string
                    - type: 'null'
                  title: Size
                  description: >-
                    Provider-specific size string. OpenAI accepts '1024x1024',
                    '1536x1024', '1024x1536', 'auto'. Vertex Imagen accepts
                    square or aspect-ratio strings. Validation is delegated to
                    the provider.
                user:
                  anyOf:
                    - type: string
                    - type: 'null'
                  title: User
                  description: End-user identifier for abuse tracking.
                metadata:
                  anyOf:
                    - additionalProperties: true
                      type: object
                    - type: 'null'
                  title: Metadata
                  description: Arbitrary metadata attached to the request.
                extra_headers:
                  anyOf:
                    - additionalProperties:
                        type: string
                      type: object
                    - type: 'null'
                  title: Extra Headers
                  description: >-
                    Additional HTTP headers forwarded to the provider API.
                    Credential headers (Authorization, x-api-key, ...) are
                    rejected.
                images:
                  items:
                    $ref: '#/components/schemas/ImageRef'
                  type: array
                  maxItems: 16
                  minItems: 1
                  title: Images
                  description: >-
                    One or more input images. Each entry references one image
                    via exactly one of `file_id` (an Eden upload id) or
                    `image_url` (https URL or base64 data URL). The first image
                    is the canvas; subsequent images are inpaint references.
                mask:
                  anyOf:
                    - $ref: '#/components/schemas/ImageRef'
                    - type: 'null'
                  description: >-
                    Optional mask image (PNG with transparent pixels marking the
                    regions to edit). Same shape as an `images[]` entry.
              additionalProperties: true
              type: object
              required:
                - model
                - prompt
                - images
              title: ImageEditJsonBody
              description: >-
                OpenAI-compatible ``POST /v1/images/edits`` JSON request body.


                References:

                - OpenAI's current /v1/images/edits JSON form for gpt-image-*
                takes
                  ``images: [{file_id | image_url}, ...]`` and an optional ``mask:
                  {file_id | image_url}``.
                - ``image_url`` accepts an https URL or a
                ``data:image/...;base64,...`` URL.
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
      security:
        - AuthBearer: []
components:
  schemas:
    ImageRef:
      properties:
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: File Id
        image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Url
      additionalProperties: false
      type: object
      title: ImageRef
      description: |-
        One entry in ``images[]`` (or the ``mask`` value).

        Exactly one of ``file_id`` or ``image_url`` must be set.
    ImageResponse:
      properties:
        cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        created:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created
        data:
          items:
            $ref: '#/components/schemas/ImageDataItem'
          type: array
          title: Data
        usage:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Usage
      additionalProperties: true
      type: object
      title: ImageResponse
      description: >-
        OpenAI-compatible image response + Eden ``cost`` / ``provider`` fields.


        Shared by ``POST /v3/images/generations`` and ``POST /v3/images/edits``
        —

        the wire shape is identical.
    ImageDataItem:
      properties:
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        b64_json:
          anyOf:
            - type: string
            - type: 'null'
          title: B64 Json
        revised_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Revised Prompt
      additionalProperties: true
      type: object
      title: ImageDataItem
      description: |-
        Single image entry inside the OpenAI-shaped ``data: [...]`` array.

        Providers return either ``url`` (most non-OpenAI providers) or
        ``b64_json`` (gpt-image-*); ``revised_prompt`` is OpenAI-specific.
  securitySchemes:
    AuthBearer:
      type: http
      scheme: bearer

````