Nodes/Shinsplat/Clip Text Encode SDXL (Shinsplat)
ComfyUI Node

Clip Text Encode SDXL (Shinsplat)

Token counting you can actually see

By Shinsplat·Created 2 years ago·Updated 2 years ago· 47
Clip Text Encode SDXL (Shinsplat)
  • clip
  • CONDITIONING
  • tokens_count
  • tokens_used
  • prompt_g
  • prompt_l
◄width1024►
◄height1024►
◄crop_w0►
◄crop_h0►
◄target_width1024►
◄target_height1024►
◄text_g—►
◄text_l—►
◄pony_gfalse►
◄pony_lfalse►

The stock SDXL encoder gives you a text_g box, a text_l box, a pile of resolution fields, and zero feedback about what you just encoded. This node keeps the exact same shape - same inputs, same CONDITIONING output, so existing workflows drop in - and layers on the pack's BREAK/END handling plus a per-stream Pony toggle and token counts for both text areas. If you live on SDXL and have ever wondered whether your prompt overflowed the context window, this is the version you want.

How it works

SDXL encodes text through two CLIP streams - text_g (the "open_clip" big stream) and text_l (the smaller CLIP ViT-L stream) - which are then combined into one conditioning. This node tokenizes each stream separately, honors the uppercase BREAK and END directives in each, and reports what it used. The pony_g and pony_l switches prepend the PonyXL score line to either stream independently, which the author added because he was never sure how the two streams interact. His observation from testing: put the same criteria in both text_g and text_l and you get roughly the same result as the simple encoder at default resolutions, since the back-end duplicates the text anyway.

The inputs that matter

  • text_g / text_l - the two prompt boxes. text_l is the one you'll usually keep terse.
  • clip - the SDXL CLIP model.
  • pony_g / pony_l - prepend the Pony score block to either stream.
  • width, height, crop_w, crop_h, target_width, target_height - the standard SDXL resolution/crop set; they feed the position IDs the encoder uses, so they should match the latent size you're sampling.

Outputs: CONDITIONING (to the sampler), tokens_count and tokens_used (your context-window readout), and prompt_g / prompt_l - the cleaned, directive-stripped text for each stream so you can see exactly what each half encoded.

How to install it

Ships with ComfyUI-Shinsplat:

cd ComfyUI/custom_nodes
git clone https://github.com/Shinsplat/ComfyUI-Shinsplat

or ComfyUI Manager → search "ComfyUI-Shinsplat" → restart. No pip deps, no model downloads.

Common issues

  • Tokens look higher than you expect - SDXL has two streams and the counter reports both, so tokens_used covers text_g and text_l. That's the total context you're burning, not just one box.
  • Pony output missing the score line in prompt_g - by design; Pony tags are prepended at conditioning time but not included in the output text streams, so your saved/mirrored prompt stays clean.
  • Mismatched resolution fields - if width/height don't match the EmptyLatent you're sampling, SDXL conditioning can subtly drift. Keep them in sync.
Categoryadvanced/Shinsplat

Inputs (11)

NameTypeDefaultDescription
widthINT10240–16384—
heightINT10240–16384—
crop_wINT00–16384—
crop_hINT00–16384—
target_widthINT10240–16384—
target_heightINT10240–16384—
text_gSTRING—
clipCLIP—
text_lSTRING—
pony_gBOOLEANfalse—
pony_lBOOLEANfalse—

Outputs (5)

NameTypeDescription
CONDITIONINGCONDITIONING—
tokens_countSTRING—
tokens_usedSTRING—
prompt_gSTRING—
prompt_lSTRING—