Nodes/comfyui_jas_nodes/JAS OpenAI Text to Image [set OPENAI_API_KEY]
ComfyUI Node

JAS OpenAI Text to Image [set OPENAI_API_KEY]

OpenAI's best image model, one key away — no Comfy account required

By reducm·Created 4 months ago·Updated 4 months ago· 0
JAS OpenAI Text to Image [set OPENAI_API_KEY]
    • images
    prompt
    base_urlhttps://api.openai.com/v1
    modelgpt-image-2
    qualitylow
    backgroundauto
    sizeauto
    custom_width1024
    custom_height1024
    n1
    seed0

    Some models you will simply never run on your own GPU, and GPT Image is one of them - OpenAI ships it as an API, not weights. If you want gpt-image-2 output inside a ComfyUI workflow, your options are the official Partner Node (Comfy account, prepaid credits, metered storefront) or a plain API wrapper like this one. Paste an OPENAI_API_KEY into your environment, type a prompt, and the node phones OpenAI and drops the generated image back into your graph as a normal IMAGE tensor. No account login, no credits balance, no GPU involved.

    Where this fits in a real workflow: as a "bring the closed model next to the local one" move. The classic setup is a draft from a fast local model, then a pass through this node for the things local can't do well - legible text in image, complex compositions, characters that follow instructions - then back out to your local upscaler. One node in a graph full of local samplers, doing the one job local can't.

    How it works

    It's a thin, honest HTTP client. The node builds a JSON payload (prompt, model, quality, background, size, n) and POSTs it to OpenAI's images endpoint. A nonzero seed becomes a user: seed:N string in the request - the README warns that OpenAI generation isn't deterministic even when a seed-like field is present, so treat it as a nod to workflow compatibility, not reproducibility. The returned image (base64 or a URL) is decoded into a tensor and handed downstream.

    The inputs that matter

    • prompt - the whole job. Multiline, so write a real paragraph if the subject needs one.
    • model - gpt-image-1, gpt-image-1.5, or gpt-image-2 (default). The version that actually matters is gpt-image-2; it's also the only one that unlocks Custom sizes.
    • quality - low/medium/high. For drafts, low is fine and fast; for anything you'll keep, high.
    • background - auto/opaque/transparent. transparent is blocked on gpt-image-2 (API constraint), so if you need alpha, drop to gpt-image-1.5.
    • size - auto plus a ladder of presets up to 3840×2160, and Custom, which opens custom_width/custom_height (multiples of 16, 1024–3840, aspect ratio ≤3:1, pixel budget between ~0.6M and ~8.3M; only honored by gpt-image-2). The node validates all of it and refuses politely if you break the rules.

    n (1–8) gets you multiple variants per call. Output is a single images tensor - into Save Image, or straight into an upscaler.

    Installing it

    This is one of six nodes in the comfyui_jas_nodes pack. In ComfyUI Manager, search "comfyui_jas_nodes". By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/reducm/comfyui_jas_nodes
    cd comfyui_jas_nodes
    python -m pip install -r requirements.txt   # `requests` is the whole dependency list
    

    Then set the key and restart ComfyUI from a shell that has it:

    export OPENAI_API_KEY="sk-..."
    

    No model files to download, no VRAM to worry about. The node name's "[set OPENAI_API_KEY]" is literally the setup instruction.

    Common issues

    The near-universal first failure is the key missing from ComfyUI's environment: the node dies instantly with OPENAI_API_KEY is not set. Set it in the shell you actually launch ComfyUI from, then fully restart. After that, provider failures surface as raw HTTP status plus response body, which is a blessing - the error usually says exactly what OpenAI objected to. Two expectations to set before you start: your prompt leaves your machine and hits OpenAI's filter at the source (the node can't bypass a refusal), and per-call cost is real, so a high-quality 3840px batch of 8 is where the meter starts to hurt. For one-off "closed model, inside my workflow" generations, it's the simplest path there is.

    Categoryjas/OpenAI

    Inputs (10)

    NameTypeDefaultDescription
    promptSTRING
    base_urlSTRINGhttps://api.openai.com/v1
    modelCOMBOgpt-image-23 options: gpt-image-1, gpt-image-1.5, gpt-image-2
    qualityCOMBOlow3 options: low, medium, high
    backgroundCOMBOauto3 options: auto, opaque, transparent
    sizeCOMBOauto10 options: auto, 1024x1024, 1024x1536, 1536x1024, 2048x2048, 2048x1152, +4
    custom_widthINT10241024–3840
    custom_heightINT10241024–3840
    nINT11–8
    seedINT00–2147483647

    Outputs (1)

    NameTypeDescription
    imagesIMAGE