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

# Edit image

> Edit or inpaint an image from one or more reference images. Unsupported fields and unsupported file field names are rejected.



## OpenAPI

````yaml POST /images/edits
openapi: 3.1.0
info:
  title: LLM7 Image API
  description: Generate and edit images through the LLM7 gateway.
  version: 1.0.0
servers:
  - url: https://api.llm7.io/v1
security:
  - bearerAuth: []
paths:
  /images/edits:
    post:
      summary: Edit image
      description: >-
        Edit or inpaint an image from one or more reference images. Unsupported
        fields and unsupported file field names are rejected.
      operationId: createImageEdit
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
            encoding:
              image:
                contentType: image/png, image/jpeg, image/webp
            examples:
              roomEdit:
                summary: Room edit
                value:
                  model: gpt-image-2
                  prompt: Replace the empty wall area with a framed abstract painting
                  size: 1024x1024
      responses:
        '200':
          description: Edited image response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientBalance'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          $ref: '#/components/responses/UpstreamInvalidResponse'
        '503':
          $ref: '#/components/responses/UpstreamUnavailable'
components:
  schemas:
    ImageEditRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - prompt
        - image
      properties:
        model:
          type: string
          description: Image model ID.
          example: gpt-image-2
        prompt:
          type: string
          description: Edit or inpaint instruction.
        size:
          type: string
          description: Requested output size. Support depends on the selected model.
          example: 1024x1024
        image:
          type: array
          description: Reference images. Send each file with the repeated field name image.
          minItems: 1
          maxItems: 3
          items:
            type: string
            format: binary
    ImageResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/ImageData'
        usage:
          $ref: '#/components/schemas/ImageUsage'
    ImageData:
      type: object
      required:
        - b64_json
      properties:
        b64_json:
          type: string
          description: Generated or edited image bytes encoded as base64.
    ImageUsage:
      type: object
      properties:
        cost_usd:
          type: string
          description: Decimal USD string for the billed request when cost is available.
          example: '0.01200000'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      type: object
      required:
        - message
        - type
        - code
      properties:
        message:
          type: string
        type:
          type: string
        param:
          type:
            - string
            - 'null'
        code:
          type: string
  responses:
    BadRequest:
      description: Invalid gateway request or upstream rejected the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid LLM7 token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InsufficientBalance:
      description: No available balance or allowance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    PayloadTooLarge:
      description: Request body or reference image is too large.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Gateway or upstream rate limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UpstreamInvalidResponse:
      description: Upstream success response did not match the image contract.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UpstreamUnavailable:
      description: Upstream provider is temporarily unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````