Nodes/⚗ AlchemicaSampler/⚗ Alchemica Prompt (idea / list / Ollama + NAG + latent)
ComfyUI Node

⚗ Alchemica Prompt (idea / list / Ollama + NAG + latent)

Write, keep, list or generate the prompt — then encode it

By Nessuno76·Created about a month ago·Updated 21 days ago· 4
⚗ Alchemica Prompt (idea / list / Ollama + NAG + latent)
  • 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
◄modegenerate from idea►
◄text►
◄detail►
◄negative►
◄text_asidea → generate►
◄line0►
◄example▾►
◄seed0►
◄stylerealistic photo►
◄use_ollamafalse►
◄ollama_model(no Ollama model found: start Ollama, then press R)►
◄ollama_urlhttp://127.0.0.1:11434►
◄unload_ollamatrue►
◄show_llm_optionsfalse►
◄words80►
◄creativity0.00►
◄skinsmooth (no body hair)►
◄instructions►
◄max_tokens400►
◄attention_guidancetrue►
◄nag_scale3.0►
◄nag_tau2.5►
◄nag_alpha0.25►
◄nag_blocksall►
◄nag_sigma_start-1.00►
◄nag_sigma_end0.00►
◄structureoff►
◄structure_scale0.00►
◄structure_blocks8-19►
◄seg_blur10.0►
◄structure_sigma_start-1.00►
◄structure_sigma_end0.00►
◄show_resolutionfalse►
◄aspect2:3►
◄megapixels1.50►
◄batch_size1►
◄text_in—►

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 in text, picked by line (entries can also be separated by a --- line). Set line'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 on text_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 clip wasn't loaded as krea2.
  • from list keeps returning the same line. line is still a fixed number: set its control to increment.
  • Out of VRAM on 16 GB with Ollama. Turn on unload_ollama.
Category⚗ AlchemicaMente/conditioning

Inputs (50)

NameTypeDefaultDescription
modelMODELFrom the LoRA stack (or the loader). Leaves with NAG / structure applied
clipCLIPKrea 2 text encoder: always encodes the prompt, and writes it when Ollama is off
modeCOMBOgenerate from ideagenerate 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.
textSTRINGIdea / 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
detailSTRINGAs written only: rendering of surfaces, skin, fabric, optics. Empty = scene only
negativeSTRINGAs written: the negative for the NAG. With the LLM: extra items added to the one it writes (e.g. 'glasses, tattoos')
text_asCOMBOidea → generateWhat to do with the text from list / string / example
lineINT00–99999From list: entry number (0 = first; wraps around). 'increment' = next entry at every run
exampleCOMBOExample mode: the idea used
seedINT00–18446744073709550000Picks the wildcard options, and the LLM variation when creativity > 0
styleCOMBOrealistic photo8 options: realistic photo, portrait, still life / lab, landscape, architecture, cinematic, +2
use_ollamaBOOLEANfalseWho writes the prompt. Off = Krea 2's own text encoder (no server, sees images). On = a model served by Ollama (needs 'ollama serve')
ollama_modelCOMBO(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_urlSTRINGhttp://127.0.0.1:11434—
unload_ollamaBOOLEANtrueFrees the Ollama model from VRAM right after writing, so Krea 2 keeps its memory (recommended on 16 GB)
show_llm_optionsBOOLEANfalseShows length, creativity, skin, instructions. Hidden values still apply
wordsINT8030–200Length of the SCENE (the detail is 30-50% of it)
creativityFLOAT0.000–1.50 = same text every time. 0.6-0.9 = variations (change the seed)
skinCOMBOsmooth (no body hair)smooth = no body hair (removed from the prompt, added to the NAG negative)
instructionsSTRINGExtra rules in any language; they win over the built-in ones
max_tokensINT400100–2000Upper limit of the answer
attention_guidanceBOOLEANtrueNAG: the negative works at cfg 1. Off = model passes unchanged
nag_scaleFLOAT3.00–20Strength of the negative at cfg 1. Calibrated: 3
nag_tauFLOAT2.51–10How far it may push away from the positive
nag_alphaFLOAT0.250–1Blend with the original attention
nag_blocksSTRINGallDiT blocks (0-27): 'all', '0-13', '5,8,10-12'
nag_sigma_startFLOAT-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_endFLOAT0.000–1—
structureCOMBOoffPAG = sharper and more contrast. SEG = blurred queries (halos above 0.3)
structure_scaleFLOAT0.00-5–10—
structure_blocksSTRING8-19—
seg_blurFLOAT10.00.5–1000—
structure_sigma_startFLOAT-1.00-1–1-1 = from the profile
structure_sigma_endFLOAT0.000–1—
show_resolutionBOOLEANfalseShows the size of the start latent. A latent on the 'latent' socket wins
aspectCOMBO2:310 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4
megapixelsFLOAT1.500.25–8FINAL resolution. 1.5 MP fast, 3-4 MP with two stages
batch_sizeINT11–16—
vaeoptVAEPasses through to the sampler (preview and final image in the node)
latentoptLATENTOptional: e.g. a VAE-encoded photo for img2img. Empty = built here
text_inoptSTRINGText from another node (mode: from string)
imageoptIMAGEVisual 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)

NameTypeDescription
modelMODELNAG / structure applied: to the sampler
positiveCONDITIONINGScene + detail: to the sampler's positive
latentLATENTStart latent: to the sampler's latent_image
negativeCONDITIONINGTo the sampler's negative (used only at cfg > 1)
vaeVAEThe VAE that came in
clipCLIPThe text encoder that came in
promptSTRINGFinal 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