GPT Image-2 - Text to Image
The node to grab when your prompt is mostly words
- image
- url
- all_urls_json
- task_id
- raw_json
- credits_consumed
- credits_left
What this node actually is
This is OpenAI's GPT Image-2 text-to-image model, called over KIE.ai's API, wearing a ComfyUI node's clothes. Prompt goes in, IMAGE comes out, and it slots into a local graph like any other generator - except nothing runs on your card and every run costs money. It lives under KIE Next / Image / OpenAI / GPT Image, and it is one node for one model: no model dropdown, because the pack builds a separate node per KIE model.
Why you'd reach for it instead of your local checkpoint: text inside the image. The GPT Image line has been the closed-model answer to legible typography since GPT Image 1, and by 1.5 the fidelity complaints had mostly quieted down. Posters, packaging mocks, UI shots, anything where the words have to be spelled right - that's the job where local Flux-style models still hand you attractive gibberish.
The corollary: use it for the first 10% of a workflow you already have. Generate the poster here, then push the returned IMAGE through your local upscaler and detailer where the sharpening, masking and batch work is free.
How it works
The node builds the request from your widgets, POSTs it to KIE's create-task endpoint, uploads nothing (there are no image inputs here), then polls the task until KIE reports success - starting at ~2.5s and backing off to 15s - up to timeout_seconds (default 1200, so twenty minutes). When results land it downloads the file, converts it to a ComfyUI IMAGE tensor, and archives a copy under your ComfyUI output folder, which is why a restart doesn't vaporise yesterday's generation.
Because it's synchronous, a queued run blocks while the provider works. That's the price of not juggling callbacks.
The inputs that matter
Only one is required: prompt, up to 20,000 characters. That's an unusually generous cap for a text-to-image model, and the author's tooltip says it plainly - "required, maximum 20,000 characters". If your image needs a paragraph of packaging copy, type the paragraph.
The three you'll actually fiddle with:
- resolution -
1K,2K,4K. Read the tooltip before you push it. A 1:1 image can't go to 4K, and if the aspect ratio isautoyou only get 1K; the doc's wording is that otherwise "the task will fail to create". So a 4K square is a provider-side error, not a silent downgrade. - aspect_ratio - 16 choices, default
auto.autois fine at 1K. The moment you want 2K or 4K, choose a real ratio, and avoid 5:4, 4:5, 3:1, 1:3 and 9:21 at 2K (3:1, 1:3, 9:21 at 4K). - background -
transparent,opaque, orauto, defaulttransparent, and per the tooltip only supported at 1K. So "cutout with alpha" pins you to 1K; ask for 4K and the background control stops applying.
timeout_seconds and callback_url are plumbing. Leave the callback alone unless you're running a server that receives KIE webhooks; empty is the correct value for normal ComfyUI use.
Outputs
image is the tensor you wire into SaveImage, an upscaler, or a detailer. url is the single primary result URL and all_urls_json is every URL the task returned - useful to keep, because KIE image endpoints can hand back more than one object. task_id is the one I'd keep visible: it's what you paste into the pack's Get Task Details node when you want to see the raw provider response later. raw_json is that response in full, credits_consumed and credits_left are floats the node also prints on itself after a successful run.
Installing it
ComfyUI Manager → search KIE.ai Nodes Next (display name; the repo is felipederosilva/ComfyUI-KIE-Nodes-Next), or clone it and install its requirements in ComfyUI's Python environment:
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
python -m pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
The dependency list is refreshingly boring - requests, Pillow, numpy, PyYAML. No model downloads, no multi-gigabyte anything: the "model" is on a server. Restart ComfyUI, then go to Settings → KIE.ai Nodes Next → Connection and paste your KIE.ai API key. It validates the key against KIE before saving, shows a masked fingerprint, and keeps the full key backend-side (headless installs can set KIE_API_KEY instead). One more thing people trip on: on first launch the pack reads KIE's docs index and rebuilds the node library, sometimes reloading the ComfyUI frontend once. If a node you saw online isn't in your menu yet, run the Refresh Model Catalog node and restart.
Where it goes wrong
- "No KIE API key configured." That's the pack's error, and it means the key step above didn't happen (or
KIE_API_KEYwas unset after a reboot). It's not a workflow problem. - Task fails to create at 2K/4K. Almost always an aspect-ratio/resolution combination from the unsupported lists. Drop to 1K and re-run; don't burn another paid call experimenting.
- Cost. Metered per call, no free tier. KIE is a reseller sitting between you and OpenAI - cheaper, region-friendlier and easier to pay than a direct cloud billing account, but still a middleman, and it passes OpenAI's own filtering straight through. Don't queue 30 experiments and walk away.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A cinematic night city poster with neon reflections on a rainy street. | Text prompt. Required, maximum 20,000 characters. |
| 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 | — |