GPT Image 2 - Image To Image
16 Aspect Ratios, and One That Silently Fails
- input_urls
- image
- url
- all_urls_json
- task_id
- raw_json
- credits_consumed
- credits_left
The short version
Feed it an image and an instruction, get the image edited back. It's the GPT Image 2 edit endpoint reached through KIE.ai, exposed as its own node in the KIE Next/Image/OpenAI/GPT Image folder. Nothing local, nothing free: KIE resells access and charges per image.
Compared with the 1.5 edit node, this one trades away quality and gains much finer control over shape and resolution - 16 aspect ratios and a real 1K/2K/4K picker. If your workflow needs an edit at a specific pixel scale or an unusual frame, that's the reason to reach for GPT Image 2 rather than 1.5.
And it's the one node in this family whose settings can make a submission fail rather than just look wrong, which is what most of this article is about.
Mechanism
The pack generates node classes from KIE's API documentation at startup, so the class name is derived from the operation: KIE_Next_gpt_image_2_image_to_image_f3a0b299, with the hash coming from the model id and docs URL.
Your connected image is uploaded to KIE's file host automatically - you never handle a URL. The node then POSTs to KIE's createTask with market model id gpt-image-2-image-to-image, polls recordInfo until success, downloads the returned image, and returns it as a tensor. Rate limits and 5xx responses get retried with backoff.
Inputs
prompt is required, multiline, and allows long instructions - the documented ceiling is 20,000 characters, which is an order of magnitude more than a local text encoder will take. The default asks for "a photo with Sam Altman in the conference room," which is the API docs' example rather than advice.
input_urls is the required IMAGE socket and takes a batch. Multiple references are uploaded as a set, so an outfit plus a face plus a scene is three images on one socket and one prompt tying them together.
aspect_ratio is where this node earns its place: auto, 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, and more, sixteen in total. That's genuine coverage - landscape, portrait, square, wide.
resolution is 1K, 2K, or 4K, defaulting to 1K. Read the tooltip before you move it, because the rules are not symmetric:
- At 2K,
5:4,4:5,3:1,1:3and9:21are not supported. - At 4K,
3:1,1:3and9:21are not supported. - A
1:1image cannot be converted to 4K. - With
aspect_ratioset toautoor left unset, the job only converts to 1K - ask for anything else and the task fails to create.
That last line is the trap. auto plus resolution: 4K is a combination that looks reasonable and dies at submission.
background is transparent, opaque, or auto, and the tooltip adds a condition the enum doesn't show: it's only supported when the resolution is 1K. Ask for a transparent background at 2K and you should expect it to be ignored or rejected depending on the model's mood. Also note that a transparent background changes what "the output" means downstream - your Save Image node and any compositing steps need to handle alpha, and PNG is what you want on the saving end.
timeout_seconds defaults to 1200 seconds (30–7200 range). Edit jobs at 4K are slow; leave it. callback_url is for KIE to push a result to your own server - leave it empty.
Outputs
image is the tensor you wire downstream. url is the hosted file, all_urls_json lists every URL the task produced (the image socket only carries one tensor from the first usable URL, so extras live only here), task_id is your reference if you need to raise a ticket, raw_json is the provider's answer in full, and credits_consumed / credits_left are the cost - the same pair also shows up on the node as a receipt after a successful run.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
pip install -r requirements.txt
Restart ComfyUI afterwards, then paste your key once at Settings → KIE.ai Nodes Next → Connection. The key is validated against KIE before saving, only a masked fingerprint is displayed afterwards, and KIE_API_KEY in the environment takes priority for headless boxes. Dependencies: requests, Pillow, numpy, PyYAML. The README prefers the Windows one-click installer and the ZIPs in dist/; Manager/Registry publishing is described as "prepared," so if the pack isn't in Manager's search, clone it.
Gotchas that actually cost money
Pre-flight your ratio and resolution pairing. The tooltip rules above aren't advisory - a mismatch fails the task at creation. Set aspect_ratio to an explicit value and pick a resolution the tooltip's exclusions allow.
KIE changes its model catalogue. Models get renamed, dropped, or replaced on the reseller's side, and this pack builds its nodes from KIE's live docs. If the node disappears from the menu after a catalog refresh, that's usually why, not a local mistake.
Menu is empty before the first sync. Restart once, or run the pack's Refresh Model Catalog node.
No seed. There's no reproducibility control here. Keep the output you like and edit from it rather than trying to regenerate it.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | take a photo with Sam Altman in the conference room | Text prompts, up to 20,000 characters. |
| input_urls | IMAGE | — | |
| aspect_ratioopt | COMBO | auto | The aspect ratio of the generated image is set to auto by default. Note: for 2K resolution, the following aspect ratios are not supported: 5:4, 4:5, 3:1, 1:3, and 9:21. for 4K resolution, the following aspect ratios are not supported: 3:1, 1:3, and 9:21. |
| resolutionopt | COMBO | 1K | Image resolution: Note: Images with a 1:1 aspect ratio cannot be converted to 4K images. Images with the aspect ratio set to "auto" or without a specified aspect ratio parameter will only be converted to 1K images; otherwise, the task will fail to create. |
| backgroundopt | COMBO | transparent | Image background Note: This parameter is only supported when the resolution is 1K. |
| timeout_secondsopt | INT | 120030–7200 | — |
| callback_urlopt | STRING | Optional KIE callback URL. Leave empty for normal ComfyUI use. |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| url | STRING | — |
| all_urls_json | STRING | — |
| task_id | STRING | — |
| raw_json | STRING | — |
| credits_consumed | FLOAT | — |
| credits_left | FLOAT | — |