Nodes/AI4ArtsEd Nodes/AI4ArtsEd Prompt Interception
ComfyUI Node

AI4ArtsEd Prompt Interception

The node that rewrites your prompt through any lens you give it

By joeriben·Created about a year ago·Updated 7 months ago· 1
AI4ArtsEd Prompt Interception
    • output_str
    • output_float
    • output_int
    • output_binary
    input_prompt
    input_context
    style_prompt
    api_key
    model
    debugdisable
    unload_modelno

    AI4ArtsEd Prompt Interception is the pack's core LLM transformation node: you give it a prompt, some context, and a style instruction, and a hosted or local LLM rewrites the prompt according to that instruction. Everything else in this pack - the random generators, the language selector, the artform sampler - exists to feed this node. It's the "interception" point where your plain text becomes a stylistically transformed image description.

    The mechanism is straightforward. The node builds a single prompt out of three fields:

    • input_prompt - the text to transform.
    • input_context - background or subject material the rewrite should incorporate.
    • style_prompt - the instruction ("write this as a Yoruba praise poem", "translate this into German", "make it a surrealist manifesto"). This is where the pack's random generator outputs are meant to land.

    The combined task is sent to the selected model, and the returned text comes back as output_str. The other three outputs - output_float, output_int, output_binary - are just output_str run through regex parsers that grab the first number (with German decimal handling built in, a nice touch) and look for "true"/"1". Handy if you prompt the model to answer a question numerically; noise otherwise.

    The model dropdown

    Same hybrid list as the rest of the pack: roughly 30 OpenRouter models annotated with pricing and a capability tag (openrouter/deepseek/deepseek-r1-0528 [reasoning / $0.50/$2.15]), plus anything you have in local Ollama, auto-detected at UI build time. There's fallback logic if a hosted call fails - same provider first, then a small general model - and unload_model lets you kick the Ollama model out of memory after the call. If the rewrite is meant for an image model, keep the style prompt explicit about the output format; the pack's own transformation templates tell the model to emit pure image-description text and cap it around 50-55 words so it fits a token budget. You'll want the same discipline in your own style prompts, or you'll get essays instead of prompts.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/joeriben/ai4artsed_comfyui_nodes
    # restart ComfyUI
    

    Or search "AI4ArtsEd" in ComfyUI Manager. Hosted models need an OpenRouter key (per-node or in openrouter.key); local models need the Ollama server on port 11434.

    Common issues

    Output doesn't change between runs. This node has no seed and no IS_CHANGED flag, so ComfyUI only re-runs it when an input changes. If you queue the same graph twice with identical inputs, you get the identical cached answer. To force variety, feed the style prompt from one of the seeded randomizers or change an input - this is the pack's most common "it's stuck" gotcha.

    api_key is required in the UI. It's a required field with no default, but you can leave it empty if the openrouter.key file exists - the node falls back to the file. The "required" marking just means you must touch the field when building the graph.

    German decimal gotcha. The float parser handles 1.234,56 format, but if your model answers in words ("about half"), you'll get 0.0. Prompt for numbers if you want the numeric outputs to be meaningful.

    It costs money on hosted models. Prices are printed in the dropdown for a reason. For high-volume experiments, point it at a local Ollama model.

    It's the one node in this pack you'll probably keep even if you drop the rest - a well-prompted LLM doing prompt transformation on the fly is a genuinely useful workflow step, and this is a clean, dependency-light implementation of it.

    CategoryAI4ArtsEd

    Inputs (7)

    NameTypeDefaultDescription
    input_promptSTRING
    input_contextSTRING
    style_promptSTRING
    api_keySTRING
    modelCOMBO30 options: openrouter/anthropic/claude-3.5-haiku [multilingual / $0.80/$4.00], openrouter/anthropic/claude-3-haiku [multilingual / $0.80/$4.00], openrouter/anthropic/claude-haiku-4.5 [multilingual / $0.80/$4.00], openrouter/anthropic/claude-sonnet-4.5 [multilingual / $3.00/$15.00], openrouter/deepseek/deepseek-chat-v3-0324 [rule-oriented / $0.27/$1.10], openrouter/deepseek/deepseek-r1-0528 [reasoning / $0.50/$2.15], +24
    debugCOMBOdisable2 options: enable, disable
    unload_modelCOMBOno2 options: no, yes

    Outputs (4)

    NameTypeDescription
    output_strSTRING
    output_floatFLOAT
    output_intINT
    output_binaryBOOLEAN