ComfyUI integration

How LayerShop works with ComfyUI

For people who want to know what happens under the panel, and for ComfyUI users who want LayerShop to use the setup they already have.

Who does what

LayerShop does not run models itself and contains none. It is the editor: it knows about your document, your selection and your layers. ComfyUI is the engine: it loads model files and runs them on your graphics card. They talk over ComfyUI's ordinary local HTTP interface.

LayerShopPreparesCrops around the selection, makes the mask, picks a render size, writes the workflow.
ComfyUIRendersQueues the workflow, loads the model, samples, returns an image.
LayerShopPlacesFits the image to the selection and adds it as a masked layer with its settings.

Because the interface is ComfyUI's own, anything that speaks it works: the copy LayerShop installs, ComfyUI Desktop, the portable build, a git checkout, or a server on another machine reached through a tunnel.

The managed engine

If you let the wizard set things up, you get a private ComfyUI with its own Python in LayerShop's folder. You never have to open it.

  • It starts when needed. The first local generation starts ComfyUI hidden; the panel shows "Starting ComfyUI…" for about half a minute. Later generations reuse it.
  • It stops when you quit. Only a server LayerShop started is ever stopped, on quit or with Stop Server.
  • Its output is kept. Everything ComfyUI prints goes to comfyui.log in the settings folder, and a start that fails quotes the last lines.

Preferences › Generative AI › Engine says which engine runs your local models: the ComfyUI LayerShop installed, with its version and folder, your own ComfyUI, or none yet. For the installed one it offers Repair and Remove Local AI…, and its launch settings stay folded away; with none, Set Up Local AI… starts the wizard.

The Engine page of Preferences › Generative AI: a card for the installed ComfyUI, marked Internal, with its folder, Repair and Remove Local AI buttons; below it the address with Connect, Give up after, the Start ComfyUI when a local model needs it switch, Stop Server and folded Launch settings

The setup now installs ComfyUI 0.45.0, the first version that runs MiniMax H3 Image. Updating from 0.43.0 puts the new engine beside the old one, whose folder (about 4.5 GB) you can delete.

The switch for starting it is on the same page: Start ComfyUI when a local model needs it and it isn't running.

Using your own ComfyUI

If a ComfyUI already answers at the configured address, LayerShop uses it as it is. Nothing is started, and nothing is stopped later: it is yours.

  • Address. The portable build listens on http://127.0.0.1:8188, ComfyUI Desktop on http://127.0.0.1:8000. Set it on the Engine page and press Connect; if nothing answers there, it also tries the other usual port.
  • Find Installation fills in the Python, folder and arguments from the ComfyUI that is running now, exactly as it was started, or from the installation ComfyUI Desktop recorded.
  • Browse… is for anything else: choose main.py and python.exe. Whichever half sits in a usual place next to the other (.venv, venv, python_embeded) is filled in for you.

ComfyUI Desktop and a server started by LayerShop want the same port. If Desktop will not start, press Stop Server in LayerShop first; it will then use Desktop's server.

Some models need a recent ComfyUI: FIBO 2 needs 0.43.0 and MiniMax H3 Image 0.45.0. When your own ComfyUI is older, the wizard warns beside each model that won't run, and a generation that is refused names the version to update to.

Model folders

Used ComfyUI before? Point LayerShop at the models folders you already have instead of downloading everything again: in the wizard (Location › Models you already have) or later in Preferences › Generative AI › Model Folders with Add Folder…. Up to 16 folders are read beside LayerShop's own, and their models and LoRAs appear with the rest.

The Model Folders page: LayerShop's models, marked Internal, and Your models folder, marked External (read only), each with its path, what it holds (diffusion models, checkpoints, LoRAs, text encoders, VAEs, ControlNets) and refresh, open, remove and expand buttons; Add Folder and Download Models buttons below
  • Each folder is marked Internal (LayerShop's own) or External (read only), with its path and what it holds. Click a folder to see its files; each row can be refreshed, opened in Explorer or removed. A folder on a drive that isn't plugged in says so.
  • Your folders are only read: nothing in them is changed or deleted. Downloads go to LayerShop's own folder, and a model the setup needs that one of your folders already has isn't downloaded again.
  • Adding a folder lists its models straight away, without starting ComfyUI. Removing one asks first, deletes nothing, and takes out of the model list what only that folder had.
  • Download Models… opens the Local AI setup's model list.

Folders laid out the AUTOMATIC1111 / Forge way (Stable-diffusion, Lora) aren't recognised yet: choose a ComfyUI-style models folder.

Managing models

Preferences › Generative AI › Manage Models is one list of every model, in the order the panel shows them, grouped by where each runs from: Cloud, Internal (LayerShop's own models folder), External (a folder of yours) and Not Installed. Click a group's header to fold it away; it stays folded, so if you only use local models you can hide the cloud ones for good. The chips above filter by what a model does: Text to Image, Editing, Inpainting.

The Manage Models page of Preferences: Cloud and Local switches, filter chips, the Cloud group folded and the Internal group open with Qwen Image 2.1, Krea 2 Turbo, Z-Image Turbo, FLUX.3 Klein, MOSS Image, FIBO 2 Dev, Ideogram 4, Ernie Image and MiniMax H3 Image ticked; GPT Image 2.6 Sunburst's settings on the right, used for text to image, editing and animation; Scan Server, Restore Defaults, Recommended Order and Remove Not Installed buttons below
  • Scan Server adds a model for every model file your ComfyUI has. If you have a recommended model stored another way (bf16 where the list expects int8), the listed entry is pointed at your file and keeps its settings.
  • + Add Model adds a cloud model, a local one by architecture, or one of the models made for inpainting.
  • Restore Defaults puts back recommended models that are missing and changes nothing else. A model added in a new release, such as MiniMax H3 Image, appears this way if you set up LayerShop before it.
  • Recommended Order puts the list back in the order LayerShop suggests.
  • Remove Not Installed… names the local models whose files are in none of the engine's folders and, once you agree, removes them. Recommended models stay.
  • Reset to Defaults…, under a model's settings, puts that model's settings back and removes its LoRAs.
  • The switches at the top leave cloud or local models out of the panel without removing them.

A model that can't run yet is greyed out, and its box can't be ticked, so the panel doesn't offer it. Your choice for it is kept for when it can run. Under its name it says why, and a button on its row fixes it:

  • Needs an API key from its provider, such as OpenAI: the key button opens API Keys with that provider's card in front, its field ready to paste into.
  • Not installed: your ComfyUI doesn't have the model's files. The download button opens the Local AI setup on its Models screen with that model ticked, so Install gets it.
  • Local AI is not set up: the same download button opens the setup, with the model ticked when the setup offers it.

Select such a model and a banner above its settings says the same, with the button that fixes it: Add API Key…, Install… (with its download size) or Set Up Local AI…. A model the setup doesn't offer, such as one you pointed at a file of your own, has no button: download its file into ComfyUI's models folder and press Scan Server, or choose another file.

Built-in workflows

Each local model has an architecture, and the architecture decides the workflow LayerShop queues. The workflows follow ComfyUI's own templates and use only nodes that ship with ComfyUI, so there are no custom nodes to install and none to break on an update.

ArchitectureLoadsSampling
Qwen Image 2.1diffusion model, text encoder, its own VAEits own prompt node, KSampler
Qwen Image Edit (2511)diffusion model, text encoder, VAE, or one all-in-one checkpointits own edit prompt node, KSampler
MiniMax H3 Imagediffusion model, text encoder, VAEits own conditioning node, 6 steps, CFG 1; up to 15 reference pictures
FIBO 2diffusion model, text encoder, FLUX.2 VAEits own prompt node, KSampler
Z-Imagediffusion model, text encoder, VAEAuraFlow shift, KSampler
FLUX.3 (Klein)diffusion model, text encoder, VAEKSampler, CFG
FLUX.2 (Klein, Dev)diffusion model, text encoder, VAEFlux2Scheduler, CFG guider
Krea 2diffusion model, text encoder, VAEKSampler
Ideogram 4diffusion model and unconditional model, text encoder, VAEAuraFlow shift, dual-model guider
MOSS Imagediffusion model, text encoder, small FLUX.2 VAEa layout prompt, skip layer guidance, KSampler
Ming Imagediffusion model, text encoder, its own VAEFLUX shift by size, guider without CFG
HiDream O1one checkpointnoise scale, patch seam smoothing, KSampler
Ernie Imagediffusion model, text encoder, VAEKSampler
FLUX.1 Fill inpaintingdiffusion model, two text encoders, VAEInpaint Model Conditioning, FLUX guidance
Qwen Image + InstantX inpaintingdiffusion model, text encoder, VAE, ControlNetControlNet Inpainting Apply
Checkpoint (SD, SDXL)one checkpointKSampler
Custom workflowwhatever yours loadsyours

Per model you can set steps, CFG, sampler, scheduler, shift, guidance, seed, a negative prompt, a speed LoRA (always applied, such as a Lightning 4-step LoRA) and the render size. The defaults are the values each model was tested at.

Each local model also keeps a list of LoRAs: a file from ComfyUI’s models/loras, a name of your choosing, a default strength and trigger words. In the AI Gen panel, under Advanced › LoRAs, add up to five of them to a picture, each at its own strength. The trigger words are added to the prompt, and the generated layer keeps its LoRAs, so Load from layer brings them back.

All-in-one Qwen Image Edit merges, one file holding the model, its text encoder and its VAE (such as Phr00t's Qwen Image Edit Rapid AIO), work too. Put the file in ComfyUI's models/checkpoints and press Scan Server: it is added as a Qwen Image Edit model at the settings these merges are made for, 4 steps, CFG 1, euler_ancestral / beta. Its All-in-one checkpoint row replaces the separate model, text encoder and VAE rows. Such a file in models/diffusion_models is recognised as well, and runs with the server's Qwen text encoder and VAE. Merges built on Edit 2511 are treated as 2511; a file named with 2509 as the older release.

A Qwen Image Edit model set up with Qwen Image 2.1's text encoder, VAE or model file is stopped before anything reaches ComfyUI, with which file is wrong and what to choose instead, rather than ComfyUI's cryptic tensor-shape error. Scan Server repairs such a model.

Regions: layout for models trained on boxes

Some models are trained on bounding boxes. For them, Create › Regions lets you draw boxes on the canvas, say what goes in each (an object, a character or exact words to render) and describe the whole scene; on Generate, LayerShop writes the layout in that model's own format. That is MOSS Image, Ideogram 4 and FLUX.3 Klein locally, and FLUX 3 Image in the cloud. FIBO 2 takes regions too but follows them only roughly, and the panel says so. A layer made with regions keeps its layout, and the copy button puts the exact layout the model receives on the clipboard.

Custom workflows

For anything the built-in graphs do not cover, such as prompt enhancers or custom nodes, use your own workflow. In ComfyUI choose Workflow › Export (API), add a model of the architecture Custom workflow in LayerShop, and paste the JSON. Put these placeholders where the values go:

PlaceholderBecomes
%prompt% %negative%The prompt, and the model's negative prompt
%width% %height%The render size worked out from your selection
%seed% %steps% %cfg%The model's settings
%denoise%The panel's Strength (1 for text to image)
%image% %mask%File names of the picture and the mask, uploaded to ComfyUI's input folder

A field that is exactly a numeric placeholder, such as "%width%", becomes a number. The workflow needs a Save Image or Preview Image node. To fill selections with it, give it two Load Image nodes whose image is %image% and %mask%; the mask file is transparent where to paint, so the second node's MASK output is the mask.

workflow_api.json (excerpt)
"10": { "class_type": "LoadImage", "inputs": { "image": "%image%" } },
"11": { "class_type": "LoadImage", "inputs": { "image": "%mask%" } },
"6":  { "class_type": "CLIPTextEncode", "inputs": { "text": "%prompt%", "clip": ["4", 1] } },
"3":  { "class_type": "KSampler",
        "inputs": { "seed": "%seed%", "steps": "%steps%", "cfg": "%cfg%",
                    "denoise": "%denoise%", /* … */ } }

Prompt enhancement

Enhance prompt (the sparkles beside the model in the AI Gen panel) has a text model rewrite your few words with the detail an image model needs: subject, setting, composition, light and colour. It keeps names, text in quotes and @mentions, and it knows the task: a new picture, an instruction to an edit model, a fill or a restyle. Shift-click puts back what you typed.

The Prompt Enhancement page with Local Models, Cloud Models and Settings tabs; the local models Gemma 4 E2B IT (fastest, 5.20 GB), Qwen3 4B (slowest, 5.63 GB) and Gemma 4 E4B IT (slower, more detail, 9.06 GB), all marked Installed
  • Local Models run on the same ComfyUI engine as your image models: nothing extra to install, nothing sent away, no key. Gemma 4 E2B (the default, fastest), Qwen3 4B, or Gemma 4 E4B (larger, more detail); each installs with one click, 5 to 9 GB. The engine loads only the one chosen and shares memory with image generation.
  • Cloud Models: OpenAI, xAI and Google Gemini use the keys you already have for their image models; OpenRouter and Anthropic take their own key. A key icon shows which have one.
  • Settings: prompt length, time limit, and the instructions the text model follows, which you can edit and restore.

The Style button beside Generate adds one of 24 looks (Anime, Watercolour, Cinematic, Pixel Art…) to the prompt when you generate, with any model. With a style chosen, Enhance describes only the content. The batch menu beside it makes 1 to 10 images from one prompt, each on its own layer with its own seed, rendered one after another so graphics memory isn't multiplied.

Generative Fill

Make a selection, press Shift+Backspace (Edit › Fill…) and choose AI Gen under Contents. Type what should go there, or leave the prompt empty to remove what is in the selection. The result is a new layer masked by the selection, and the model sees the whole picture around it, all layers as you see them, so the fill matches its surroundings.

The Generative Fill page: a list of the models that can fill, cloud models from OpenAI, xAI, Google Gemini, Black Forest Labs and Meta, and Qwen Image 2.1 selected and marked Recommended

Preferences › Generative AI › Generative Fill picks the model: only models that are switched on, can run now, and edit or inpaint are offered. If you haven't picked one, Qwen Image 2.1 fills. The page also sets Context (how much of the picture around the selection the model sees, 50% by default), Quality for local edit models, Strength for inpainting models, Method (Instruct or Inpaint) for models that do both, and the text sent with an empty prompt.

Cloud models

Cloud models are optional and sit in the same list. Each provider needs your own key, entered on the API Keys page. It has a card per provider that shows whether a key is saved, lists what uses it (For: its models, and Prompt Enhancement), links to the page where you make one (Get a key at) and says what the images are billed to.

The API Keys page: cards for OpenAI, Google Gemini, xAI and Meta, each showing Key saved, a field to paste a new key, a Remove box, the models it is for, a Get a key at link and how images are billed
ProviderModels offeredGet a key at
OpenAIGPT Image 2.6 and 2.5 (Sunburst and Flare), GPT Image 2; GPT Image 2.6 can also make animated GIFsplatform.openai.com
Google GeminiNano Banana 2, Nano Banana Pro, Nano Banana 2.1aistudio.google.com
xAIGrok Imagine Image 2.0console.x.ai
MetaMuse Imagedev.meta.ai
Black Forest LabsFLUX 3 Image, and older FLUX endpoints by iddashboard.bfl.ai
  • OpenAI bills images to your OpenAI API account, which needs credit: a ChatGPT subscription doesn't cover it. Google bills the key's Google Cloud project, so it needs billing set up. xAI and Black Forest Labs take them from credits you buy there. Meta needs you to sign up for the Meta Model API first.
  • Keys are stored in their own file, apart from the preferences, and a key is only ever sent to its own provider.
  • The Model ID is editable, so a newer model of the same API works without waiting for an update.
  • Where the provider reports or publishes prices, the panel shows an estimate before you generate and what the last image cost.
  • Animated GIFs: GPT Image 2.6 Sunburst and Flare can make a short loop. Tick Animate (GIF) under Advanced, pick 2 to 16 frames and the interval; the animation arrives as a video layer on the Timeline, with Play and Save GIF beside it. Local models make stills only.

Check a model's licence before using its images commercially. FIBO 2 is for non-commercial use only. MiniMax H3 Image is under MiniMax's community licence: companies with over US$1M a year and hosted services need MiniMax's written permission. Community merges have licences of their own.

Scripting and agents

Everything in LayerShop is a command with an id and JSON parameters, and the AI features are no exception. The panel runs the same commands that are exposed over MCP, so an agent can drive the running editor.

fill a selection from a script
select.rect  { "x": 860, "y": 400, "width": 460, "height": 470, "ellipse": true, "feather": 12 }
ai.generate  { "prompt": "a red deer stag standing in the tall grass",
               "mode": "inpaint", "model": "flux-3-klein" }
→ { "layer": 8, "mode": "inpaint", "renderSize": [1008, 992], "seed": 4242 }
CommandDoes
ai.generateCreate, fill (inpaint), restyle (img2img) or change by instruction (imgEdit), onto a new layer
ai.modelsThe models, what each can do and whether it can run now
ai.sourcesWhat a restyle or an edit can start from
ai.maskPaint the area to change instead of selecting it
ai.referencesThe reference pictures a document keeps (up to 15)
ai.regionsThe layout boxes drawn for models trained on them
ai.stylesThe style presets
ai.enhancePromptRewrite a prompt with the chosen text model
ai.comfyModelsThe model files a ComfyUI server has
ai.setup.modelFoldersThe models folders and what each holds
ai.server.statusThe local server's state

A generated layer carries its settings under generation, named the way ai.generate names its parameters, so they can be passed straight back. Two things agents cannot do: read API keys, and change how the local server is launched, since that names a program to run.

The demo pictures on this site were made exactly this way, by a script calling these commands. The source is on GitHub.