Nodes/comfyui_chatgpt/Chat GPT Image Edit Node
ComfyUI Node

Chat GPT Image Edit Node

Edit images with OpenAI's gpt-image API — your VRAM stays untouched

By SamTyurenkov·Created about a year ago·Updated 5 days ago· 0
Chat GPT Image Edit Node
    • IMAGE
    • STRING
    promptEdit image according to this prompt.
    sizeauto
    qualityauto
    input_fidelitylow
    image1
    image2

    The name says "ChatGPT," the node looks like every other box in your graph, and it'll happily sit right next to your SDXL checkpoint without complaining. But this one does no work locally. It's an API wrapper: it ships your image up to OpenAI's gpt-image edit endpoint, waits for the result, and hands it back to the rest of your workflow as an ordinary IMAGE tensor. No model download, no VRAM pressure, no ControlNet. The price of admission is an OpenAI API key and per-image cost.

    Why would you reach for that in a local-first tool? Because OpenAI's models are genuinely good at some things your local stack isn't. The author's own use case is the best example: he generates characters locally in SDXL, then lets OpenAI generate the backgrounds, because the closed model just renders them better. This edit node is the other half of that hybrid - send an image up for an edit or composite, get a finished tensor back, and continue downscaling or upscaling locally.

    How it works

    Feed it a prompt plus up to two images, and it calls OpenAI's Images API images.edit with the size, quality, and input_fidelity you picked. The response comes back as base64, gets decoded, and lands on the output as a proper ComfyUI image you can pipe into Save Image or anything else in the graph.

    The one input that trips people up: image1 and image2 are STRING, not IMAGE. They expect base64-encoded PNG data. This pack ships a "Convert Image to Base64" node precisely for that - wire your IMAGE tensor into it and feed its string output into the edit node. Skip that and nothing shows up on the input side.

    The inputs that matter

    • prompt - multiline, plain English. "Add a sunset behind the building," not a weighted prompt. This is an edit instruction, not an SD prompt.
    • size - auto or one of the presets (1024x1024, 1024x1536, 1536x1024). Bigger output, bigger bill.
    • quality - auto / low / medium / high. Higher quality costs more credits per edit.
    • input_fidelity - high or low, default low. It's passed through for the older gpt-image family; the current gpt-image-2 model handles fidelity on its own, which is why it sits at low by default.

    Outputs are IMAGE (the edited result) and STRING (the raw API response - useful to peek at when something goes sideways, since it's the only place you'll see an error message).

    Install

    It ships in the same pack as the generation node, so this is a one-and-done install. Easiest route is ComfyUI Manager:

    1. Open Manager → Install Custom Nodes → search comfyui_chatgpt → install → restart ComfyUI.

    Or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SamTyurenkov/comfyui_chatgpt
    

    Then restart. The pack needs openai, Pillow, numpy, torchvision, and dotenv support - Manager pulls those automatically; manually, install openai and python-dotenv into your ComfyUI Python environment.

    The part no installer can do for you is the API key. The node reads OPENAI_API_KEY from the environment or a .env file in ComfyUI's working directory:

    # in the ComfyUI install folder
    echo "OPENAI_API_KEY=sk-..." > .env
    

    Where people get burned

    • No key set - authentication error before anything happens. Check .env first.
    • Feeding an IMAGE tensor into image1/image2 - they're strings. Route through the pack's "Convert Image to Base64" node.
    • A black 1x1 image on the output - that's the node's placeholder when the API returns nothing, usually a refused prompt or a billing problem.
    • Moderation - OpenAI decides what it will and won't edit, and its guardrail behavior has flip-flopped over the years. If a prompt keeps getting refused, that's the filter, not your ComfyUI setup.
    • Cost and privacy - the image leaves your machine and every edit costs money. That's the whole deal with a closed API; fine for hybrid workflows, wrong for anything private or high-volume.

    If you'd rather not feed OpenAI at all, the same author's pack also carries "Banana" nodes that do this trick against Google's Nano Banana API instead.

    Categorysd

    Inputs (6)

    NameTypeDefaultDescription
    promptSTRINGEdit image according to this prompt.
    sizeCOMBOauto4 options: auto, 1024x1024, 1024x1536, 1536x1024
    qualityCOMBOauto4 options: auto, low, medium, high
    input_fidelityCOMBOlow2 options: high, low
    image1optSTRING
    image2optSTRING

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    STRINGSTRING