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

# GPT Image 2 — Edit

> OpenAI GPT Image 2, fine typography and high-fidelity image generation / edit. Optimized for image to image via apisale.

## Overview

OpenAI GPT Image 2, fine typography and high-fidelity image generation / edit. Optimized for image to image via apisale.

<Info>
  **Docs** = API contract + Try it (snapshot). **[Explore](https://apisale.ai/explore)** = browser playground. **[Model page](https://apisale.ai/models/openai/gpt-image-2/edit)** = product examples.
</Info>

## Endpoint

```http theme={null}
POST https://api.apisale.ai/v1/run/openai/gpt-image-2/edit
```

|                |                                   |
| -------------- | --------------------------------- |
| **Model slug** | `openai/gpt-image-2/edit`         |
| **Category**   | Image To Image (`image-to-image`) |
| **Lab**        | Openai                            |
| **Mode**       | async                             |

## Pricing

**From \$0.0042/image**

apisale price is **30%** below the vendor's official list price.

| Tier                                                                          | Unit  | Official price | apisale price |
| ----------------------------------------------------------------------------- | ----- | -------------- | ------------- |
| low / \<=1.1MP (all presets + 1280x720; actual \$0.011-0.012)                 | image | \$0.0060       | \$0.0042      |
| low / 1.1-4.5MP (2560x1440 actual \$0.0145)                                   | image | \$0.015        | \$0.011       |
| low / >4.5MP (3840x2160 actual \~\$0.020)                                     | image | \$0.020        | \$0.014       |
| medium / \<=0.8MP (landscape\_4\_3 etc., actual \$0.04)                       | image | \$0.053        | \$0.037       |
| medium / 0.8-1.1MP (square\_hd 1024x1024, actual \$0.06)                      | image | \$0.053        | \$0.037       |
| medium / 1.1-4.5MP (non-monotonic: 1920x1080=$0.04, 2560x1440=$0.06; use max) | image | \$0.060        | \$0.042       |
| medium / >4.5MP (3840x2160 actual \$0.11)                                     | image | \$0.110        | \$0.077       |
| high / \<=0.8MP (landscape\_4\_3=$0.15, portrait_4_3=$0.17)                   | image | \$0.211        | \$0.148       |
| high / 0.8-1.1MP (square\_hd 1024x1024 actual \$0.22)                         | image | \$0.211        | \$0.148       |
| high / 1.1-4.5MP (2560x1440=$0.23; 1920x1080=$0.16 non-monotonic, use max)    | image | \$0.230        | \$0.161       |
| high / >4.5MP (3840x2160 actual \$0.41; auto mapped here)                     | image | \$0.410        | \$0.287       |

<Info>
  **Official price** = vendor list price. **apisale price** = what you pay through apisale.
</Info>

### Volume tiers

\*\*low / \<=1.1MP (all presets + 1280x720; actual $0.011-0.012)** — $5000+ → \$0.0034

\*\*low / 1.1-4.5MP (2560x1440 actual $0.0145)** — $5000+ → \$0.0084

\*\*low / >4.5MP (3840x2160 actual \~$0.020)** — $5000+ → \$0.011

\*\*medium / \<=0.8MP (landscape\_4\_3 etc., actual $0.04)** — $5000+ → \$0.030

\*\*medium / 0.8-1.1MP (square\_hd 1024x1024, actual $0.06)** — $5000+ → \$0.030

**medium / 1.1-4.5MP (non-monotonic: 1920x1080=$0.04, 2560x1440=$0.06; use max)** — $5000+ → $0.034

\*\*medium / >4.5MP (3840x2160 actual $0.11)** — $5000+ → \$0.062

**high / \<=0.8MP (landscape\_4\_3=$0.15, portrait_4_3=$0.17)** — $5000+ → $0.118

\*\*high / 0.8-1.1MP (square\_hd 1024x1024 actual $0.22)** — $5000+ → \$0.118

**high / 1.1-4.5MP (2560x1440=$0.23; 1920x1080=$0.16 non-monotonic, use max)** — $5000+ → $0.129

\*\*high / >4.5MP (3840x2160 actual $0.41; auto mapped here)** — $5000+ → \$0.230

## Request

```json theme={null}
{‌
  "input": {‌
    "prompt": "A cinematic product photograph on a clean studio backdrop, soft directional lighting, ultra sharp detail.",
    "quality": "high",
    "image_size": "auto",
    "num_images": 1,
    "output_format": "png"
  }
}
```

### Parameters

Fields marked \* are required. Use `Authorization: Key YOUR_API_KEY` for REST.

<ParamField body="input.prompt" type="string" required>
  Text prompt describing the image. Maximum 32000 characters.
</ParamField>

<ParamField body="input.quality" type="string">
  Default: `high` Values: `auto`, `low`, `medium`, `high`
</ParamField>

<ParamField body="input.mask_url" type="string">
  Optional mask image URL (PNG with transparency). Edited region is transparent or white.
</ParamField>

<ParamField body="input.image_size" type="string">
  Preset name or custom \{width,height}. Custom: both dims multiple of 16, max edge 3840px, aspect ratio 1:3 to 3:1, total pixels 655360-8294400. Default: `auto` Values: `square_hd`, `square`, `portrait_4_3`, `portrait_16_9`, `landscape_4_3`, `landscape_16_9`, `auto`
</ParamField>

<ParamField body="input.image_urls" type="array" required>
  Input image URLs for editing (1-16 images).
</ParamField>

<ParamField body="input.num_images" type="number">
  Number of images to generate (1-4). Default: `1` Range: 1 – 4
</ParamField>

<ParamField body="input.output_format" type="string">
  Default: `png` Values: `jpeg`, `png`, `webp`
</ParamField>

<ParamField body="webhook_url" type="string">
  Optional HTTPS webhook when the run reaches a terminal state.
</ParamField>

<ParamField body="sync" type="boolean">
  Block until completion (same Run response shape).
</ParamField>

<AccordionGroup>
  <Accordion title="Input schema">
    ```json expandable theme={null}
    {‌
      "params": {‌
        "prompt": {‌
          "type": "string",
          "required": true,
          "max_length": 32000,
          "description": "Text prompt describing the image. Maximum 32000 characters."
        },
        "quality": {‌
          "type": "enum",
          "values": [
            "auto",
            "low",
            "medium",
            "high"
          ],
          "default": "high"
        },
        "mask_url": {‌
          "role": "mask",
          "type": "media",
          "description": "Optional mask image URL (PNG with transparency). Edited region is transparent or white."
        },
        "image_size": {‌
          "type": "string",
          "values": [
            "square_hd",
            "square",
            "portrait_4_3",
            "portrait_16_9",
            "landscape_4_3",
            "landscape_16_9",
            "auto"
          ],
          "default": "auto",
          "description": "Preset name or custom {‌width,height}. Custom: both dims multiple of 16, max edge 3840px, aspect ratio 1:3 to 3:1, total pixels 655360-8294400."
        },
        "image_urls": {‌
          "type": "array<media>",
          "required": true,
          "max_items": 16,
          "min_items": 1,
          "description": "Input image URLs for editing (1-16 images)."
        },
        "num_images": {‌
          "max": 4,
          "min": 1,
          "type": "int",
          "default": 1,
          "description": "Number of images to generate (1-4)."
        },
        "output_format": {‌
          "type": "enum",
          "values": [
            "jpeg",
            "png",
            "webp"
          ],
          "default": "png"
        }
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## Submit response

Returns a **Run** with `run_id`. Poll with [GET /v1/runs/\{run\_id}](/model-apis/poll-runs) or use **Try it** above.

<ResponseField name="run_id" type="string" required>
  Unique run ID — save for polling and webhooks.
</ResponseField>

<ResponseField name="status" type="string" required>
  `queued` (async) or terminal state for sync runs.
</ResponseField>

<ResponseField name="output" type="object">
  Result when `status` is `succeeded` — see **Output schema** below.
</ResponseField>

### Example (async submit)

```json theme={null}
{
  "run_id": "run_550e8400-e29b-41d4-a716-446655440000",
  "endpoint": "openai/gpt-image-2/edit",
  "model": "edit",
  "capability": "image",
  "mode": "image-to-image",
  "status": "queued",
  "output": null,
  "error": null,
  "billing": null,
  "created_at": "2026-06-27T12:00:00.000Z",
  "started_at": null,
  "completed_at": null,
  "elapsed_ms": null
}
```

Full lifecycle: [Runs lifecycle](/model-apis/runs-lifecycle).

## Output

When `status` is `succeeded`, `output` follows this schema:

<AccordionGroup>
  <Accordion title="Output schema">
    ```json expandable theme={null}
    {‌
      "type": "object",
      "example": {‌
        "images": [
          {‌
            "url": "https://cdn.mountsea.ai/tasks/ms-example/0.png",
            "mime": "image/png"
          }
        ]
      },
      "required": [
        "images"
      ],
      "properties": {‌
        "images": {‌
          "type": "array",
          "items": {‌
            "type": "object",
            "properties": {‌
              "b64": {‌
                "type": "string"
              },
              "url": {‌
                "type": "string",
                "format": "uri"
              },
              "mime": {‌
                "type": "string"
              }
            }
          }
        }
      },
      "description": "Succeeded task output: normalized images."
    }
    ```
  </Accordion>
</AccordionGroup>

## Example

```bash theme={null}
curl -X POST "https://api.apisale.ai/v1/run/openai/gpt-image-2/edit" \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "prompt": "A cinematic product photograph on a clean studio backdrop, soft directional lighting, ultra sharp detail.",
    "quality": "high",
    "image_size": "auto",
    "num_images": 1,
    "output_format": "png"
  }
}'
```

## Related

* [Runs lifecycle](/model-apis/runs-lifecycle)
* [Image API overview](/api/image)
* [Account API](/get-started/account-and-monitoring)


## OpenAPI

````yaml openapi-catalog.json POST /v1/run/openai/gpt-image-2/edit
openapi: 3.0.3
info:
  title: apisale Model Catalog
  version: '2026-09-01T09:47:50.773Z'
  description: Per-model OpenAPI operations for Mintlify Try playground.
servers:
  - url: https://api.apisale.ai
security: []
paths:
  /v1/run/openai/gpt-image-2/edit:
    post:
      tags:
        - Model catalog
        - image
        - Openai
      summary: Create GPT Image 2 — Edit
      description: >-
        OpenAI GPT Image 2, fine typography and high-fidelity image generation /
        edit. Optimized for image to image via apisale.
      operationId: submit-openai-gpt-image-2-edit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - input
              properties:
                input:
                  type: object
                  properties:
                    prompt:
                      description: >-
                        Text prompt describing the image. Maximum 32000
                        characters.
                      type: string
                    quality:
                      type: string
                      enum:
                        - auto
                        - low
                        - medium
                        - high
                      default: high
                    mask_url:
                      description: >-
                        Optional mask image URL (PNG with transparency). Edited
                        region is transparent or white.
                      type: string
                      format: uri
                    image_size:
                      description: >-
                        Preset name or custom {width,height}. Custom: both dims
                        multiple of 16, max edge 3840px, aspect ratio 1:3 to
                        3:1, total pixels 655360-8294400.
                      type: string
                      enum:
                        - square_hd
                        - square
                        - portrait_4_3
                        - portrait_16_9
                        - landscape_4_3
                        - landscape_16_9
                        - auto
                      default: auto
                    image_urls:
                      description: Input image URLs for editing (1-16 images).
                      type: array
                      items:
                        type: string
                    num_images:
                      description: Number of images to generate (1-4).
                      type: number
                      minimum: 1
                      maximum: 4
                      default: 1
                    output_format:
                      type: string
                      enum:
                        - jpeg
                        - png
                        - webp
                      default: png
                  required:
                    - prompt
                    - image_urls
                  example:
                    prompt: >-
                      A cinematic product photograph on a clean studio backdrop,
                      soft directional lighting, ultra sharp detail.
                    quality: high
                    image_size: auto
                    num_images: 1
                    output_format: png
                webhook_url:
                  type: string
                  format: uri
                sync:
                  type: boolean
                  default: false
            example:
              input:
                prompt: >-
                  A cinematic product photograph on a clean studio backdrop,
                  soft directional lighting, ultra sharp detail.
                quality: high
                image_size: auto
                num_images: 1
                output_format: png
      responses:
        '201':
          description: Run accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunObject'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RunObject:
      type: object
      required:
        - run_id
        - endpoint
        - model
        - capability
        - mode
        - status
        - created_at
      properties:
        run_id:
          type: string
          description: Unique run identifier
        endpoint:
          type: string
          description: Model slug
        model:
          type: string
        capability:
          type: string
        mode:
          type: string
        status:
          type: string
          enum:
            - queued
            - processing
            - succeeded
            - failed
            - timeout
            - cancelled
        output:
          type: object
          nullable: true
        error:
          type: object
          nullable: true
          properties:
            type:
              type: string
              description: Machine-readable error code
            code:
              type: number
              description: HTTP status
            message:
              type: string
        billing:
          type: object
          nullable: true
          properties:
            amount:
              type: string
            currency:
              type: string
              enum:
                - usd
        created_at:
          type: string
          format: date-time
        started_at:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
        elapsed_ms:
          type: number
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Key sk-... (native REST) or Bearer sk-... (vendor SDKs)

````