Generate 4o Image
The ChatGPT image model in your graph, filters and all
- image
- url
- all_urls_json
- task_id
- raw_json
- credits_consumed
- credits_left
4o image generation is the thing that went viral inside ChatGPT in March 2025 - the Ghibli-style portraits, the whole wave - and this node calls it through KIE. Two reasons you'd want it here rather than in a browser tab: reference-image editing with up to five inputs, and the ability to put a closed model in the middle of a local pipeline instead of at the end of one.
What you're actually buying
OpenAI's 4o image is a strong generalist with a well-earned reputation for unpredictable refusal. The KB's closed-source-models page records the community's verdict in one quote - "Chat gpt 4O sucks and everything trips its baby mode content filters" - alongside the praise for output quality. Both halves are real. It renders text, follows compound instructions with people and objects in frame, and edits a supplied image coherently; it will also occasionally decide your prompt is a problem and hand you a lecture instead of a picture.
That's the trade for using a closed model at all. The same doc's framing applies: an API node is the right tool for a model you cannot run, and a bad default for one you can.
Inputs
Only three fields are on the card.
prompt - your description. The tooltip is specific: required if neither filesUrl nor fileUrl is supplied, and at least one of prompt or filesUrl must be present. So this is text-to-image, or the instruction half of an edit.
size - required, and limited: 1:1, 3:2, 2:3. KIE documents no other values on this page, so if you were hoping for 16:9 out of the node, you're cropping afterwards.
filesUrl - up to 5 publicly reachable image URLs to use as reference or source material. Note that this one stayed a JSON array string rather than becoming a native image socket, matching KIE's documentation for the endpoint. If you don't have hosting, KIE's docs point at their file-upload quickstart to get URLs first.
fileUrl - a single URL, explicitly marked deprecated on the endpoint's own page. Prefer filesUrl in anything new.
Plus timeout_seconds (1200 default, 30–7200) and callback_url (leave empty for normal ComfyUI use).
Outputs
image is a real IMAGE - batch-ready, goes straight into a Save Image, a preview, or an img2img stage. url is the hosted result; all_urls_json keeps every URL the response reported, which matters because 4o image jobs can return more than one artifact. task_id is what you feed the companion Get 4o Image Details node if you want to poll the job separately. raw_json is the whole response - where you look when the model refused, because a refusal bodies its way back rather than always erroring. credits_consumed and credits_left are floats, plus the on-node receipt.
Install
ComfyUI Manager (search the pack title), or:
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
Restart. The dependency list is requests, Pillow, numpy, PyYAML - no weights, no local inference, no VRAM. The cost is entirely per-call on KIE's side.
Key in Settings → KIE.ai Nodes Next → Connection - Paste / replace KIE.ai API key. The pack validates it against KIE before replacing a working key, then shows a masked fingerprint and CONNECTED. Servers and headless setups can set KIE_API_KEY, which takes priority over the saved key.
Gotchas
Refusals arrive as text, not as an exception. If a run finishes and your image looks wrong or missing, read raw_json before assuming a node bug.
Reference images must be reachable. filesUrl takes URLs. Local files need the KIE file-upload route first - this is the one node in the pack where a local image doesn't just get uploaded for you.
Sizes are three and only three. Plan your composition around 1:1, 3:2 or 2:3, and crop downstream.
Card drift. The pack builds its node library from KIE's API docs at startup and re-checks about daily, so fields follow the provider's documentation rather than the plugin's release notes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A beautiful sunset over the mountains | (Optional) Text prompt that conveys the creative idea you want the 4o model to render. Required if neither `filesUrl` nor `fileUrl` is supplied. At least one of `prompt` or `filesUrl` must be provided. |
| size | COMBO | 1:1 | (Required) Aspect ratio of the generated image. Must be one of the listed values. |
| filesUrlopt | STRING | [ "https://example.com/image.png" ] | (Optional) Up to 5 publicly reachable image URLs to serve as reference or source material. Use this when you want to edit or build upon an existing picture. If you don’t have reliable hosting, upload your images first via our File Upload API quick‑start: https://docs.kie.ai/file-upload-api/quickstart. Supported formats: .jfif, .pjpeg, .jpeg, .pjp, .jpg, .png, .webp. At least one of `prompt` or `filesUrl` must be provided. |
| fileUrlopt | STRING | https://example.com/image.png | (Optional, Deprecated) File URL, such as an image URL. If fileUrl is provided, 4o image may create based on this image. This parameter will be deprecated in the future, please use filesUrl instead. |
| 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 | — |