> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAIGPTImageNodeV2 - ComfyUI Built-in Node Documentation

> This node generates images using OpenAI's GPT Image API.

This node generates images using OpenAI's GPT Image API. It supports multiple models (`gpt-image-2`, `gpt-image-1.5`, and `gpt-image-1`), allows you to provide reference images for editing, and can use a mask to specify which parts of an image to modify.

## Inputs

### Common Inputs

| Parameter | Description                                                                                                | Data Type      | Required | Range                                                       |
| --------- | ---------------------------------------------------------------------------------------------------------- | -------------- | -------- | ----------------------------------------------------------- |
| `model`   | The OpenAI GPT Image model to use. Selecting a model reveals additional parameters specific to that model. | DYNAMIC\_COMBO | Yes      | `"gpt-image-2"`<br />`"gpt-image-1.5"`<br />`"gpt-image-1"` |
| `prompt`  | Text prompt for GPT Image (default: `""`).                                                                 | STRING         | Yes      | N/A                                                         |
| `n`       | How many images to generate (default: `1`).                                                                | INT            | Yes      | 1 to 8                                                      |
| `seed`    | Seed for reproducibility (default: `0`). Not implemented yet in backend.                                   | INT            | Yes      | 0 to 2147483647                                             |

### gpt-image-2 Inputs

These inputs appear when `model` is set to `gpt-image-2`.

| Parameter             | Description                                                                                        | Data Type | Required | Range                                                                                                                                                                            |
| --------------------- | -------------------------------------------------------------------------------------------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model.size`          | Image size. Select "Custom" to use the custom width and height (default: `"auto"`).                | COMBO     | Yes      | `"auto"`<br />`"1024x1024"`<br />`"1024x1536"`<br />`"1536x1024"`<br />`"2048x2048"`<br />`"2048x1152"`<br />`"1152x2048"`<br />`"3840x2160"`<br />`"2160x3840"`<br />`"Custom"` |
| `model.custom_width`  | Used only when `model.size` is "Custom". Must be a multiple of 16 (default: `1024`).               | INT       | No       | 1024 to 3840                                                                                                                                                                     |
| `model.custom_height` | Used only when `model.size` is "Custom". Must be a multiple of 16 (default: `1024`).               | INT       | No       | 1024 to 3840                                                                                                                                                                     |
| `model.background`    | Return image with or without background (default: `"auto"`).                                       | COMBO     | Yes      | `"auto"`<br />`"opaque"`                                                                                                                                                         |
| `model.quality`       | Image quality, affects cost and generation time (default: `"low"`).                                | COMBO     | Yes      | `"low"`<br />`"medium"`<br />`"high"`                                                                                                                                            |
| `model.images`        | Optional reference image(s) for image editing. Up to 16 images. See Reference Inputs for details.  | IMAGE     | No       | 0 to 16                                                                                                                                                                          |
| `model.mask`          | Optional mask for inpainting (white areas will be replaced). Requires exactly one reference image. | MASK      | No       | N/A                                                                                                                                                                              |

### gpt-image-1.5 and gpt-image-1 Inputs

These inputs appear when `model` is set to `gpt-image-1.5` or `gpt-image-1`. Both models share the same parameter set.

| Parameter          | Description                                                                                        | Data Type | Required | Range                                                             |
| ------------------ | -------------------------------------------------------------------------------------------------- | --------- | -------- | ----------------------------------------------------------------- |
| `model.size`       | Image size (default: `"auto"`).                                                                    | COMBO     | Yes      | `"auto"`<br />`"1024x1024"`<br />`"1024x1536"`<br />`"1536x1024"` |
| `model.background` | Return image with or without background (default: `"auto"`).                                       | COMBO     | Yes      | `"auto"`<br />`"opaque"`<br />`"transparent"`                     |
| `model.quality`    | Image quality, affects cost and generation time (default: `"low"`).                                | COMBO     | Yes      | `"low"`<br />`"medium"`<br />`"high"`                             |
| `model.images`     | Optional reference image(s) for image editing. Up to 16 images. See Reference Inputs for details.  | IMAGE     | No       | 0 to 16                                                           |
| `model.mask`       | Optional mask for inpainting (white areas will be replaced). Requires exactly one reference image. | MASK      | No       | N/A                                                               |

### Reference Inputs

| Parameter      | Description                                                                                                | Data Type | Required | Range   |
| -------------- | ---------------------------------------------------------------------------------------------------------- | --------- | -------- | ------- |
| `model.images` | Growable slot: connect 1..N items (e.g. `image_1`...`image_16`); up to 16 reference images for all models. | IMAGE     | No       | 1 to 16 |
| `model.mask`   | Optional mask for inpainting (white areas will be replaced). Requires exactly one reference image.         | MASK      | No       | N/A     |

**Parameter Constraints and Limitations:**

* When `model.size` is "Custom" (gpt-image-2 only), `model.custom_width` and `model.custom_height` must both be multiples of 16, the longest edge must not exceed 3840, the aspect ratio must not exceed 3:1, and the total pixel count must be between 655,360 and 8,294,400.
* `model.mask` requires exactly one reference image in `model.images`: it cannot be used without an image, and it cannot be used with more than one image.
* When `model.mask` is used, its dimensions must match the dimensions of the reference image.
* When `model.images` is provided, the node runs in image editing mode; without `model.images`, it generates images from the prompt alone.
* Reference images are downscaled before being sent to the API.
* `seed` is currently not implemented in the backend.

## Outputs

| Output Name | Description                                                                                                                                           | Data Type |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `image`     | The generated image or images. All returned images are stacked into one batch; if their dimensions differ, they are resized to match the first image. | IMAGE     |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/OpenAIGPTImageNodeV2/en.md)

***

**Source fingerprint (SHA-256):** `fb3491f949151fbd3f5825ec9f9ae124019767d083f56966ef34af278aef50c0`
