Nodes/ComfyUI-YogurtNodes/OpenAI Generate Image
ComfyUI Node

OpenAI Generate Image

Generate Images With OpenAI, Straight Into a Sampler-Ready Tensor

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
OpenAI Generate Image
  • image
  • image1
  • image2
  • image3
  • image4
  • history
  • image
  • images
  • num_images
  • text
  • history
api_key
base_url
model_namegpt-image-1
system_prompt
prompt
sizeauto
qualityauto
stylevivid
n1
response_formaturl
retry_count1
chat_template<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->
proxy_url
api_typeauto
seed-1
aspect_ratioauto
timeout0
extra{}
image_send_modeupload

The awkward truth about cloud image models in ComfyUI is that they output files, and ComfyUI wants tensors. YogurtOpenAIGenerateImage closes that gap: it calls the OpenAI image API and hands you back a proper IMAGE tensor - no downloading, no re-encoding, no PNG-loading node to wedge in between.

The inputs that actually matter on day one:

  • api_key - your OpenAI key. Leave blank and it falls back to the pack's api_key.json file or the OPENAI_API_KEY env var.
  • prompt - the main prompt.
  • system_prompt - a system-level instruction that biases overall style.
  • model_name - defaults to gpt-image-1.
  • size, quality, style - resolution, quality level, and style (vivid/natural). Note style is dall-e-3 only, and n (number of images) is dall-e-2 only - the tooltips say so because the API mixes generations of models.

Then there's the whole second layer: base_url (blank = official API, but set it for Azure or any OpenAI-compatible server), chat_template (the default template slots {{system_instruction}} and {{prompt}} into a structured message), seed, aspect_ratio (for nano banana models), proxy_url, api_type (auto picks between the Responses and Images API based on model), timeout, and retry_count.

The optional inputs are where it gets interesting: image plus image1image4 let you do image editing - feed a base image and prompt a change. There's also history for multi-turn, extra for raw JSON request params, and image_send_mode (upload for official, base64 for x.ai-style compatibility).

Outputs: image (single IMAGE), images (the batch as a list), num_images, text (the model's text response), and history.

What you can do with it

The tensor output means the result flows straight into standard ComfyUI nodes - VAE-free because it's already an image, ready for upscaling, compositing, comparison, or a detail pass. Pair it with the pack's YogurtSaveImageBridge to write files, or use the text output to capture the model's explanation of what it generated. The image/image1-4 edit inputs make it a poor-man's photo editor inside your graph: fix a face, restyle a product shot, iterate on a composition, all with one node.

Install and keys

Ships in ComfyUI-YogurtNodes - a quiet, single-maintainer pack with basically no community footprint, so the README is your documentation. ComfyUI Manager → search ComfyUI-YogurtNodes → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Restart ComfyUI, find it under "Yogurt Nodes/LLM". The openai Python package is the only real dependency here.

Three things get people:

  1. Key not picked up. The priority is inline api_key field > api_key.json in custom_nodes/ComfyUI-YogurtNodes/yogurt_nodes/llm/ > OPENAI_API_KEY env var. If you filled the field, it wins - that's usually fine, just know it can be a file instead.
  2. DALL-E-3-only params. style and n do nothing on gpt-image-1. Read the tooltips.
  3. Cost. This is a metered API. retry_count and a big n multiply spend; keep n at 1 and watch your usage panel.
CategoryYogurtNodes/LLM

Inputs (25)

NameTypeDefaultDescription
api_keySTRINGAPI key for accessing OpenAI API
base_urlSTRINGBase URL for OpenAI API (leave blank for official API)
model_nameSTRINGgpt-image-1OpenAI image generation model name
system_promptSTRINGSystem-level prompt that affects the overall image generation style
promptSTRINGMain prompt content for image generation
sizeCOMBOautoSize of the generated image
qualityCOMBOautoQuality of the generated image
styleCOMBOvividStyle of the generated image (dall-e-3 only)
nINT11–10Number of images to generate (dall-e-2 only)
response_formatCOMBOurlResponse format for generated images
retry_countINT1Number of retries when request fails
chat_templateSTRING<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->Content template for the image generation prompt
proxy_urlSTRING代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h
api_typeCOMBOauto选择使用的API类型: auto(自动根据模型选择), response(Responses API), image(Images API)
seedINT-1-1–2147483647Random seed for generation (-1 for random)
aspect_ratioCOMBOautoAspect ratio for generated images, for nano banana only
timeoutINT00–2147483647Timeout for the request in seconds, 0 means no timeout
imageoptIMAGE
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
historyoptHISTORY
extraoptSTRING{}Extra parameters for the request, in JSON format
image_send_modeoptCOMBOupload输入图像发送方式: upload(文件上传, OpenAI官方兼容), base64(JSON中data URL, x.ai兼容)

Outputs (5)

NameTypeDescription
imageIMAGE
imagesIMAGE
num_imagesINT
textSTRING
historyHISTORY