Nodes/ComfyUI-NovelAI-GENYTOOLS/NAI 文生图采样器
ComfyUI Node

NAI 文生图采样器

The 'generate' button of the NovelAI pack

By XTOGENY·Created about a month ago·Updated 4 days ago· 14
NAI 文生图采样器
  • nai_pipe
  • positive
  • negative
  • core_settings
  • advanced_settings
  • 图像批次
  • 实际Seed列表
  • 费用与统计
seed0
image_count1
max_anlas0

This is the node that actually spends your money. Everything else in the NovelAI pack - the prompt boxes, the settings cards, the reference loaders - is just arranging furniture. NAITextToImageSamplerV2 is the one that picks up the phone and calls NovelAI's API to generate an image. Which means it's also the one you should understand before you let it near a workflow.

What it is

Think of it as the KSampler of the pack, except the model lives on NovelAI's servers instead of your GPU. It takes the full modular pipeline as inputs: the NAI_PIPE from the model loader, a NAI_POSITIVE_PROMPT, a NAI_NEGATIVE_PROMPT, a core settings card (resolution, steps, guidance, sampler, noise schedule), and an advanced settings card (CFG rescale, decrisper, SMEA, quality tags, and so on).

The controls on the node itself:

  • seed - your reproducibility handle. Same seed plus same everything else, same image.
  • image_count - 1 to 4, matching NovelAI's per-request limit. This is a single API call for up to 4 images, which is cheaper per image than 4 separate calls.
  • max_anlas - a spending cap. Set this and the sampler refuses to fire if the request would exceed it. On a pack where you pay per call, that cap is your seatbelt.

The outputs

Three ports, and the middle one is easy to miss:

  • 图像批次 (IMAGE) - the generated images as a standard ComfyUI batch. Straight into a Preview Image or the pack's saver node.
  • 实际Seed列表 (STRING) - the actual seeds used, one per image. Save this. When you find the image you like, the seed string is how you reproduce it; the display seed only shows what you typed, not what the API used after whatever seed math it did.
  • 费用与统计 (STRING) - cost in Anlas and call stats. Wire this to a text node and you always know what a run set you back.

How it behaves

The sampler always re-runs - it declares itself changed every execution via the IS_CHANGED trick (returning NaN so ComfyUI's cache can never consider it unchanged). That's deliberate for a paid API node: you never want ComfyUI to skip your generate because "nothing upstream changed." The flip side is that this node defeats the cache for everything behind it, which is fine - you want it.

Cost model, from the pack and NovelAI's own docs: text-to-image burns Anlas per generation, and Opus subscribers get free V5 generation quota that the node will use first before touching your balance. The max_anlas cap is checked before the request goes out, so a "would exceed" run fails loudly rather than silently draining credits.

Install and setup

The pack: ComfyUI Manager, search "ComfyUI-NovelAI-GENYTOOLS", or:

cd ComfyUI/custom_nodes
git clone https://github.com/XTOGENY/ComfyUI-NovelAI-GENYTOOLS.git
pip install -r ComfyUI-NovelAI-GENYTOOLS/requirements.txt

Restart, then add a NovelAI Persistent API Token in ComfyUI settings under NovelAI 2.0: Persistent API Token. No model files - the models are NovelAI's.

Gotchas

  • This is the Anlas-spending node. If you're new, run once, read the stats output, and set max_anlas before you batch anything.
  • Every input is typed and required. Missing a settings card means no generate - that's the pack refusing to guess your resolution.
  • The token is never written to the workflow JSON or image metadata, which is exactly what you want from an API node. Just don't share a screenshot of the settings page with your token visible.
  • If the API model capability changed (say, V5 dropping a feature you had on V4.5), the pack errors before sending the paid request. Annoying, but infinitely better than paying for a request NovelAI would reject anyway.
CategoryNovelAI 2.0/生成

Inputs (8)

NameTypeDefaultDescription
nai_pipeNAI_PIPE
positiveNAI_POSITIVE_PROMPT
negativeNAI_NEGATIVE_PROMPT
core_settingsNAI_CORE_SETTINGS
advanced_settingsNAI_ADVANCED_SETTINGS
seedINT00–4294967295
image_countINT11–4
max_anlasFLOAT00–100000

Outputs (3)

NameTypeDescription
图像批次IMAGE
实际Seed列表STRING
费用与统计STRING