Nodes/ComfyUI FlexAI Nodes/OpenAI Image (FlexAI)
ComfyUI Node

OpenAI Image (FlexAI)

Generate images in the cloud, then wire them right back into your graph

By Semonxue·Created 12 months ago·Updated 9 months ago· 6
OpenAI Image (FlexAI)
  • image_1
  • image_2
  • image_3
  • image_4
  • IMAGE
providerdefault
modeldall-e-3
custom_model
promptA cute cat in watercolor.
size
compatibility_modefalse
streamingfalse
debugfalse

Generating an image in ComfyUI usually means loading a checkpoint and praying your VRAM survives the queue. This node takes a different road entirely: it phones out to an OpenAI-compatible image API - DALL·E, or Google's nano-banana (Gemini 2.5 Flash Image) through a relay - and hands the result back as a perfectly normal IMAGE tensor. No sampler, no VAE, no local model. The API does the heavy lifting; your GPU doesn't even break a sweat.

That's the whole point of the FlexAI pack, really. The author built it to simplify his own workflow around hosted models, and it shows in how well the node slots into the rest of ComfyUI. You get cloud-quality generation and editing without giving up the graph - pipe the output into an upscaler, a face detailer, or just straight to SaveImage.

How it works

The node has two operating modes, and it picks automatically based on what you feed it:

  • No images attached → hits /v1/images/generations. Plain text-to-image.
  • 1–4 images attached → hits /v1/images/edits. This is your img2img / edit path.
  • Compatibility mode on → everything goes through /v1/chat/completions instead.

That last toggle matters more than it looks. A bunch of the providers people actually use with this thing - OpenRouter, and the Gemini relay services like api.tu-zi.com or gemini-balance that the author names in the README - don't expose the standard images API at all. Compatibility mode is the fallback that makes them work, with streaming supported. One honest gotcha buried in the source: native edit mode only ever sends the first image to the API. If you want true multi-image editing, you need compatibility mode.

The inputs that matter

  • provider - the dropdown of API channels from your .env. Add more any time, switch without restarting.
  • model / custom_model - pick from the dropdown, or type any model name into custom_model. Run once and it's saved to the dropdown for next time. This is how you call nano-banana, nano-banana-pro, or gemini-3-pro-image-preview without waiting for an update.
  • prompt - the generation or edit instruction. Defaults to "A cute cat in watercolor.", which is a great first test prompt.
  • image_1 … image_4 - the optional edit inputs. Attach one and it switches to edit mode automatically; attach none and it generates fresh.
  • size - leave blank for 1024x1024. With nano-banana family models in non-compatibility mode you can instead type an aspect ratio like 16x9 or 9x16, and the node maps it to the resolution the model expects.
  • compatibility_mode / streaming / debug - flip compatibility on for OpenRouter-style providers, and debug if something's going wrong.

The single output is one IMAGE tensor (multi-image responses are handled too). When the API call fails, you don't get a crash - you get a dark-red image with the error message rendered onto it. Weird at first, but honestly nicer than a wall of red text.

Installing it

Two options, same result:

# ComfyUI Manager: search "ComfyUI FlexAI" and hit install
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Semonxue/Comfyui-flexai.git
cd Comfyui-flexai
pip install -r requirements.txt

The dependencies are refreshingly light - openai, Pillow, python-dotenv, requests. No model downloads, no multi-gigabyte checkpoints.

Then create a .env in the plugin folder:

OPENAI_API_KEY=your_key_here
OPENAI_API_BASE=https://api.openai.com/v1  # optional

Multi-provider setups use OPENAI_API_KEY_<name> / OPENAI_API_BASE_<name> pairs with an OPENAI_PROVIDERS list. Restart ComfyUI after editing .env.

Troubleshooting

  • "API key is not configured" - you're hitting the placeholder check. The shipped .env.example contains sk_default-style values that the node deliberately rejects, so it also fires if you copied the example without filling it in.
  • Wrong output size - empty size silently becomes 1024x1024. If your model wants something specific, say so explicitly.
  • Result comes back at a huge size and skips SSL - the node downloads returned images with certificate verification disabled. It's a pragmatic choice for flaky relays, but know your provider before pointing it at anything important.
  • Edit mode ignores images 2–4 - native edit uses the first image only. Turn on compatibility mode for multi-image work.

One last thing, and it's the same warning every network node deserves: this thing ships your prompt and images to a third-party server, and a custom node runs arbitrary code on your machine. Know where your data is going. If you've been around since the ComfyUI_LLMVISION malware scare, you already know why that's not paranoia.

Categoryflexai

Inputs (12)

NameTypeDefaultDescription
providerCOMBOdefault1 options: default
modelCOMBOdall-e-32 options: dall-e-3, dall-e-2
custom_modeloptSTRING
promptoptSTRINGA cute cat in watercolor.
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
sizeoptSTRING
compatibility_modeoptBOOLEANfalseEnable compatibility mode for services like OpenRouter via chat endpoints.
streamingoptBOOLEANfalseEnable streaming for compatibility mode.
debugoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE