ComfyUI Node

Combine Texts

Merge Two Prompts Into One — and Let Claude Do the De-Duping

By tkreuziger·Created 2 years ago·Updated 3 months ago· 7
Combine Texts
    • combined_texts
    text_1
    text_1_prefix1
    text_2
    text_2_prefix2
    modelclaude-opus-4-6
    api_key
    system_prompt
    promptDescribe this image in detail.

    Combine Texts is the pack's version of the classic "merge two prompts" utility, except the merging is done by Claude instead of a string-concat node. You give it two texts, it hands both to the model with an instruction, and out comes one combined_texts string - de-duplicated, coherent, and with whatever redundancy you had in the inputs quietly removed. If that last part is what you want, this is the node you'd reach for over a plain text-concatenation node.

    The realistic use case is joining a character description with a style or scene block, or merging a LoRA trigger phrase into a base prompt without ending up with a run-on paragraph that repeats itself. For LLM-encoded checkpoints that read prompts as instructions, a clean merged sentence genuinely beats two pasted fragments.

    How it works

    The node assembles {prompt}\n{text_1_prefix} {text_1}\n{text_2_prefix} {text_2} and sends it to Anthropic's messages API with a fixed 1024-token budget. That's the whole mechanism. Those two prefix fields are the only thing separating this from Transform Text: they're just labels so Claude can tell your two inputs apart. They default to 1 and 2, and nobody's stopping you from renaming them character and style to steer the model's reading of what each block is.

    Inputs and outputs that matter

    • text_1 and text_2 - the two strings to combine. Both multiline.
    • text_1_prefix / text_2_prefix - the labels described above. Defaults 1 and 2.
    • model - nine Claude aliases, default claude-opus-4-6. This is simple text work; claude-haiku-4-5 handles it fine and won't cost you opus money.
    • api_key - your Anthropic key, typed in, baked into the workflow JSON. Scrub before sharing.
    • prompt - the instruction to Claude. Optional, and here's the catch: it defaults to "Describe this image in detail.", copied from the pack's image node. The author even wrote a proper default ("Combine the following two texts into one coherent prompt without redundancies") and never wired it in. So unless you type your own prompt, you'll get Claude describing two texts like they're photographs. Set it, every time.
    • system_prompt - optional, your "act as" box.

    The combined_texts output is a plain STRING that wires into any string input - a CLIP Text Encode, a text display node, or back through Transform Text for another pass.

    How to install

    Same pack as the rest, one install covers all three nodes. ComfyUI Manager: search "ComfyUI Claude". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tkreuziger/comfyui-claude.git
    pip install -r comfyui-claude/requirements.txt
    

    Restart, done. Dependencies are light (anthropic, pillow, comfyui-types) and there's nothing to download - the heavy lifting is an API call, not a model file.

    Common issues

    • Empty output. Errors are swallowed and logged to the ComfyUI console while the node returns ''. Empty string back = read the console for the auth or rate-limit error.
    • The default prompt. It's the image-description text. If your "combined" result reads like alt-text, you forgot to set it.
    • It's an API call, not a utility. It costs money per run, and your text goes to Anthropic's servers. For zero-cost joining, a plain text-concatenation node is still the right tool - this one earns its keep on the de-duplication and rewriting, not on the joining itself.

    Honestly, this is the thinnest node in the pack: a labeled wrapper around one prompt. If you've used Transform Text, you've basically used this. Its one trick is the prefix labels letting Claude treat your two inputs as distinct things, and that trick is only as good as the prompt you remember to type.

    CategoryClaude

    Inputs (8)

    NameTypeDefaultDescription
    text_1STRING
    text_1_prefixSTRING1
    text_2STRING
    text_2_prefixSTRING2
    modelCOMBOclaude-opus-4-69 options: claude-opus-4-6, claude-sonnet-4-5, claude-opus-4-5, claude-opus-4-1, claude-sonnet-4-0, claude-opus-4-0, +3
    api_keySTRING
    system_promptoptSTRING
    promptoptSTRINGDescribe this image in detail.

    Outputs (1)

    NameTypeDescription
    combined_textsSTRING