NAIA Request Random Prompt
Random prompts every run, straight from NAIA's Danbooru engine
- prompt
- negative_prompt
- width
- height
If you've ever wished ComfyUI would just roll you a prompt instead of making you type one, this is the node. Every time you hit Queue, NAIA Request Random Prompt asks NAIA - a desktop app that generates random Danbooru-tag prompts from the isek-ai/danbooru-tags-2024 dataset - for a fresh one, then hands it to CLIP Text Encode like nothing unusual happened. Queue again, get a different prompt. It's a slot machine for ideas, aimed squarely at the anime/SDXL tag-prompt crowd.
Here's the important part, because the name is a lie: NAIA is not a cloud service. It's a local desktop tool ("NAI Automation Tool," by the same DNT-LAB author) that runs on your machine and, with this pack, lets ComfyUI be the image engine instead of NAIA's own generator. The node talks to 127.0.0.1:7243 by default - no API key, no account, nothing leaves your computer. That's a genuinely different creature from the cloud API-wrapper nodes you may have heard warnings about.
How it works
Under the hood it's one blocking POST /api/comfyui/random call to NAIA's Remote Web API. NAIA picks a random row from your last search results (so you do have to run a search in NAIA first), runs your Prompt Engineering settings over it, and returns the prompt, negative, and a recommended resolution. The node cleans up the response - strips #-prefixed line comments (NovelAI's #(...) escape syntax is protected), collapses run-on commas - and normalizes any resolution over 1MP (1024²) down to the nearest 8-multiple while keeping the aspect ratio, since that's where SDXL/Flux/Pony-style models train. It also declares itself always-changed via the IS_CHANGED NaN trick, so it re-rolls every single run instead of being cached into oblivion. First request takes a few seconds while the WebSocket handshake warms up; after that it's under 0.3s.
The inputs that matter
use_naia_settings- the one that decides everything.true(default) means "use whatever Prompt Engineering settings are in NAIA's desktop UI right now."falsemeans "override them for this request only," using the widgets below. The override is all-or-nothing: specify one field and the rest get treated as empty/OFF, so don't half-fill it.pre_prompt/post_prompt/auto_hide- the strings NAIA sticks on the front, back, and "auto-hide" list of the generated prompt. Only read whenuse_naia_settingsisfalse.- The 15
remove_*dropdowns (pluse621_auto_boost,danbooru_auto_weight,tag_implication_compression) - each isskip/on/off.onstrips that category of tags,offkeeps them explicitly,skipmeans "don't send this key to NAIA." Defaultskipis right for 99% of users. host/port- leave them alone unless NAIA runs on a different machine. Port must match the one NAIA's Web Session is bound to (7243 by default).
Outputs
Four of them: prompt and negative_prompt (strings), plus width and height (ints) - NAIA's recommended resolution for that specific prompt.
Wire prompt into a positive CLIP Text Encode. To do that you right-click the text widget on CLIP Text Encode and pick Convert Widget to Input - without that step, there's no socket to plug a STRING into. This is the step everyone forgets on first try.
The negative_prompt output is the one to ignore. NAIA's negative is a fixed value you typed in its UI once, so it doesn't change between rolls - wiring it in just imports a static string. The author's own guidance is to write your negative directly in a second CLIP Text Encode, unless you're actively using NAIA's Conditional Prompt module, which does vary negatives dynamically. width/height plug straight into EmptyLatentImage (same Convert Widget to Input trick).
Install
cd ComfyUI/custom_nodes
git clone https://github.com/DNT-LAB/comfyui-naia-bridge.git
cd comfyui-naia-bridge
pip install -r requirements.txt
Or use ComfyUI Manager and search for comfyui-naia-bridge / naia. Dependencies are just websocket-client and requests - no models to download. Restart ComfyUI fully (backend + browser tab) after installing.
Gotchas
- NAIA needs the ComfyUI sync-API patch. Plain NAIA won't work; you need a version with
/api/comfyui/randomand/api/comfyui/health, and Web Session enabled in NAIA's settings. - Run a search first. Random prompts are drawn from a search result set; if the counter says 0, requests fail. This shows up as a 30-second hang followed by an error - the most confusing failure in the whole pack.
- Connection refused - NAIA isn't running, or Web Session is off. Check port 7243.
It's niche, and it's Korean-first, but if you're already a NAIA user who wants ComfyUI's samplers and upscalers instead of NAIA's built-in generation, this is the node that makes the handoff painless.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| use_naia_settings | BOOLEAN | true | true (기본): NAIA 데스크톱 앱의 Prompt Engineering 설정을 그대로 사용. 아래 pre_prompt / post_prompt / auto_hide / remove_* 위젯은 무시됨. false: 아래 위젯 값들을 NAIA로 전송해 이번 요청에 한해 override. NAIA 데스크톱 UI는 불변. all-or-nothing 규약 (미지정 필드는 빈 값/OFF). |
| pre_prompt | STRING | NAIA P.Eng의 '선행 프롬프트(pre_prompt)' 덮어쓰기. | |
| post_prompt | STRING | NAIA P.Eng의 '후행 프롬프트(post_prompt)' 덮어쓰기. | |
| auto_hide | STRING | NAIA P.Eng의 '자동 숨김(auto_hide)' 덮어쓰기. | |
| remove_author | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_work_title | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_character_name | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_character_features | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_clothes | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_color | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_location_and_background_color | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_expression | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_pose_action | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_meta_tags | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_object_tags | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| remove_noise_tags | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| e621_auto_boost | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| danbooru_auto_weight | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| tag_implication_compression | COMBO | skip | • skip: 이 키를 NAIA로 안 보냄 (NAIA에서 OFF로 해석됨 = 태그 유지) • on: 이 카테고리 태그 제거 • off: 이 카테고리 태그 유지 (명시적) |
| host | STRING | 127.0.0.1 | NAIA Remote API 호스트. NAIA가 같은 PC에서 실행되면 기본값 그대로 사용. 다른 PC에서 돌리는 경우만 IP 변경. |
| port | INT | 72431–65535 | NAIA Remote API 포트. NAIA Settings > Web Session에서 설정한 포트와 일치해야 함. 기본값 7243. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| negative_prompt | STRING | — |
| width | INT | — |
| height | INT | — |