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

# Edit Images

> Edits an image given the original image and a prompt.



## OpenAPI

````yaml /gateway-openapi.json post /images/edits
openapi: 3.0.0
info:
  title: LLM Gateway
  description: API for LLM Gateway
  version: 1.0.0
servers:
  - url: https://{gatewayBaseURL}
    variables:
      gatewayBaseURL:
        default: gateway.truefoundry.ai
        description: Gateway base URL
    description: Gateway base URL
security:
  - AuthorizationBearer: []
tags:
  - name: Chat
  - name: Agent
  - name: Messages
  - name: MCP
  - name: Embeddings
  - name: Rerank
  - name: Responses
  - name: Image
  - name: Audio
  - name: Batch
  - name: Files
  - name: Fine-tuning
  - name: Moderations
  - name: Models
paths:
  /images/edits:
    post:
      tags:
        - Image
      summary: Edit Images
      description: Edits an image given the original image and a prompt.
      requestBody:
        description: Source image(s), optional mask, prompt, and edit options.
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: The model to use for image generation.
                image:
                  anyOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                  description: >-
                    The image(s) to edit. Must be a supported image file or an
                    array of images.
                prompt:
                  type: string
                  description: A text description of the desired image(s).
                background:
                  type: string
                  nullable: true
                  description: >-
                    Allows to set transparency for the background of the
                    generated image(s).
                input_fidelity:
                  type: string
                  nullable: true
                  description: >-
                    Control how much effort the model will exert to match the
                    style and features of input images.
                mask:
                  type: string
                  nullable: true
                  description: >-
                    An additional image whose fully transparent areas indicate
                    where image should be edited.
                'n':
                  type: integer
                  nullable: true
                  description: The number of images to generate. Must be between 1 and 10.
                output_compression:
                  type: integer
                  nullable: true
                  description: The compression level (0-100%) for the generated images.
                output_format:
                  type: string
                  nullable: true
                  description: The format in which the generated images are returned.
                partial_images:
                  type: integer
                  nullable: true
                  description: >-
                    The number of partial images to generate. Used for streaming
                    responses.
                quality:
                  type: string
                  nullable: true
                  description: The quality of the image that will be generated.
                response_format:
                  type: string
                  nullable: true
                  description: >-
                    The format in which generated images are returned. Must be
                    one of url or b64_json.
                size:
                  type: string
                  nullable: true
                  description: The size of the generated images.
                stream:
                  type: boolean
                  nullable: true
                  description: Edit the image in streaming mode.
                user:
                  type: string
                  nullable: true
                  description: A unique identifier representing your end-user.
              required:
                - model
                - image
                - prompt
      responses:
        '200':
          description: Edited images.
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: number
                    description: Unix timestamp when the image was generated.
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          nullable: true
                          description: >-
                            Public URL of the image, when response_format is
                            url.
                        b64_json:
                          type: string
                          nullable: true
                          description: >-
                            Base64-encoded image bytes, when response_format is
                            b64_json.
                        revised_prompt:
                          type: string
                          nullable: true
                          description: >-
                            Prompt as used by the model after any safety or
                            expansion rewrites.
                    description: Generated images.
                required:
                  - created
                  - data
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
components:
  securitySchemes:
    AuthorizationBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````