ComfyUI Node

P-H3 Prompt Writer

Writes Text2Image and Image2Image prompts with Pruna's P-H3 upsampler. Text2Image can describe the first active reference with use_ref_description; only text reaches the image generator. Load p-h3-image_prompt_upsampler with Load CLIP, type minimax. The first enabled picture is the image to edit; the others are references. VIDEO, IMAGE batches and visual RefMods support exact frame selection. RefMods are expanded to pictures and re-encoded by P-H3, not passed as video latents. Wire references through MiniMax-H3 Reference Slots to p-h3-image Conditioning, and connect width and height to keep its canvas in step with this writer.

By pytraveler·Created 3 months ago·Updated 4 days ago· 434
P-H3 Prompt Writer
  • upsampler
  • references
  • refmod_vae
  • aspect_ratio
  • prompt
  • thinking
  • summary
  • width
  • height
  • references
◄taskText2Image►
◄prompt►
◄keep►
◄resolution1:1►
◄megapixels8►
◄match_image_ratiotrue►
◄refmod_images3►
◄max_length2048►
◄thinkingtrue►
◄bypassfalse►
◄repeat_lastfalse►
◄library_pick►
◄reference_layout►
◄reference_instructions►
◄video_images3►
◄frame_selection►
◄use_ref_descriptionfalse►
CategoryMiniMax-H3

Inputs (21)

NameTypeDefaultDescription
upsamplerCLIPLoad the P-H3 prompt upsampler, not its 4B text encoder; Load CLIP type minimax.
taskCOMBOText2ImageText2Image uses text only; use_ref_description can describe the first active reference for its prompt. Image2Image uses the first enabled picture as the base.
promptSTRINGWhat to create or change. Name references as <Picture 1>, <Picture 2>, etc.
keepSTRINGFor edits: faces, poses, objects, composition or lighting that must stay unchanged.
resolutionCOMBO1:17 options: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, +1
megapixelsCOMBO82 options: 4, 8
match_image_ratioBOOLEANtrueImage2Image uses the first picture's aspect ratio unless aspect_ratio is supplied. Otherwise use resolution.
refmod_imagesINT31–8Automatic pictures per visual RefMod, evenly selected. The frames picker overrides this per socket. The total, including ordinary images, must fit within eight.
max_lengthINT2048256–32768Token budget per model call, including thinking. With use_ref_description it applies separately to the description and final prompt. Increase if it produces no final text.
thinkingBOOLEANtrue—
bypassBOOLEANfalsePass prompt through as written; references and canvas are still prepared.
repeat_lastBOOLEANfalseReuse the last prompt or the library choice. The current references and canvas still pass through.
library_pickSTRINGWhich saved prompt this node hands on instead of writing one, as JSON written by the library window. It is a widget so the choice is saved with the workflow and reaches an API run: a pick the graph does not carry is a graph that reproduces something else. It applies only while 'repeat_last' is on. That switch is what hands a kept prompt on at all; this says which one, and empty means the node's own last answer.
reference_layoutSTRINGReference strip order and disabled sockets, saved as JSON.
reference_instructionsSTRINGInstructions per input socket, saved as JSON. Applied to each picture expanded from that socket.
referencesoptCOMFY_AUTOGROW_V3—
refmod_vaeoptVAEThe original MiniMax-H3 video VAE, only for RefMods without stored or decoded pictures.
video_imagesoptINT31–8Automatic frame count for VIDEO and IMAGE batches larger than eight. Smaller IMAGE batches keep all frames. The frames picker overrides this per socket.
frame_selectionoptSTRINGSelected zero-based frame indices per socket, saved as JSON by the frames picker. Missing sockets use automatic selection.
aspect_ratiooptSTRING,COMBOOptional, and it overrides the picker while something is connected. Reads a ratio ('16:9'), a frame size ('3840x1080') or a bare number ('1.78'), and a label around the pair is fine -- '3:4 (Portrait Standard)' reads as 3:4. A size within 2% of a listed ratio is called by its name, so 1376x768 arrives as 16:9 rather than as 43:24. Also overrides match_image_ratio in Image2Image.
use_ref_descriptionoptBOOLEANfalseText2Image only: describe the first active reference's first selected frame, then write a standalone prompt from that description and the user request. Both steps use this upsampler. The user request takes priority; role says what to take from the picture. No reference images reach the image generator. Bypass passes the original prompt through.

Outputs (6)

NameTypeDescription
promptSTRING—
thinkingSTRING—
summarySTRING—
widthINT—
heightINT—
referencesH3_REWRITER_REFERENCESImage2Image: expanded pictures in prompt order. Reference Slots picture_1 goes to P-H3 Conditioning image_1, and so on. Text2Image returns an empty bundle, including with use_ref_description.