Nodes/ComfyUI-LongCatPlugin/Text Encode LongCat Image
ComfyUI Node

Text Encode LongCat Image

Why LongCat understands 'the tallest animal' — prompt rewrite on your GPU, no API key

By ARM64-EC·Created 9 months ago·Updated 9 months ago· 0
Text Encode LongCat Image
  • clip
  • conditioning
prompt
rewrite_prompttrue

LongCat doesn't interpret your prompt the way SD does. It doesn't stuff tokens into a frozen CLIP and hope. Instead, the text encoder is a Qwen2.5-VL–based LLM, and TextEncodeLongCatImage runs your prompt through it twice in spirit: once to rewrite it, once to encode it. That rewrite pass is the reason a prompt like "an animal with nine lives" comes back as a detailed cat bathed in soft window light instead of a confused blob. It's LongCat's signature feature, and this node is where you control it.

The flow: the rewrite_prompt toggle defaults to true, which sends your text through a chat-templated rewrite - the model gets a system prompt demanding it preserve all your details, infer vague intent, default to realistic photography, and enclose any in-image text in quotes. It's a full LLM text-generation pass on every encode, and it runs locally on your GPU through the loaded text encoder. No API key, no hidden service call. If you're the kind of person who twitches at the words "prompt rewriting," the off switch is right there.

Inputs:

  • clip - the CLIP output from LongCatCLIPLoader. This node won't work with any other CLIP; it needs the LongCat wrapper.
  • prompt - multiline text. Keep it under the 512-token budget the encoder enforces; after a rewrite, that budget is shared with the rewrite output.
  • rewrite_prompt - on by default. Off gives you a faster, more literal encode; on gives you LongCat's full prompt-adherence magic. For reproducibility across runs, you might prefer it off and hand the model a fully-spelled-out prompt yourself.

Output is a single conditioning, and it is not standard. It carries prompt_embeds plus text_ids (the positional ids LongCat's packed-latent attention expects). Wire it into LongCatSampler's positive socket, and build a negative with the same node using whatever negative guidance you like - LongCat benefits from one, though flow models don't need the wall-of-text negatives people wrote for SD.

The one real caveat: this conditioning is LongCat-shaped, so a stock KSampler will reject it. Everything in this pack is meant to flow through LongCatSampler. And the usual early-port warning applies - this plugin is a young, one-commit implementation, so treat the whole graph as experimental, but the encode node itself is the most battle-tested piece of it.

CategoryLongCat

Inputs (3)

NameTypeDefaultDescription
clipCLIP
promptSTRING
rewrite_promptBOOLEANtrue

Outputs (1)

NameTypeDescription
conditioningCONDITIONING