Convert ComfyUI to Novel AI V4
Turn your ComfyUI weights into NovelAI's numeric scopes
- novelai_prompt
You've got a ComfyUI prompt you spent an afternoon tuning - (bikini:1.2), (long hair:1.05), the whole weighted dance. Then you point it at NovelAI V4 or V5 and it lands with all the impact of plain text, because NovelAI's newer models don't speak (parens:weight). They use a different syntax: 1.2::bikini ::, a numeric weight opening a scope that applies to the following comma-separated tags until a closing ::. This node translates one into the other.
ComfyUIToNovelAIV4 is a one-input, one-output text converter, part of the six-converter family in ComfyUI_RS_NAI_API_Request. Its whole job: take a ComfyUI weighted prompt and emit the equivalent NovelAI V4 numeric-scope prompt. It's a text node - no API calls, no token, no GPU - so it's safe to drop into a graph just to read the output in a ShowText node.
How it works
Every converter in the pack funnels through one shared intermediate representation: a list of (text, weight) tag pairs, with commas as tag separators in every syntax. This one parses ComfyUI into that list, then serializes it to V4 scope syntax.
The ComfyUI parsing has a few behaviors worth knowing:
- Each level of
(...)multiplies by the 1.1 default; an explicit(...:w)multiplies bywinstead. \(and\)are treated as literal parentheses, not weight groups - soe\(f: g h\)stays as text.- Escaping like that matters, because a bare
(tag:o)with a non-numeric colon is treated as malformed and dropped rather than guessed. - Weighted ranges are tag-aware:
(a b:1.3)weights bothaandb, because the comma is a tag separator and there isn't one inside the parens.
On the way out, the serializer merges consecutive tags that share the same weight into one scope - so 1.05::a ::, 1.05::b :: becomes the cleaner 1.05::a, b ::. It also guards the artist: prefix so the colon in artist:name is never misread as a weight marker.
A concrete round trip. In goes:
qw, a, (b c:1.05), d, e\(f: g h\), black bikini top, (negative example:-1.5)
Out comes:
qw, a, 1.05::b c ::, d, e(f: g h), black bikini top, -1.5::negative example ::
(Note b c stayed one tag - it's space-separated, and only commas split tags.)
That -1.5 negative weight survives because V4 numeric scopes can represent it; the old NAI syntax can't, which is exactly the gap the other converter in this pair fills.
Inputs and output
comfyui_prompt- the source text, multiline. Paste your weighted ComfyUI prompt here.- Output:
novelai_prompt- a string you can paste into the NAI Image Generator's prompt box (or any NovelAI client).
Install
With the rest of the pack, via ComfyUI Manager (search ComfyUI_RS_NAI_API_Request) or:
cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_NAI_API_Request.git
pip install -r requirements.txt
Restart ComfyUI after installing. No .env, no token - this node is pure string manipulation and runs offline.
Gotchas
The practical one: if your ComfyUI prompt contains escaped parens that are meant to be literal and you haven't escaped them, the converter drops the segment instead of guessing. The author's own tests are explicit about this - malformed input is discarded, not repaired. Also note the weight floor/ceiling: explicit weights outside the −5…5 range are clamped down to the 1.1 default with a console warning. For nearly every real prompt that's a non-issue, but it's worth knowing why an unusual weight suddenly reads as 1.1.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| comfyui_prompt | STRING | qw, a, (b c:1.05), d, e\(f: g h\), black bikini top, (negative example:-1.5), shorts under bikini bottom, (i j:1.2) | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| novelai_prompt | STRING | — |