Nodes/Chat-Image-Bridge-Node/Chat Image Bridge
ComfyUI Node

Chat Image Bridge

One node for any OpenAI-compatible image API

By Marigold1122·Created 3 months ago·Updated 22 days ago· 3
Chat Image Bridge
  • image_1
  • image_2
  • image
api_key
base_url
modelgemini-3-pro-image-preview
prompt
resolutionauto
aspect_ratioauto
timeout_seconds300

The pack is named after this node, and it's the one to reach for when you want to drop a hosted image model - Gemini, GPT Image, or whatever your relay fronts - straight into a ComfyUI graph without thinking about API formats. ChatImageBridge is a generic OpenAI-compatible /v1/chat/completions client. Give it an api_key, a base_url, a model, and a prompt, and it comes back with an IMAGE tensor ready for a Save Image node. The name is a little misleading in one direction: there's no local bridge process, no model download, nothing running on your GPU. It's a thin, well-behaved HTTP client with some smart format handling bolted on.

How it works

The node builds a chat payload: your images (up to two, as image_1/image_2) are base64-encoded PNG data URLs, your prompt becomes the user message, and everything goes to the provider. The interesting part is how it handles resolution and aspect ratio, because the answer depends on the model:

  • Gemini models (the default is gemini-3-pro-image-preview) get the native Gemini request format when resolution or aspect_ratio isn't auto. That sends imageConfig.imageSize and imageConfig.aspectRatio as real generation parameters, which is the only way "4K" actually means 4K on Gemini.
  • Everything else gets the values written into the prompt as hints ("Resolution: 1K. Aspect ratio: 16:9."), which is what most OpenAI-compatible relays expect.

On the way back it hunts for images anywhere in the response - markdown image syntax, direct URLs, b64_json, or Gemini inlineData - and converts the first batch of same-sized ones into a tensor. No matter what your relay wraps the image in, the node usually finds it.

The base_url field is forgiving on purpose: https://example.com, https://example.com/v1, and the full .../v1/chat/completions all work, and it normalizes them to the right endpoint.

The inputs that matter

  • api_key - required, provider-supplied. The pack never hardcodes one; leave it empty and you get "api_key is required".
  • base_url - provider root or relay address.
  • model - defaults to gemini-3-pro-image-preview. There's a Fetch Models button on this node: fill in the two fields above, click it, and it calls the provider's /v1/models and fills the dropdown. Relays that don't support that endpoint just let you type the model name by hand.

After those, you've got prompt (multiline), resolution (auto/1K/2K/4K), aspect_ratio (auto plus the usual 1:1, 16:9, 9:16…), and timeout_seconds (default 300, range 30–1800). The only output is image.

Install

It ships with the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Marigold1122/Chat-Image-Bridge-Node.git ComfyUI-ChatImageBridge
pip install -r ComfyUI-ChatImageBridge/requirements.txt

Restart ComfyUI and look under api -> Chat Image Bridge -> Chat Image Bridge. ComfyUI Manager search "Chat-Image-Bridge-Node" does the same thing. Requirements are just requests - no model files, no heavy deps, nothing to download.

Troubleshooting

  • "api_key is required" / "base_url is required" - both are checked before anything leaves your machine, so the error is honest.
  • "response did not contain image data or image URLs" - the relay returned something with no image in it, and the node shows you a redacted preview of what it got. Classic causes: a provider that returns images in a format the node can't parse, or a refusal/moderation block that's plain text.
  • Relays vary. The README's own warning is that different relay providers have different OpenAI-compatible coverage - one field can behave differently across providers, which is exactly what the Advanced sibling node is for.
  • If you have old workflows using endpoint_url, rename it to base_url - that was the old parameter name.

One honest caveat: your API key rides in the request Authorization header, and the node runs arbitrary Python from a git repo you installed by hand. That's true of every custom node in the ecosystem; just don't install it from a fork you don't recognize.

Categoryapi/Chat Image Bridge

Inputs (9)

NameTypeDefaultDescription
api_keySTRING
base_urlSTRING
modelSTRINGgemini-3-pro-image-preview
promptSTRING
resolutionCOMBOauto4 options: auto, 1K, 2K, 4K
aspect_ratioCOMBOauto11 options: auto, 1:1, 16:9, 9:16, 4:3, 3:4, +5
timeout_secondsINT30030–1800
image_1optIMAGE
image_2optIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE