Nodes/SDXL Auto Prompter/APNext Gemini Prompt Enhancer
ComfyUI Node

APNext Gemini Prompt Enhancer

Cinematic term injection plus an optional Gemini rewrite

By dagthomas·Created 3 years ago·Updated 17 days ago· 285
APNext Gemini Prompt Enhancer
    • enhanced_prompt
    • random_enhanced
    • llm_enhanced
    base_promptA knight fighting a dragon
    enhancement_modeRandom Mix (4-6 elements)
    use_llmtrue
    gemini_modelgemini-flash-latest
    seed0
    custom_llm_prompt
    intensity1.0
    visual_stylerandom
    lighting_typerandom
    light_sourcerandom
    camera_anglerandom
    shot_sizerandom
    lens_typerandom
    color_tonerandom
    camera_movementrandom
    time_of_dayrandom
    visual_effectsrandom
    compositionrandom
    motionrandom
    character_emotionrandom
    apnext_chain

    This is the hybrid of the whole pack, and it's cleverer than it first looks. Give it a base prompt and it does two things: it injects cinematic terminology from a big set of dropdowns (lighting, camera angle, shot size, lens, color tone, and a dozen more), and it can run the result through Gemini for a polished rewrite. Then it hands you both versions plus the combination, so you can A/B them and keep whichever reads best. If you want the concrete-photographic-language boost the KB says actually works, delivered semi-automatically, this is the node.

    The best part: the random-injection half needs no API key. Leave the LLM toggle off and it's a pure, offline cinematic-term enhancer - free, instant, works anywhere. Flip the toggle on and Gemini smooths the injected terms into natural language. That optionality is unusual and genuinely useful; most "enhancer" nodes force the API call.

    How it works

    The node takes base_prompt and, according to enhancement_mode, pulls elements from its cinematic dropdowns - each defaults to random, so it rolls a coherent set of camera/lighting/style terms and appends them. intensity scales how much it adds. If use_llm is on, it then sends that enriched prompt to Gemini for a rewrite. You can pipe in a builder node's output through apnext_chain to combine this with the rest of the pack. Because those cinematic terms are concrete physical referents, they're the kind of prompt content that transfers across encoders - they help on SDXL and on the LLM-encoded 2026 models where quality-word spam does nothing.

    The inputs and outputs that matter

    • base_prompt - your starting idea.
    • enhancement_mode - how it enriches: Random Mix (4-6 elements), focused modes (Cinematic/Lighting/Camera/Motion/Style), Full Enhancement, or LLM Only.
    • use_llm - the key switch. Off = free offline random injection; on = Gemini rewrite (needs a key).
    • intensity (0.1–2.0) - how heavy the enhancement.
    • The optional dropdowns - lighting_type, camera_angle, shot_size, lens_type, color_tone, visual_effects, composition and more - pin a specific choice or leave on random.

    Three outputs: enhanced_prompt (the final combined result), random_enhanced (just the term-injected version, no LLM), and llm_enhanced (just Gemini's rewrite). Wire whichever wins into your CLIP Text Encode.

    How to install it

    ComfyUI Manager: search comfyui_dagthomas, install, restart. Manual:

    cd ComfyUI/custom_nodes && git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas && pip install -r requirements.txt
    

    then restart. The offline path needs nothing but the install. For use_llm, set GEMINI_API_KEY in the environment before launching ComfyUI.

    Where people get burned

    • use_llm on without a key. Turning on the LLM rewrite with no GEMINI_API_KEY set is the usual error. Either set the key before launch, or leave use_llm off and use the free random_enhanced output.
    • Three outputs, pick one. People wire enhanced_prompt and wonder why random_enhanced looks different - they're supposed to. Compare all three, keep the best; don't feed all three into one encoder.
    • Cranking intensity. Max intensity buries your subject under camera and lighting jargon. Keep it moderate so the base idea still leads.
    • random everywhere = a slot machine. Every dropdown on random gives huge variety and low control. Pin the choices that matter (shot size, lighting) and randomize the rest.
    • Overlong output on LLM mode. Gemini can pad; the attention cap still applies. Trim before it hits the encoder.
    Categorycomfyui_dagthomas

    Inputs (21)

    NameTypeDefaultDescription
    base_promptSTRINGA knight fighting a dragon
    enhancement_modeCOMBORandom Mix (4-6 elements)8 options: Random Mix (4-6 elements), Cinematic Focus, Lighting Focus, Camera Focus, Motion Focus, Style Focus, +2
    use_llmBOOLEANtrue
    gemini_modelCOMBOgemini-flash-latest5 options: gemini-2.5-pro, gemini-flash-latest, gemini-2.5-flash, gemini-flash-lite-latest, gemini-2.5-flash-lite
    seedINT00–999999
    custom_llm_promptoptSTRING
    intensityoptFLOAT1.00.1–2
    visual_styleoptCOMBOrandom19 options: none, random, cinematic, dramatic, moody, atmospheric, +13
    lighting_typeoptCOMBOrandom16 options: none, random, soft lighting, hard lighting, dramatic lighting, natural lighting, +10
    light_sourceoptCOMBOrandom14 options: none, random, sunlight, moonlight, candlelight, firelight, +8
    camera_angleoptCOMBOrandom11 options: none, random, low angle, high angle, eye level, bird's eye view, +5
    shot_sizeoptCOMBOrandom10 options: none, random, extreme wide shot, wide shot, medium wide shot, medium shot, +4
    lens_typeoptCOMBOrandom10 options: none, random, wide-angle lens, telephoto lens, macro lens, fisheye lens, +4
    color_toneoptCOMBOrandom12 options: none, random, warm tones, cool tones, desaturated, vibrant, +6
    camera_movementoptCOMBOrandom12 options: none, random, static shot, pan left, pan right, tilt up, +6
    time_of_dayoptCOMBOrandom13 options: none, random, sunrise, morning, midday, afternoon, +7
    visual_effectsoptCOMBOrandom12 options: none, random, depth of field, bokeh, lens flare, motion blur, +6
    compositionoptCOMBOrandom10 options: none, random, rule of thirds, centered composition, symmetrical, asymmetrical, +4
    motionoptCOMBOrandom12 options: none, random, static pose, walking, running, jumping, +6
    character_emotionoptCOMBOrandom13 options: none, random, confident, mysterious, contemplative, joyful, +7
    apnext_chainoptSTRING

    Outputs (3)

    NameTypeDescription
    enhanced_promptSTRING
    random_enhancedSTRING
    llm_enhancedSTRING