> ## Documentation Index
> Fetch the complete documentation index at: https://edenai-docs-refresh-dead-model-ids.mintlify.site/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 https://api.edenai.run/v3/docs/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:
                routing:
                  anyOf:
                    - $ref: '#/components/schemas/ProviderRoutingPreferences'
                    - type: 'null'
                  description: >-
                    How to pick between the providers that serve the requested
                    model. Applies only when `model` is a model name with no
                    provider prefix (e.g. 'gpt-5.5'); ignored for a concrete
                    'provider/model' id, which already names its provider. This
                    does not choose the model — for that see `router_candidates`
                    with model='@edenai'.
                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:
    ProviderRoutingPreferences:
      properties:
        sort:
          anyOf:
            - type: string
              enum:
                - cost
                - speed
                - latency
                - exact
            - type: 'null'
          title: Sort
          description: >-
            What to optimise for when several providers serve the requested
            model. 'cost' (default) picks the cheapest for this request's shape;
            'speed' the highest tokens/second; 'latency' the fastest to first
            token; 'exact' the most reliable at producing well-formed tool calls
            / structured output. Health is always a filter first — no mode will
            route you to a failing provider. Can also be written as a model
            suffix, e.g. 'gpt-5.5:speed'.
        sticky:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Sticky
          description: >-
            Keep a conversation on the provider holding its prompt cache. On by
            default, and only ever active for models whose providers discount
            cache reads. Set false to route every request independently on price
            instead. Naming an explicit `sort` also takes priority over cache
            affinity.
        allow_fallbacks:
          type: boolean
          title: Allow Fallbacks
          description: >-
            Whether other providers of the same model may be tried when the
            chosen one fails. Set false to pin the request to the single best
            provider: it then fails rather than silently moving to another
            seller. useful when a cache-warm prompt would cold-miss elsewhere.
            This governs PROVIDERS of the requested model only; models you list
            in `fallbacks` are your own choice and are always kept.
          default: true
        allowed_providers:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Providers
          description: >-
            Restrict routing to these providers, e.g. ['openai', 'anthropic'].
            Only providers that serve the requested model are considered, so an
            entry that does not sell it is simply inert. If none of them do, the
            request fails rather than falling back to a provider you excluded.
            Case-insensitive. Applies to routed providers only. a concrete
            'provider/model' you named in `fallbacks` is your own choice and is
            kept.
      type: object
      title: ProviderRoutingPreferences
      description: >-
        How to choose between SELLERS of one model — not which model to use.


        Only meaningful when `model` is a canonical name (`gpt-5.5`) rather than
        a concrete

        `provider/model` — with a concrete id there is nothing to choose
        between. For choosing the

        MODEL itself see ``router_candidates`` and ``model="@edenai"``, which is
        a different router.
    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

````