Nodes/ComfyUI-LogicUtils/Get Image From Prompt
ComfyUI Node

Get Image From Prompt

Call an A1111/Forge instance's REST API from inside ComfyUI

By aria1th·Created 3 years ago·Updated 7 months ago· 116
Get Image From Prompt
    • IMAGE
    prompt
    api_endpoint
    auth
    seed-1
    negative_prompt
    steps28
    width1024
    height1024
    hr_scale1.50
    hr_upscaleLatent
    enable_hrfalse
    cfg_scale7

    Display name "Get Image From Prompt" undersells what this actually is: it's an HTTP client baked into a node. SDWebuiAPINode sends a txt2img-style request to a running Automatic1111-compatible WebUI's REST API (/sdapi/v1/txt2img, the endpoint that shape of request maps to) and pulls the resulting image straight back into your ComfyUI graph. You're not running the generation in ComfyUI at all - you're using ComfyUI as the front end to trigger and receive a job from a completely separate app.

    This lives in aria1th's ComfyUI-LogicUtils, a personal utility pack from the handle behind the Illustrious XL training work - mostly math and logic helpers, with this pair of API-bridge nodes as the outlier. Worth knowing the landscape it's bridging into: AUTOMATIC1111's WebUI itself has been feature-frozen since July 2024 (it can't run anything past SDXL), but its API surface lives on through actively-maintained forks like Forge and reForge that kept the same /sdapi/v1/* contract. If you've still got an A1111-family instance running SD1.5 or SDXL checkpoints somewhere - on another machine, a different Python environment, whatever - this node is how you fold its output into a ComfyUI pipeline instead of maintaining two disconnected workflows.

    How it works

    You give it a prompt and the URL of the WebUI's API endpoint. It builds and sends the request, waits for the WebUI to render the image, decodes the response, and returns it as a standard ComfyUI IMAGE - from there it's just another image in your graph, ready for further processing, upscaling, saving, whatever you'd normally do.

    Inputs and outputs

    The two you must fill in:

    • prompt (STRING) - your positive prompt text.
    • api_endpoint (STRING) - the base URL of the target WebUI's API, e.g. http://127.0.0.1:7860.

    Optional, all mirroring standard A1111 txt2img request fields: negative_prompt, seed (default -1, i.e. random), steps (default 28), width/height (default 1024×1024), cfg_scale (default 7), enable_hr (default off) with hr_scale (default 1.5) and hr_upscale (default "Latent") for hires-fix, and auth for basic auth credentials if the endpoint requires them.

    • Output: IMAGE - the generated image, ready to wire into anything else in ComfyUI.

    How to install it

    ComfyUI Manager: search "ComfyUI-LogicUtils", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aria1th/ComfyUI-LogicUtils
    

    then restart. This node needs an HTTP client library to actually talk to the WebUI's API - if it's missing, see the troubleshooting note below.

    Common issues & troubleshooting

    "Connection refused" or timeouts. The target WebUI needs to be running with its API enabled (--api launch flag on A1111/Forge) and reachable from the machine running ComfyUI - a WebUI on localhost won't be reachable if ComfyUI is running in a different container or over a network without port forwarding.

    Import error on ComfyUI startup. The README notes this pack's dependency installer is opt-in: set COMFYUI_LOGICUTILS_AUTO_INSTALL=1 before launching ComfyUI to let it install whatever this node needs, or COMFYUI_LOGICUTILS_SKIP_INSTALL=1 if that hook itself is misbehaving and you'd rather install requirements by hand.

    Wrong image size or missing hires-fix. Double-check enable_hr is actually toggled on if you expect the hires pass to run - leaving it at the default means you get a plain first-pass image at width×height, no upscale step.

    Slow or blocking. This node waits synchronously for the remote WebUI to finish generating before it can hand you an image - your ComfyUI run's total time now includes however long that other app takes, which can be a lot slower than a native GPU-side sampler if the WebUI instance is under load or on modest hardware.

    CategoryWebUI API

    Inputs (12)

    NameTypeDefaultDescription
    promptSTRING
    api_endpointSTRING
    authoptSTRING
    seedoptINT-1
    negative_promptoptSTRING
    stepsoptINT28
    widthoptINT1024
    heightoptINT1024
    hr_scaleoptFLOAT1.50
    hr_upscaleoptSTRINGLatent
    enable_hroptBOOLEANfalse
    cfg_scaleoptINT7

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE