Nodes/ComfyUI-nkxx/✍️ Wujiai LLM/VLM Writer
ComfyUI Node

✍️ Wujiai LLM/VLM Writer

Turn a rough idea into a prompt CSV with a cloud LLM — then feed it to the batch nodes

By nkxx188·Created 11 months ago·Updated 6 months ago· 14
✍️ Wujiai LLM/VLM Writer
  • images
  • file_path
  • status
model_namegemini-3-flash-preview
main_prompt请为我生成5条关于“夏日海滩”的Midjourney绘画prompt
system_promptYou are a helpful assistant.
output_filenamewujiai_generated_prompts.csv
column_nameprompt
api_key

What it's for

This is the node that writes your prompts for you, then saves them somewhere the batch machinery can read. WujiaiLLMWriter (display name "✍️ Wujiai LLM/VLM Writer") calls a cloud LLM through Wujiai's OpenAI-compatible endpoint, optionally shows it one or more images, and writes the response to a CSV or Excel file in your ComfyUI output folder. The design intent is printed right in the default prompt: generate five Midjourney-style image prompts, save them as wujiai_generated_prompts.csv, and from there they feed WujiaiSora2SubmitBatchTask or the pack's other batch/CSV nodes. It's the blank-page killer at the front of a batch pipeline.

How it works

How it works matters, because it's a chat model writing to a structured file. The node builds a messages array: your system_prompt first, then the main_prompt as user content. If you attach images, each one is uploaded to Wujiai's host and embedded as image content in the message - that's what makes it a VLM, so you can ask it to describe a reference and turn that into prompts. The response is sent to /v1/chat/completions with your chosen model_name, and then the node has to clean up after a chat model: it tries to pull a JSON array out of the reply with a regex, and if that fails it falls back to treating each non-empty line as one item. That two-step parse is the standard defense against an LLM wrapping your output in prose - it's the same failure mode every prompt-enhancer node has to fight.

The inputs

The inputs:

  • model_name - free text, default gemini-3-flash-preview. Not a dropdown because Wujiai's model roster updates from the cloud; check WujiaiModelBrowser for what's live.
  • main_prompt - what you want it to generate. Say how many and for what or the count is a coin flip.
  • system_prompt - the persona/constraints. Default "You are a helpful assistant."
  • output_filename - .csv, .xls, or .xlsx; .csv default. Saved into your ComfyUI output directory - so the full path is ComfyUI/output/<filename>, and no, it won't ask before overwriting an existing file of the same name.
  • column_name - the header your batch nodes should read. Default prompt.
  • images - optional IMAGE input; attach for VLM-style "describe this and write prompts" work.
  • api_key - the Wujiai fallback chain: node field → WUJIAI_KEY env var → __init__.py.

Two outputs: file_path (the absolute path of the file you just wrote) and status (a "成功生成 N 条记录并写入: ..." summary). Wire file_path into a text display and read it, or just find the file in ComfyUI/output/.

Install and honest caveats

Install is the standard pack routine: clone https://github.com/jieg9341-lab/ComfyUI-nkxx into ComfyUI/custom_nodes/, restart, and let it auto-install requests, pandas, openpyxl, yt-dlp, opencv-python, aiohttp - the pandas/openpyxl bits are exactly what make the CSV/Excel writing possible. No model downloads; the LLM lives in the cloud, so a key from wujiai.org is required.

Honest caveats. This is an API LLM, so your prompt and any images leave the machine and the upstream filter applies - fine for SFW prompt generation, useless for the uncensored work a local abliterated model exists for. And quality-wise, ask for five prompts and you'll get five; ask for "good" prompts and you'll get whatever the model felt like. Give it a tight system_prompt with an output format and count, and verify the file before launching a 50-job batch on it - one bad parse loop and you've spent credits on fifty near-identical prompts.

CategoryNkxx/Wujiai/语言模型

Inputs (7)

NameTypeDefaultDescription
model_nameSTRINGgemini-3-flash-preview
main_promptSTRING请为我生成5条关于“夏日海滩”的Midjourney绘画prompt
system_promptSTRINGYou are a helpful assistant.
output_filenameSTRINGwujiai_generated_prompts.csv
column_nameSTRINGprompt
imagesoptIMAGE
api_keyoptSTRING

Outputs (2)

NameTypeDescription
file_pathSTRING
statusSTRING