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

# GPT Image Editing

Use GPT image editing models to intelligently edit and modify existing images via text descriptions. Supports multiple image formats and quality options to meet various image editing needs.

## Request Headers

<ParamField header="Content-Type" type="string" required={true}>
  Enum: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer authentication format: Bearer \{\{API Key}}.
</ParamField>

## Request Body

<ParamField body="model" type="string" required={true}>
  The model used for image editing. Currently supports `gpt-image-1`, `gpt-image-1.5`.
</ParamField>

<ParamField body="image" type="file[]" required={true}>
  Array of images to be edited (multipart/form-data).

  For `gpt-image-1`, `gpt-image-1.5`, each image must be in png, webp, or jpg format, under 50MB per image, with a maximum of 16 images.
</ParamField>

<ParamField body="prompt" type="string" required={true}>
  Text description of the desired edited image.

  For `gpt-image-1`, `gpt-image-1.5`, the maximum length is 32000 characters.
</ParamField>

<ParamField body="quality" type="string" required={false}>
  Quality of the generated image, Default: `auto`.

  For `gpt-image-1`, `gpt-image-1.5`, supported values are: `auto`, `high`, `medium`, `low`.
</ParamField>

<ParamField body="n" type="integer" required={false}>
  Number of images to generate, Range: 1\~10, Default: 1.
</ParamField>

<ParamField body="size" type="string" required={false}>
  Size of the generated image, Default: `auto`.

  For `gpt-image-1`, `gpt-image-1.5`, supported values are:

  * `1024x1024`: Square
  * `1536x1024`: Landscape
  * `1024x1536`: Portrait
  * `auto`: Default
</ParamField>

## Response Parameters

<ResponseField name="created" type="integer" required={true}>
  Unix timestamp (in seconds) of when the image was generated.
</ResponseField>

<ResponseField name="data" type="array" required={true}>
  List of generated images.

  <Expandable title="properties" defaultOpen={false}>
    <ResponseField name="b64_json" type="string" required={true}>
      Base64-encoded string of the generated image.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="usage" type="object" required={false}>
  Only supported by `gpt-image-1`, `gpt-image-1.5`. Token usage information for image generation.

  <Expandable title="properties" defaultOpen={false}>
    <ResponseField name="input_tokens" type="integer" required={true}>
      Number of tokens for the input prompt (including images and text).
    </ResponseField>

    <ResponseField name="input_tokens_details" type="object" required={false}>
      Detailed information about input tokens.

      <Expandable title="properties" defaultOpen={false}>
        <ResponseField name="image_tokens" type="integer" required={true}>
          Number of image tokens in the input prompt.
        </ResponseField>

        <ResponseField name="text_tokens" type="integer" required={true}>
          Number of text tokens in the input prompt.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="output_tokens" type="integer" required={true}>
      Number of output tokens generated by the model.
    </ResponseField>

    <ResponseField name="total_tokens" type="integer" required={true}>
      Total number of tokens consumed for this image generation (including images and text).
    </ResponseField>
  </Expandable>
</ResponseField>
