⚗ Alchemica Prompt (idea / list / Ollama + NAG + latent)
Write, keep, list or generate the prompt — then encode it
- model
- clip
- vae
- latent
- image
- pass_1
- pass_2
- pass_3
- pass_4
- pass_5
- pass_6
- pass_7
- pass_8
- model
- positive
- latent
- negative
- vae
- clip
- prompt
- pass_1
- pass_2
- pass_3
- pass_4
- pass_5
- pass_6
- pass_7
- pass_8
Six ways to arrive at a prompt, one node to encode it, and a NAG block bolted on the model on the way out. This is the node the pack's own starter workflow reaches for.
What it is
AlchemicaPromptStudio is the prompt workstation in ComfyUI-AlchemicaSampler, sitting in the line between the LoRA stack and the sampler. Its socket order deliberately mirrors its neighbours - same order as the LoRA stack on the left, same order as the sampler on the right - so it drops into the pack's five-node chain without crossing wires.
Six mode settings, and they're the whole personality of the node:
generate from idea- an LLM writes scene, detail and negative from a few words, any language.improve prompt- the LLM rewrites your prompt, keeping what's in it.as written- no LLM at all. Yours is encoded as typed.from list- one prompt per line intext, picked byline(entries can also be separated by a---line). Setline's control to increment and each queue walks the list - which is exactly how the pack suggests you calibrate: sixteen plus different prompts, accumulating into one profile.from string- takes text arriving ontext_in, for chaining.example- sixteen built-in ideas, for testing without inventing anything.
For the last three, text_as says what to do with the picked text: treat it as an idea, improve it, or use it as written.
Wildcards work everywhere in text: {a|b|c} picks one option, and __name__ pulls a line from wildcards/name.txt in the pack (there's a hair_colour.txt shipped as an example - add your own files next to it). seed picks the wildcard options and the LLM variation when creativity is above 0.
Who writes it
use_ollama off means Krea 2's own text encoder does the writing - no server, no key, and it can see a connected image. On means an Ollama model does it, which needs ollama serve running; ollama_model lists what you have installed (press R to refresh), and for images you need a vision model - qwen2.5vl, llava, gemma3 and friends. unload_ollama frees the Ollama model from VRAM the moment it's done writing, and on a 16 GB card leave it on: you don't want a chat model squatting on the memory Krea 2 needs. ollama_url is there if your server lives somewhere other than 127.0.0.1:11434.
show_llm_options only shows or hides the group - hidden values still apply. In there: words (scene length), creativity (0 = same text every run), skin (smooth strips body-hair language and pushes it into the negative), instructions (extra rules in any language, they win over the built-in ones) and max_tokens.
Two facts about the writing that will save you confusion. Answers are cached in memory against the rules, text, image and creativity/seed, so changing the NAG values or the resolution never makes the LLM write again. And with an LLM mode, anything in negative is added to the negative it wrote - "glasses, tattoos" is how you use that field; in as written mode it's the negative, full stop.
NAG, and the start latent
attention_guidance is a plain switch: off and the model passes through unchanged. On, and the nag_* group applies your negative in attention space, because at CFG 1 (which is how guidance-distilled Krea 2 Turbo runs) a negative prompt is inert - no unconditional pass, nothing for it to steer. Defaults are nag_scale 3, nag_tau 2.5, nag_alpha 0.25, nag_blocks all, and nag_sigma_start at −1, which starts NAG at the calibration profile's hand-off sigma (~0.87): below that the composition is already locked, so you remove the unwanted thing without changing the picture. structure adds PAG (sharper, more contrast) or SEG (blurred queries - halos above 0.3) with its own scale, block list and sigma window.
show_resolution reveals aspect (ten ratios), megapixels (1.5 default; 3–4 with two stages) and batch_size, which build the start latent here - unless you feed something into latent, because a latent on that socket wins. That's your img2img door: a VAE-encoded photo goes in, and the latent you'd have built is skipped.
Inputs, outputs, and the pass-throughs
In: model, clip (required), optionally vae, latent, text_in, image, and pass_1–pass_8. Out: model (NAG applied - the one the sampler wants), positive, latent, negative, vae, clip, prompt (the final positive text, handy for captions) and pass_1–pass_8, which pass anything through unchanged and appear one at a time as you connect them.
Installing it
ComfyUI Manager, search "AlchemicaSampler", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Nessuno76/ComfyUI-AlchemicaSampler
# restart the server
ComfyUI 0.36.0+ - the writing path uses CLIP.generate. No extra Python packages for the Krea 2 writer; Ollama is optional and external.
Where it goes wrong
- Ollama model list is empty. Start Ollama, then press R in the node to refresh the list. The placeholder text says exactly this.
- The model didn't write anything new. The cache. Change the text, the instructions or the creativity/seed.
- Conditioning-size error downstream. The
clipwasn't loaded askrea2. from listkeeps returning the same line.lineis still a fixed number: set its control to increment.- Out of VRAM on 16 GB with Ollama. Turn on
unload_ollama.
Inputs (50)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | From the LoRA stack (or the loader). Leaves with NAG / structure applied | |
| clip | CLIP | Krea 2 text encoder: always encodes the prompt, and writes it when Ollama is off | |
| mode | COMBO | generate from idea | generate from idea: the LLM writes scene / detail / negative from a few words (any language). improve prompt: the LLM rewrites YOUR prompt, keeping everything in it. as written: your text is used as it is (no LLM). from list: one prompt per line, picked by 'line' (set its control to increment to walk the list). from string: the text arriving on the 'text_in' socket (from another node). example: a built-in example, to start or to test. With list / string / example, 'text_as' says what to do with the picked text. |
| text | STRING | Idea / prompt / list (one per line, or entries separated by a '---' line). {a|b|c} picks one option, __name__ picks a line of wildcards/name.txt | |
| detail | STRING | As written only: rendering of surfaces, skin, fabric, optics. Empty = scene only | |
| negative | STRING | As written: the negative for the NAG. With the LLM: extra items added to the one it writes (e.g. 'glasses, tattoos') | |
| text_as | COMBO | idea → generate | What to do with the text from list / string / example |
| line | INT | 00–99999 | From list: entry number (0 = first; wraps around). 'increment' = next entry at every run |
| example | COMBO | Example mode: the idea used | |
| seed | INT | 00–18446744073709550000 | Picks the wildcard options, and the LLM variation when creativity > 0 |
| style | COMBO | realistic photo | 8 options: realistic photo, portrait, still life / lab, landscape, architecture, cinematic, +2 |
| use_ollama | BOOLEAN | false | Who writes the prompt. Off = Krea 2's own text encoder (no server, sees images). On = a model served by Ollama (needs 'ollama serve') |
| ollama_model | COMBO | (no Ollama model found: start Ollama, then press R) | Installed Ollama models (press R to refresh). For images use a vision model (qwen2.5vl, llava, gemma3...) |
| ollama_url | STRING | http://127.0.0.1:11434 | — |
| unload_ollama | BOOLEAN | true | Frees the Ollama model from VRAM right after writing, so Krea 2 keeps its memory (recommended on 16 GB) |
| show_llm_options | BOOLEAN | false | Shows length, creativity, skin, instructions. Hidden values still apply |
| words | INT | 8030–200 | Length of the SCENE (the detail is 30-50% of it) |
| creativity | FLOAT | 0.000–1.5 | 0 = same text every time. 0.6-0.9 = variations (change the seed) |
| skin | COMBO | smooth (no body hair) | smooth = no body hair (removed from the prompt, added to the NAG negative) |
| instructions | STRING | Extra rules in any language; they win over the built-in ones | |
| max_tokens | INT | 400100–2000 | Upper limit of the answer |
| attention_guidance | BOOLEAN | true | NAG: the negative works at cfg 1. Off = model passes unchanged |
| nag_scale | FLOAT | 3.00–20 | Strength of the negative at cfg 1. Calibrated: 3 |
| nag_tau | FLOAT | 2.51–10 | How far it may push away from the positive |
| nag_alpha | FLOAT | 0.250–1 | Blend with the original attention |
| nag_blocks | STRING | all | DiT blocks (0-27): 'all', '0-13', '5,8,10-12' |
| nag_sigma_start | FLOAT | -1.00-1–1 | -1 = from the profile hand-off (~0.87): removes the negative WITHOUT changing the composition. 1 = from the start |
| nag_sigma_end | FLOAT | 0.000–1 | — |
| structure | COMBO | off | PAG = sharper and more contrast. SEG = blurred queries (halos above 0.3) |
| structure_scale | FLOAT | 0.00-5–10 | — |
| structure_blocks | STRING | 8-19 | — |
| seg_blur | FLOAT | 10.00.5–1000 | — |
| structure_sigma_start | FLOAT | -1.00-1–1 | -1 = from the profile |
| structure_sigma_end | FLOAT | 0.000–1 | — |
| show_resolution | BOOLEAN | false | Shows the size of the start latent. A latent on the 'latent' socket wins |
| aspect | COMBO | 2:3 | 10 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4 |
| megapixels | FLOAT | 1.500.25–8 | FINAL resolution. 1.5 MP fast, 3-4 MP with two stages |
| batch_size | INT | 11–16 | — |
| vaeopt | VAE | Passes through to the sampler (preview and final image in the node) | |
| latentopt | LATENT | Optional: e.g. a VAE-encoded photo for img2img. Empty = built here | |
| text_inopt | STRING | Text from another node (mode: from string) | |
| imageopt | IMAGE | Visual reference for the LLM (Krea 2's encoder, or an Ollama vision model) | |
| pass_1opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_2opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_3opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_4opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_5opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_6opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_7opt | * | Pass-through: anything that enters here leaves on the same pass | |
| pass_8opt | * | Pass-through: anything that enters here leaves on the same pass |
Outputs (15)
| Name | Type | Description |
|---|---|---|
| model | MODEL | NAG / structure applied: to the sampler |
| positive | CONDITIONING | Scene + detail: to the sampler's positive |
| latent | LATENT | Start latent: to the sampler's latent_image |
| negative | CONDITIONING | To the sampler's negative (used only at cfg > 1) |
| vae | VAE | The VAE that came in |
| clip | CLIP | The text encoder that came in |
| prompt | STRING | Final positive text (for Save Image, captions...) |
| pass_1 | * | Same as the matching pass input |
| pass_2 | * | Same as the matching pass input |
| pass_3 | * | Same as the matching pass input |
| pass_4 | * | Same as the matching pass input |
| pass_5 | * | Same as the matching pass input |
| pass_6 | * | Same as the matching pass input |
| pass_7 | * | Same as the matching pass input |
| pass_8 | * | Same as the matching pass input |