Clip Text Encode SDXL (Shinsplat)
Token counting you can actually see
- clip
- CONDITIONING
- tokens_count
- tokens_used
- prompt_g
- prompt_l
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_lis 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_usedcoverstext_gandtext_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/heightdon't match the EmptyLatent you're sampling, SDXL conditioning can subtly drift. Keep them in sync.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10240–16384 | — |
| height | INT | 10240–16384 | — |
| crop_w | INT | 00–16384 | — |
| crop_h | INT | 00–16384 | — |
| target_width | INT | 10240–16384 | — |
| target_height | INT | 10240–16384 | — |
| text_g | STRING | — | |
| clip | CLIP | — | |
| text_l | STRING | — | |
| pony_g | BOOLEAN | false | — |
| pony_l | BOOLEAN | false | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |
| tokens_count | STRING | — |
| tokens_used | STRING | — |
| prompt_g | STRING | — |
| prompt_l | STRING | — |