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

# Edit image

> OpenAI-compatible image editing endpoint. Supports JSON requests and `multipart/form-data` image uploads.



## OpenAPI

````yaml /openapi/relay.en.json post /v1/images/edits
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub public API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: List models
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: Image generation
  - name: OpenAI Images
  - name: Video generation
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: Text completions
  - name: OpenAI Audio
  - name: Realtime API
paths:
  /v1/images/edits:
    post:
      tags:
        - OpenAI Images
      summary: Edit image
      description: >-
        OpenAI-compatible image editing endpoint. Supports JSON requests and
        `multipart/form-data` image uploads.
      operationId: editImage
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
            example:
              model: gpt-image-2
              image: https://example.com/source.png
              prompt: Keep the composition and change the mug color to matte black
              size: 1024x1024
              'n': 1
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
      responses:
        '200':
          description: Image generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ImageEditRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          example: gpt-image-2
        image:
          type: string
          description: >-
            Image to edit. JSON requests can pass a URL or Base64 data;
            `multipart/form-data` requests can upload a file.
        mask:
          type: string
          format: binary
        prompt:
          type: string
        quality:
          type: string
        'n':
          type: integer
        size:
          type: string
        response_format:
          type: string
        stream:
          type: boolean
        background:
          description: Background setting. Depends on support from the selected model.
        output_format:
          description: Output format. Depends on support from the selected model.
        partial_images:
          description: >-
            Partial image return setting. Depends on support from the selected
            model.
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
        data:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              b64_json:
                type: string
              revised_prompt:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````