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 2 days ago· 7
NAI Image Generator
  • characterPrompts
  • IMAGE
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

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 (15)

NameTypeDefaultDescription
promptSTRINGprompt here
negative_promptSTRINGlowres, bad anatomy
modelCOMBONAI Diffusion V5 Curated8 options: NAI Diffusion V5 Curated, NAI Diffusion V5 Full, NAI Diffusion V4.5 Curated, NAI Diffusion V4.5 Full, NAI Diffusion V4 Full, NAI Diffusion V4 Curated Preview, +2
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
characterPromptsoptLIST
limit_opus_freeoptBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE