Stability AI (Image Gen)
SDXL from the cloud, wired into your graph
- images
Some machines just can't run SDXL locally, and some people want the convenience of a hosted API without leaving ComfyUI. LF_StabilityAPI is the lf-nodes wrapper around Stability AI's hosted text-to-image endpoint: you type a prompt, it calls api.stability.ai, and a finished image tensor lands back in your graph as if a local sampler had made it. It's the node that answers "can I get SDXL from the cloud inside my workflow?" - with one important catch, which we'll get to, because it's a doozy.
How it works
The node builds a text-to-image request - prompt, optional negative prompt, model, size, steps, CFG, sample count, optional style preset - and posts it to a proxy rather than to Stability directly. The proxy (the pack's /lf-nodes/proxy/stability route) is what holds your API key and injects it as the Authorization header, so the key never touches the browser or the graph. The response comes back as base64 artifacts, which the node decodes into IMAGE tensors.
The catch: that proxy doesn't exist out of the box. The proxy lives in the pack's Workflow Runner, which is opt-in and disabled by default. With a stock install, this node raises "No proxy URL configured" immediately. To actually use it you need to either:
- set
WORKFLOW_RUNNER_ENABLED=truebefore starting ComfyUI (which activates the runner and its proxy routes), and - set
STABILITY_API_KEY(orSTABILITY_API_KEY_FILEpointing at a file containing it), - or set
STABILITY_PROXY_URLto point at your own proxy implementing the same contract.
There's also an optional LF_PROXY_SECRET - if set, requests must carry the X-LF-Proxy-Secret header, which the node sends when the env var is present. Default model is stable-diffusion-xl-1024-v1-0; you can override with any model id the API accepts.
The inputs that matter
- prompt (STRING, required) - the only required input. Empty prompts fail with a clear error.
- negative_prompt (STRING) - sent as a weight −1 prompt.
- width / height (INT, 64–2048, default 512) - output size. Remember the API is your bottleneck now; 1024+ costs more and takes longer than 512.
- steps (INT, 10–150, default 20), cfg_scale (FLOAT, 0–35, default 7), samples (INT, 1–10) - the standard diffusion knobs, sent to the API as-is.
- style_preset (enum, 18 options) - "cinematic", "photographic", "anime", "neon-punk" and friends. A freebie layer of API-side styling.
- timeout (INT, default 120s) - how long to wait; image generation genuinely can take this long.
Output is images (IMAGE) - your generated batch, ready to feed a preview or a save node.
Install
Pack-level install applies:
- ComfyUI Manager: search "LF Nodes", install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/lf-nodes.git, restart.
Then the setup above: enable the runner, set the key, restart. The pack's requirements.txt includes the HTTP machinery you need; no model downloads (the model runs on Stability's GPU, not yours).
Common issues
- "No proxy URL configured" - the #1 issue, and it's the opt-in gotcha above. Enable the runner and set
STABILITY_PROXY_URL, or you're done before you start. - "Stability API error: 401 / 403" - the key isn't reaching the proxy. Check
STABILITY_API_KEY(or the_FILEvariant) is set in the environment ComfyUI actually starts with, and that the proxy is enabled so it can read it. - Cost reality check. This is a metered cloud call - every run spends money. The API-wrapper node pattern is great when the model can't run locally, but if SDXL does fit on your card, the local sampler is free after electricity. Worth being honest about which bucket you're in.
- It's a network node with a credential. The KB's standing advice applies: it's from an established, actively-maintained pack rather than a stranger's one-off, but any node that ships a key and phones home is the shape to be careful with. Set
LF_PROXY_SECRETso your proxy demands the header, and don't paste keys into workflow files.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text prompt to generate image from. | |
| modelopt | STRING | stable-diffusion-xl-1024-v1-0 | Stability AI model to use for generation. |
| negative_promptopt | STRING | Negative prompt to avoid in generation. | |
| widthopt | INT | 51264–2048 | Width of generated image. |
| heightopt | INT | 51264–2048 | Height of generated image. |
| stepsopt | INT | 2010–150 | Number of diffusion steps. |
| cfg_scaleopt | FLOAT | 7.00–35 | Classifier-free guidance scale. |
| samplesopt | INT | 11–10 | Number of images to generate. |
| style_presetopt | COMBO | Style preset to use for generation. | |
| timeoutopt | INT | 120 | Request timeout in seconds. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Generated images from Stability AI. |