Nodes/ComfyUI_RS_NAI_API_Request/NAI Image Generator
ComfyUI Node

NAI Image Generator

ComfyUI's front door to NovelAI's closed models

By raspie10032·Created about a year ago·Updated 10 days ago· 8
NAI Image Generator
  • characterPrompts
  • vibes
  • references
  • nai_context
  • image
  • nai_context
◄promptprompt here►
◄negative_promptlowres, bad anatomy►
◄modelNAI Diffusion V5 Curated►
◄width832►
◄height1216►
◄samplerk_euler►
◄steps28►
◄cfg_scale6.0►
◄seed-1►
◄schedulerkarras►
◄cfg_rescale0.00►
◄prefer_brownianfalse►
◄variety_boosttrue►
◄limit_opus_freetrue►
◄normalize_vibe_strengthstrue►
◄save_formatPNG►
◄webp_quality90►
◄request_delay_seconds0.0►
◄use_context_settingstrue►
◄context_modeinherit_all►
◄override_promptfalse►
◄override_negative_promptfalse►
◄override_modelfalse►
◄override_samplerfalse►
◄override_stepsfalse►
◄override_cfg_scalefalse►
◄override_schedulerfalse►
◄override_cfg_rescalefalse►
◄override_prefer_brownianfalse►
◄override_variety_boostfalse►
◄override_characterPromptsfalse►

The name undersells it. This is the main node of the ComfyUI_RS_NAI_API_Request pack, and what it actually is is a text-to-image generator that never touches your GPU. You type a prompt, it packages your settings, POSTs them to NovelAI's image API, and drops the returned PNG back into your graph as a plain IMAGE tensor - exactly as if a local sampler had made it.

Why reach for it? NovelAI's Diffusion V5, V4.5, and V4 models are closed. There are no weights to download and no local checkpoint to load, so the only way to get that model's famous tag-following anime quality inside a ComfyUI workflow is to call it. That's what this node is for: a cloud model as a node, sitting upstream of your usual upscalers, face detailers, and compositing. It's the same "API wrapper" pattern this ecosystem treats with a wary eye - your prompt leaves the machine, every run is metered against your NovelAI subscription or Anlas balance, and whatever NovelAI filters, the node filters. For a model you can't run locally, that's the fair trade.

How it works

Mechanically it's thin and honest. The node builds a request against image.novelai.net/ai/generate-image with your model id, dimensions, sampler, steps, CFG, scheduler, and seed. For V4/V5 models it also constructs NovelAI's v4_prompt / v4_negative_prompt structure (with optional per-character prompts - more on that below). The API answers with a ZIP containing a PNG; the node unpacks it, autosaves it to output/<date>/NAI_autosave/, and returns the image.

Two model-era details worth knowing. V5 requests use params_version: 4 while the V4.x and V3 models use params_version: 3. And variety_boost (on by default) maps to NovelAI's skip_cfg_above_sigma, which nudges the sampler off-CFG early for more varied outputs - the node picks the cutoff per model (58 on V4.5, 19 on V4). Leave it on unless outputs feel too chaotic.

The inputs that matter

The required set is the standard trio plus dimensions: prompt, negative_prompt, model (the dropdown: V5 Curated, V5 Full, V4.5 Curated/Full, V4 Full, V4 Curated Preview, V3, Furry V3), width/height (multiples of 64), sampler, steps, cfg_scale, and seed (-1 for random). The optional panel adds:

  • scheduler - karras by default; the four choices (native, karras, exponential, polyexponential) are the usual NovelAI set.
  • cfg_rescale and prefer_brownian - sampler tuning for people who know what they want; default off.
  • characterPrompts - feed it the LIST from CharacterPromptSelect to add up to five spatially-positioned characters (V4/V5 only).
  • limit_opus_free - the one you'll actually touch. It's True by default, and it silently caps total pixels at 1,048,576 (1024×1024) and steps at 28 to stay inside NovelAI's free Opus tier. On a paid plan, flip it to False or you'll never see a 1.5MP render at 40 steps and wonder why your settings are being ignored.

The single output is IMAGE, ready to wire into anything.

Install

Install the pack once - all its nodes come together. Easiest via ComfyUI Manager: Manager → Custom Nodes Manager → search ComfyUI_RS_NAI_API_Request → Install, then restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_NAI_API_Request.git
cd ComfyUI_RS_NAI_API_Request
pip install -r requirements.txt

Dependencies are light (requests, Pillow, numpy, python-dotenv, torch, segment-anything). The one thing you must do before generating is set your token - the node won't run without it:

# inside ComfyUI_RS_NAI_API_Request/.env
NAI_ACCESS_TOKEN=your_token_here

NAI_API_TOKEN also works as a fallback, and both can be system environment variables.

Common issues

  • "NAI_ACCESS_TOKEN (or NAI_API_TOKEN) not found" - the env var isn't visible to the process. Check the .env file is in the node's own directory and that you restarted ComfyUI after creating it.
  • 429 Too Many Requests - the node catches it, sleeps 60 seconds, and retries once. If you're on the free tier, the limit_opus_free caps are doing their job; a paid plan just means wait or slow down.
  • Request rejected / no image - usually Anlas or subscription trouble. The node doesn't check your balance; the API itself rejects what you can't pay for, and the error prints in the ComfyUI console.
  • Autosaved image "missing" - autosaves land in a freshly created NAI_autosave/ folder; the file browser sometimes needs a refresh before the first image appears.

One honest caveat: n_samples is hardcoded to 1, so batching is up to you - seed-sweep with a Primitive node if you want a grid.

CategoryRS_NovelAI_API/Generation

Inputs (35)

NameTypeDefaultDescription
promptSTRINGprompt here—
negative_promptSTRINGlowres, bad anatomy—
modelCOMBONAI Diffusion V5 CuratedV5 Full Medium Effort always uses 14 steps, Euler Ancestral, zero CFG Rescale, and fixed Heavy Undesired Content. Custom base/character negative prompts are ignored. Prompt Guidance remains adjustable. Image-to-image and inpainting require limit_opus_free=False and can spend Anlas.
widthINT83264–4096—
heightINT121664–4096—
samplerCOMBOk_euler7 options: k_dpmpp_2m, k_dpmpp_sde, k_dpmpp_2m_sde, k_dpmpp_2s_ancestral, k_euler_ancestral, k_euler, +1
stepsINT281–50—
cfg_scaleFLOAT6.00–30—
seedINT-1-1–4294967295—
scheduleroptCOMBOkarras4 options: native, karras, exponential, polyexponential
cfg_rescaleoptFLOAT0.000–1—
prefer_brownianoptBOOLEANfalse—
variety_boostoptBOOLEANtrue—
characterPromptsoptLISTV5: up to 22 active character prompts; V4/V4.5: up to 6. V5 Curated inpainting uses V4.5 (6).
limit_opus_freeoptBOOLEANtrue—
vibesoptRS_NAI_VIBES—
referencesoptRS_NAI_REFERENCES—
normalize_vibe_strengthsoptBOOLEANtrueV4/V4.5 Vibe: scale strengths down if their absolute sum exceeds 1.0.
save_formatoptCOMBOPNGAutosave format. Preserves NovelAI generation information. No ComfyUI workflow is embedded.
webp_qualityoptINT901–100Used only for lossy WebP. Lossless WebP preserves pixels.
request_delay_secondsoptFLOAT0.00–3600Wait before each NovelAI request, including each detail region and uncached Vibe encoding. 0 adds no delay. The built-in 2-second gap overlaps this timer; a longer server retry wait still applies. Preview-only runs do not wait. Stop cancels the countdown.
nai_contextoptNAI_CONTEXTConnect the previous NAI generation context. Carries prompts, characters and generation settings; seed, size, strength, references and Anlas protection stay local.
use_context_settingsoptBOOLEANtrueUse connected prompts, characters, model and sampling settings. Turn off to use this node's manual values. Seed always uses this node's setting.
context_modeoptCOMBOinherit_allWith context enabled, inherit everything or replace only checked fields with this node's values. Unchecked fields still come from context.
override_promptoptBOOLEANfalseUse this node's prompt in override_selected mode. An empty string, zero or False is an intentional replacement.
override_negative_promptoptBOOLEANfalseUse this node's negative_prompt in override_selected mode. An empty string, zero or False is an intentional replacement.
override_modeloptBOOLEANfalseUse this node's model in override_selected mode. An empty string, zero or False is an intentional replacement.
override_sampleroptBOOLEANfalseUse this node's sampler in override_selected mode. An empty string, zero or False is an intentional replacement.
override_stepsoptBOOLEANfalseUse this node's steps in override_selected mode. An empty string, zero or False is an intentional replacement.
override_cfg_scaleoptBOOLEANfalseUse this node's cfg_scale in override_selected mode. An empty string, zero or False is an intentional replacement.
override_scheduleroptBOOLEANfalseUse this node's scheduler in override_selected mode. An empty string, zero or False is an intentional replacement.
override_cfg_rescaleoptBOOLEANfalseUse this node's cfg_rescale in override_selected mode. An empty string, zero or False is an intentional replacement.
override_prefer_brownianoptBOOLEANfalseUse this node's prefer_brownian in override_selected mode. An empty string, zero or False is an intentional replacement.
override_variety_boostoptBOOLEANfalseUse this node's variety_boost in override_selected mode. An empty string, zero or False is an intentional replacement.
override_characterPromptsoptBOOLEANfalseReplace the complete character list with characterPrompts, including negatives and positions. No connection clears the list.

Outputs (2)

NameTypeDescription
imageIMAGE—
nai_contextNAI_CONTEXT—