Nodes/ComfyUI_EmbeddingToolkit/Save Token Embeddings
ComfyUI Node

Save Token Embeddings

Freeze your exact prompt into a reusable embedding file — no training involved

By silveroxides·Created about a year ago·Updated 4 months ago· 11
Save Token Embeddings
  • clip
    text
    slice_bos_eosfalse
    filename_prefixtoken_embeds

    Let's get the big misconception out of the way first: Save Token Embeddings is not a trainer. You aren't teaching the model a new concept, and you aren't doing textual inversion. The node takes a prompt you already have, runs it through the CLIP text encoder, and writes the resulting token vectors to a small .safetensors file in your embeddings folder. Think of it as freezing a prompt into a reusable file - a precomputed conditioning snippet you can summon with embedding:filename in any future prompt.

    That's genuinely useful, even if it sounds underwhelming. Bake your house-style prompt once and reuse it everywhere. Collapse a long negative prompt into one token (the EasyNegative trick, without the 40-word preamble). Share a prompt as a 50 KB file instead of a 200-word text wall. Because the file is just vectors, it's deterministic - same model, same file, same conditioning, no drift from retyping.

    How it works

    The node tokenizes your text with the current CLIP's tokenizer, then walks every text-encoder component the loaded model actually has - clip_l / clip_g on SDXL, t5xxl on Flux, the Qwen or Mistral parts on newer LLM-encoded checkpoints. For each component it runs the token IDs through the encoder's process_tokens, keeps only the real (non-padding) tokens, and concatenates them into one tensor. The result is saved as a multi-key safetensors file straight into ComfyUI/models/embeddings, where ComfyUI's built-in embedding loader can find it next time you write embedding:name in a text encoder.

    Note that this is the unweighted version - any (word:1.3) style weights in your text are tokenized but not applied to the saved vectors. If you want weights baked in (which matters on Flux-class models that discard them), use the pack's Save Weighted Embeddings node instead.

    The inputs that matter

    Only four, and you'll touch two of them most of the time:

    • clip - wire in any CLIP loader. The node figures out which sub-encoders exist.
    • text - the prompt to freeze. Multiline, supports dynamic prompts.
    • slice_bos_eos (default off) - leave it off and the file includes the BOS/EOS markers, so using it in a prompt reproduces the original conditioning almost exactly. Turn it on and it strips BOS/EOS from clip_l/clip_g and EOS from the T5 parts, giving you a leaner vector sequence that slots into a prompt more like a plain token. Start with off; slice later if the embedding fights your prompt.
    • filename_prefix (default token_embeds) - files save as token_embeds_00001.safetensors, auto-incremented so you never overwrite.

    Where it saves, and how you use it

    Files land in ComfyUI/models/embeddings/, not your output folder. The numbering means the file's name is token_embeds_00001 - reference it in any text encoder as embedding:token_embeds_00001. There's no output port to wire; the node's job is done the moment it writes the file.

    Installing the pack

    This one is refreshingly painless. The pack (silveroxides/ComfyUI_EmbeddingToolkit) has zero dependencies beyond ComfyUI itself - no requirements.txt, no model downloads, nothing to pip install. Grab it via ComfyUI Manager (search "ComfyUI_EmbeddingToolkit") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI_EmbeddingToolkit
    

    Restart ComfyUI and you're done. It's a small personal utility from silveroxides - better known as the maintainer of the well-regarded Chroma-GGUF quants - so don't expect a big community; expect something that just works.

    Gotchas

    The big one is the encoder lock. An embedding is bound to the text encoder it was created with: an SDXL CLIP file won't mean anything on a Qwen3 or Mistral model, and a Flux/T5 file won't work on SDXL. The UI won't warn you - it silently ignores what it can't apply, which is how people convince themselves incompatible embeddings are working. Save files only for the model family you actually generate with.

    Also worth knowing: the README carries an explicit disclaimer - creating embeddings with this and uploading them to CivitAI under Early Access is called out as deceptive. Free uploads are fine, but don't be that person.

    CategoryEmbeddingToolkit

    Inputs (4)

    NameTypeDefaultDescription
    clipCLIP
    textSTRING
    slice_bos_eosBOOLEANfalse
    filename_prefixSTRINGtoken_embeds

    Outputs (0)

    No outputs