ComfyUI Extension: ComfyUI-Prompt-Format-Converter

Authored by zisonMyu

Created

Updated

2 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

ComfyUI custom nodes for converting prompt text between common anime image-generation formats.

README

ComfyUI Prompt Format Converter

English | 简体中文

ComfyUI custom nodes for converting prompt text between common anime image-generation formats.

This plugin focuses on practical prompt migration work:

  • SD weight syntax
  • SD(anima) artist prefix style with @artist
  • NAI3 brace weight syntax
  • NAI4 numeric weight::tag:: syntax
  • NewBie XML-style prompt structure
  • standalone artist name / artist prefix conversion

The nodes are dependency-free and run in a standard ComfyUI install.

Features

  • Convert prompt formats between SD, SD(anima), NAI3, NAI4, and NewBie
  • Auto-detect prompt format before conversion
  • Skip conversion when the input already matches the target format
  • Convert artist prefixes automatically:
    • plain artist tags
    • @artist
    • artist:artist
  • Optional exact artist recognition with a local Danbooru artist CSV
  • AI Danbooru prompt generation/classification via OpenAI-compatible APIs
  • Convert standalone artist name lists with a dedicated node
  • Scale explicit weights without changing the selected prompt format
  • Escape literal parentheses such as ask(askzy) to ask\(askzy\)
  • Warn when converting heavy weights to NAI3 where deep nesting is required

Included Nodes

1. Prompt Format Converter

Main prompt conversion node.

Inputs:

  • prompt
  • source_format
    • Auto-detect
    • SD
    • SD(anima)
    • NAI3
    • NAI4
  • target_format
    • SD
    • SD(anima)
    • NAI3
    • NAI4
    • NewBie
  • escape_parentheses
  • include_comments
  • use_exact_artist_detection
  • artist_csv_path

Outputs:

  • converted_prompt
  • detected_source_format
  • warnings

2. Prompt Weight Scaler

Scales explicit weights while preserving the current format.

3. Danbooru Artist CSV Manager

Checks or downloads the local artist CSV used by exact artist detection.

Default source:

https://huggingface.co/datasets/Laxhar/noob-wiki/resolve/main/danbooru_artist.csv

Default local path:

data/danbooru_artist.csv

The CSV file is intentionally ignored by git because it is large. Users can update it from the node by choosing download/update, or they can set artist_csv_path to their own CSV file.

4. AI Danbooru Prompt Generator (OpenAI/OpenRouter)

Uses standard OpenAI-compatible chat/completions APIs to generate a Danbooru-ordered prompt from:

  • user requirement
  • original prompt (optional)
  • target format (SD / NAI3 / NAI4)
  • custom tag order template

Provider options:

  • openai
  • openrouter

Auth options:

  • node input api_key
  • env vars:
    • OPENAI_API_KEY
    • OPENROUTER_API_KEY

Advanced options:

  • custom_base_url for custom OpenAI-compatible gateways
  • tag_order_template and general_tag_order for custom ordering behavior

5. Artist Tag Formatter

Formats a raw list of artist names for a target format.

6. Artist Name Converter

Converts standalone artist name lists between:

  • plain SD
  • @ - SD(anima)
  • artist: - NAI
  • NewBie <style>

7. Artist Prefix Converter

Converts explicit artist prefixes inside a full prompt without changing weight syntax.

Supported Conversion Rules

Weight syntax

  • SD -> NAI3
    • (tag:1.05) -> {tag}
    • (tag:0.95) -> [tag]
  • NAI3 -> SD
    • {tag} -> (tag:1.05)
    • [tag] -> (tag:0.9524)
  • SD -> NAI4
    • (tag:1.2) -> 1.2::tag::
  • NAI4 -> SD
    • 1.5::tag:: -> (tag:1.5)

Artist prefix rules

  • SD
    • wlop
  • SD(anima)
    • @wlop
  • NAI3 / NAI4
    • artist:wlop
  • NewBie
    • artists are placed in <style>

Installation

Option 1: Clone into custom_nodes

cd ComfyUI/custom_nodes
git clone <your-repo-url> prompt_format_converter

Option 2: Manual copy

Copy this folder into:

ComfyUI/custom_nodes/prompt_format_converter

Then restart ComfyUI.

Example

Input:

artist:wlop, 1.2::blue hair::, 1girl

Target format: SD(anima)

Output:

@wlop, (blue hair:1.2), 1girl

Notes

  • plain SD artist tags can be detected with the optional Danbooru artist CSV. Without that CSV, plain artist names are still indistinguishable from ordinary tags.
  • NewBie classification uses heuristic tag grouping. It is designed for practical conversion, not perfect semantic parsing.
  • If a prompt already looks like the target format, the main converter returns it directly for performance.

File Structure

prompt_format_converter/
  __init__.py
  nodes.py
  README.md
  README.zh-CN.md
  data/
    danbooru_artist.csv  # optional local file, ignored by git

License

MIT License. See LICENSE.

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more