ComfyUI Node

GPT Image 2

GPT Image 2 in ComfyUI Without the Official Partner Node

By bluexh-gh·Created 4 months ago·Updated 4 months ago· 0
GPT Image 2
  • image1
  • image2
  • image3
  • image4
  • image5
  • image6
  • image7
  • image8
  • image9
  • image10
  • code
  • message
  • image
url_prefixhttps://bmc-llm-relay.bluemediagroup.cn
api_key
prompt
timeout300
sizeauto
qualityauto
output_formatpng

The name tells you the whole pitch: this node drops GPT Image 2 - OpenAI's closed, never-downloadable image model - into your ComfyUI graph as a single node. No weights, no VRAM, no checkpoint. It's an API call wearing a ComfyUI costume: you type a prompt, optionally feed it up to ten reference images, and it phones a server that runs the model for you, then hands the result back as a normal IMAGE tensor you can wire into an upscaler or a save node like anything else.

The catch is in the details, and the first one is right on the surface: the node itself isn't from OpenAI, and it doesn't default to OpenAI's endpoint. The url_prefix default is https://bmc-llm-relay.bluemediagroup.cn - a third-party relay, not api.openai.com. That's the reseller/proxy pattern the community knows well from the Nano Banana crowd (external-api-nodes.md). If you're building a serious workflow, you'll point that field at whatever OpenAI-compatible endpoint you actually have a key for, and you'll think hard before sending a stranger's relay your prompts and reference images. More on that below.

How it actually works

Open the source and it's about 280 lines, one commit, no cleverness. With no reference images it POSTs JSON to {url_prefix}/v1/images/generations with model: "gpt-image-2", your prompt, and the size/quality/output_format you picked. Add one or more image1image10 inputs and it switches to {url_prefix}/v1/images/edits, sending the images as PNG data URIs converted to multipart files, with input_fidelity: "high" hardcoded in the body. Either way it authenticates with a Bearer header, waits up to your timeout, and decodes the b64_json in the response back into a torch tensor. Clean, boring, and predictable.

The three outputs are the parts beginners get tripped up on:

  • code (INT): 0 success, 1 failed, 2 timeout, 999 unknown. Your error check.
  • message (STRING): the human-readable status, including the actual HTTP status or the API's error text when something dies.
  • image (IMAGE): the generated image - or, on any failure, a blank 1x1x1x3 zero tensor.

That last one is the trap. The node is OUTPUT_NODE = True, so a failed call doesn't raise a graph error; it quietly passes a 1×1 black tensor downstream while stashing the reason in message. Wire that straight into a save node and you'll get a valid-looking black PNG and zero explanation. Check code (or at least message) before you save, or you'll spend an hour convinced your workflow broke when the API just said no.

The only required fields that matter for your first run: url_prefix, api_key, and prompt. timeout defaults to 300 seconds, which is generous but fine - leave it. Among the optional ones, size (auto, 1024x1024, 1536x1024, 1024x1536) and quality (autohigh) are the two you'll actually touch.

Installing it

The pack is tiny and has no heavy dependencies - requirements.txt lists requests, Pillow, torch, and numpy, every one of which ships with ComfyUI already. So realistically there's nothing extra to install:

cd ComfyUI/custom_nodes
git clone https://github.com/bluexh-gh/ComfyUI-BlueXH-Nodes.git

Restart ComfyUI, and GPT Image 2 appears in the StarUnion-GptImage2 category. Or search "ComfyUI-BlueXH-Nodes" in ComfyUI Manager and let it handle it.

The honest warnings

This is a brand-new, single-commit pack from an unknown author, and it's an API-wrapper node - the exact category that already shipped credential-stealing malware in this ecosystem once (ComfyUI_LLMVISION). Its whole job is to carry your API key and make outbound calls, so a malicious version wouldn't even look wrong. The code here is short enough to skim before your first run; do that. And keep the KB's frame in mind: whatever GPT Image 2's own moderation refuses, this node cannot bypass - closed models come with filters, and no local weights exist to edit. Per-call cost and your data leaving the machine are features, not bugs. For a model you can't download, that's the price of entry - just make sure the endpoint you're paying is the one you think it is.

CategoryStarUnion-GptImage2

Inputs (17)

NameTypeDefaultDescription
url_prefixSTRINGhttps://bmc-llm-relay.bluemediagroup.cn
api_keySTRING
promptSTRING
timeoutINT3001–1800
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
image5optIMAGE
image6optIMAGE
image7optIMAGE
image8optIMAGE
image9optIMAGE
image10optIMAGE
sizeoptCOMBOauto4 options: auto, 1024x1024, 1536x1024, 1024x1536
qualityoptCOMBOauto4 options: auto, low, medium, high
output_formatoptCOMBOpng3 options: png, jpeg, webp

Outputs (3)

NameTypeDescription
codeINT
messageSTRING
imageIMAGE