Nodes/Comfyui-chatgpt-api/ComfyuiChatGPTApi
ComfyUI Node

ComfyuiChatGPTApi

No model, no GPU, just a key

By ainewsto·Created about a year ago·Updated about a year ago· 56
ComfyuiChatGPTApi
  • files
  • images
  • images
  • response
  • image_urls
  • chats
prompt
modelgpt-4o-image
api_key
image_url
temperature0.70
max_tokens4096
top_p1.00
frequency_penalty-2.00
presence_penalty0.00
seed-1
image_download_timeout600
clear_chatstrue

Here's the pitch: you wire this node into a ComfyUI graph, type a prompt, and get an image back - without downloading a single model or breathing on your VRAM. ComfyuiChatGPTApi is a thin HTTP client for OpenAI's chat-completions API, pointed at a proxy run by the pack's author (comfly.chat). If you've been fighting GGUF quants just to get a local LLM generating images, this is the opposite end of the spectrum: the heavy lifting happens on someone else's server, and ComfyUI becomes the UI around it.

How it works

The node POSTs an OpenAI-style chat request to https://ai.comfly.chat/v1/chat/completions. Your prompt goes in as text; if you feed an images input it gets base64-encoded and attached as image_url content, same shape OpenAI's API expects. The response is parsed for image URLs, downloaded, converted to a tensor, and pushed out the images socket - so anything downstream (Save Image, upscalers, further editing) just works.

The default model is gpt-4o-image, and the pack also knows gpt-4o-image-vip, sora_image, and sora_image-vip. One trap: the code hard-rejects gpt-image-1 with a Chinese error telling you to use the other four. That model lives in the sibling nodes, Comfyui_gpt_image_1 and Comfyui_gpt_image_1_edit - pick the right node.

The inputs that matter

  • prompt - the only required one. Multiline, so actual sentences work.
  • images / image_url - feed existing images to get editing or image-reference behavior. Wire a Load Image into images and it'll describe, caption, or edit what you give it.
  • clear_chats - the interesting one. True (default) means every run is stateless: whatever you feed in is what gets processed. False keeps the previous generation in context, so you can run the graph again with "make it bluer" and have it actually edit its own last output.
  • seed - -1 rolls a random seed per run.
  • image_download_timeout - default 600s, and you may need that patience (more below).

Everything else - temperature, max_tokens, top_p, the penalties - are standard OpenAI sampling knobs. Leave them alone until you have a reason.

Outputs: images (the tensor to save or keep processing), response (a formatted text log of the call), image_urls (the raw URLs it pulled), and chats (the running multi-turn conversation as text).

The catch: whose API is this?

This isn't OpenAI's own endpoint. It's a reseller proxy, and the README is refreshingly honest about it. The default "reverse-engineered" group is cheap - a fixed ¥0.06 per generation, with a free $0.20 signup credit to try it - but the author calls it slow and unstable, and warns to be patient. You need a key from ai.comfly.chat, and note that default-group keys only work with this node; the two gpt_image_1 siblings require a different (official, pricier) key group.

Install

It's on the ComfyUI Manager custom-node list, so the easy path works: Manager → Install Custom Nodes → search "Comfyui-chatgpt-api" → Install → restart ComfyUI. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/ainewsto/Comfyui-chatgpt-api

Then restart. The requirements file lists aiohttp, requests, numpy, Pillow, torch, GitPython - nothing you won't already have in a working ComfyUI install, and there are zero model downloads. Set your API key in the node input (it gets saved to Comflyapi.json in the pack folder) or leave the field empty and it reads the file.

Where people get burned

  • "API key not found in Comflyapi.json" - you never entered a key. Do that first.
  • Slow or timing out - expected on the reverse group. Raise image_download_timeout, run it again, have a coffee. The author's README basically says this.
  • Chinese error about gpt-image-1 - wrong node. Use Comfyui_gpt_image_1 for that model.
  • The files input - the README says it's unfinished. Ignore it.

One honest word of caution: this sends your prompts and images to a third-party proxy, and your key sits in plaintext in a JSON file. For throwaway experiments with the free credit it's fine. Don't route your private client work through it without thinking about what you're shipping where.

Categoryainewsto/Chatgpt

Inputs (14)

NameTypeDefaultDescription
promptSTRING
modelSTRINGgpt-4o-image
api_keyoptSTRING
filesoptFILES
image_urloptSTRING
imagesoptIMAGE
temperatureoptFLOAT0.700–2
max_tokensoptINT40961–16384
top_poptFLOAT1.000–1
frequency_penaltyoptFLOAT-2.00-2–2
presence_penaltyoptFLOAT0.00-2–2
seedoptINT-1-1–2147483647
image_download_timeoutoptINT600300–1200
clear_chatsoptBOOLEANtrue

Outputs (4)

NameTypeDescription
imagesIMAGE
responseSTRING
image_urlsSTRING
chatsSTRING