ComfyUI Node

4o Image

The node that makes you host your own reference images

By felipederosilva·Created 2 months ago·Updated 3 days ago· 3
4o Image
    • image
    • url
    • all_urls_json
    • task_id
    • raw_json
    • credits_consumed
    • credits_left
    ◄size1:1►
    ◄promptA beautiful sunset over the mountains►
    ◄files_url[ "https://example.com/image.png" ]►
    ◄file_urlhttps://example.com/image.png►
    ◄timeout_seconds1200►
    ◄callback_url►

    This one calls OpenAI's 4o image model through KIE.ai, and it's the honest version of what an API node is: nothing runs on your GPU, the prompt leaves your machine, and you pay per image. If you're here because you want GPT-class prompt comprehension for a storyboard panel or a quick product mock, fine. If you're here because your 8GB card can't do local Flux, also fine - but read the reference-image section before you wire anything up, because this node has a trap in it.

    What it is

    KIE_Next_4o_image_api_0e4130ba is a generated node - the KIE Next pack builds one node per KIE Market operation and version, from KIE's own docs, instead of giving you a generic "any API" box. Under the hood it's an HTTP client: it submits a task to KIE, polls until it finishes, downloads the result, and hands you back a normal ComfyUI IMAGE. From the canvas it looks like a sampler. It is not.

    One thing KIE's own doc note on this node is worth internalising: generated images are stored for 14 days, then they expire. The url output is not a permanent asset. Whatever you keep, keep as a file in ComfyUI's output folder.

    How it works

    Every generated node in the pack follows the same pipeline. Your inputs are assembled into the request body KIE documents, media you connect is uploaded first, the task is created, the pack polls until timeout_seconds (1200 by default), and the first result URL is downloaded into a native IMAGE tensor. Along the way you get a credit receipt shown on the node, plus sockets for everything else.

    It also runs local preflight checks before anything is uploaded or billed. Right-click the node and choose KIE Next · Check inputs & model controls to see the documented fields and limits for free.

    The inputs that matter

    • size is required and has exactly three options: 1:1, 3:2, 2:3. No 16:9, no 21:9. If your workflow needs a widescreen frame, this is the wrong node and you should be looking at the FLUX 3 or GPT Image nodes in the same pack.
    • prompt is where the idea goes. KIE's tooltip is explicit that at least one of prompt or files_url must be supplied - so an edit-only run with no prompt is legal, but a completely empty run is not.
    • files_url is a string, not an image socket. It wants a JSON array of up to five publicly reachable image URLs.
    • file_url does the same job for one image and is marked deprecated in the tooltip. Don't build on it.

    That string-not-socket thing is the trap. Most of the pack's media fields become native IMAGE inputs and get uploaded for you automatically; files_url and file_url didn't, so a Load Image wired into this node simply isn't possible. The workaround is in the same pack: KIE Next / Utility / Media → KIE • Upload Image takes an IMAGE and returns first_url plus urls_json. Wire urls_json into files_url (it's already the JSON array shape) or first_url into file_url, and you're back to working locally.

    Outputs and where they go

    image goes to Save Image or Preview Image like any other generation. url is the remote copy - fine for pasting into a message, useless as an archive. task_id is the one to hold onto: the pack ships KIE • Reuse Completed Image/Video/Audio, which can pull a finished task back without paying for it again. all_urls_json matters when you asked for several results; raw_json when something looks wrong and you want to see exactly what the provider said. credits_consumed and credits_left tell you what it cost.

    Note that this node is not an output node, so it won't execute unless something downstream consumes it. Connect the image to a save or preview node or the queue will just… do nothing.

    Installing it

    ComfyUI Manager → search "KIE.ai Nodes Next", or the Registry package name:

    comfy node install kie-ai-nodes-next
    

    Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    cd ComfyUI-KIE-Nodes-Next
    pip install -r requirements.txt
    

    Then restart ComfyUI. The dependency list is genuinely light - requests, Pillow, numpy, PyYAML - and there are no model weights to download. The models/ folder in the repo is a JSON catalog, not a checkpoint. Nothing here needs VRAM, which is rather the point.

    Then set the key: Settings → KIE.ai Nodes Next → Connection → Paste / replace KIE.ai API key. The pack validates it against KIE before overwriting anything, shows a masked fingerprint when it's saved, and keeps the key out of your workflow JSON. Environment-variable keys are deliberately not supported, so an KIE_API_KEY export won't help you.

    Where people get burned

    The refusals are the model's, not the node's. Openness aside, 4o is a filtered commercial endpoint - no local abliteration trick applies, because there are no weights on your disk to edit.

    Then there's the expiry window and the URL habit: people screenshot a workflow that ran last month and find every url dead. Re-download, or use the reuse node.

    And the size enum catches people who didn't look: three ratios is not a bug in the pack, it's what KIE documents for this endpoint. Check size before you spend a credit, not after.

    CategoryKIE Next/Image/OpenAI/4o Image

    Inputs (6)

    NameTypeDefaultDescription
    sizeCOMBO1:1(Required) Aspect ratio of the generated image. Must be one of the listed values.
    promptoptSTRINGA beautiful sunset over the mountains(Optional) Text prompt that conveys the creative idea you want the 4o model to render. Required if neither `files_url` nor `file_url` is supplied. At least one of `prompt` or `files_url` must be provided.
    files_urloptSTRING[ "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 `files_url` must be provided.
    file_urloptSTRINGhttps://example.com/image.png(Optional, Deprecated) File URL, such as an image URL. If file_url is provided, 4o image may create based on this image. This parameter will be deprecated in the future, please use files_url instead.
    timeout_secondsoptINT120030–7200—
    callback_urloptSTRINGOptional KIE callback URL. Leave empty for normal ComfyUI use.

    Outputs (7)

    NameTypeDescription
    imageIMAGE—
    urlSTRING—
    all_urls_jsonSTRING—
    task_idSTRING—
    raw_jsonSTRING—
    credits_consumedFLOAT—
    credits_leftFLOAT—