1. Choose one protocol (never mix fields)

ScenarioFull EndpointModel & Prompt Fields
Native NovelAI protocol (Recommended)POST https://noveadream.com/ai/generate-imagemodel: nai-diffusion-5-full / nai-diffusion-4-5-full; input; action; parameters
OpenAI-compatible image client (V4.5)POST https://noveadream.com/v1/images/generationsmodel: nai-v4.5; prompt
Async workbench tasks, quotes, Vibe & SSEPOST /v1/nai/estimate → POST /v1/nai/generationsmodel: nai-v4.5; model_variant: exact version; prompt; quote_id

Critical rules for AI coding agents: POST /ai/generate-image does NOT use /v1, requires an exact version ID in model (never nai-v4.5 or nai-v5), puts the prompt in input (not prompt), and returns HTTP 201 Created on success (check 200 <= status < 300, never hardcode status == 200). Machine-readable schema: NAI OpenAPI 3.1 JSON Schema.

2. Configure your API key & Idempotency-Key

Create an API key (sk-...) on NoveaDream and send Authorization: Bearer <API_KEY>. If model restrictions are enabled on the key, allow nai-v4.5 (which unlocks all V3 / V4 / V4.5 / V5 variants on the native endpoint). Never send an official NovelAI pst-... token.

Manage API keys

powershell
$env:NOVEA_API_KEY = "sk-your-noveadream-key"
$env:NOVEA_REQUEST_ID = [guid]::NewGuid().ToString()
$env:REQUEST_ID = $env:NOVEA_REQUEST_ID
bash
export NOVEA_API_KEY="sk-your-noveadream-key"
export REQUEST_ID="$(python3 -c 'import uuid; print(uuid.uuid4())')"
export NOVEA_REQUEST_ID="$REQUEST_ID"

3. Exact model IDs & capabilities

Display Namemodel (for /ai/generate-image)Character LimitPrecise Reference
NAI V5 Fullnai-diffusion-5-full32Supported (up to 8, incl. outfit modes)
NAI V5 Curatednai-diffusion-5-curated32Supported (up to 8, incl. outfit modes)
NAI V4.5 Fullnai-diffusion-4-5-full6Supported (up to 4)
NAI V4.5 Curatednai-diffusion-4-5-curated6Supported (up to 4)
NAI V4 Fullnai-diffusion-4-full6Unsupported
NAI V4 Curatednai-diffusion-4-curated-preview6Unsupported
NAI Anime V3nai-diffusion-30Unsupported
NAI Furry V3nai-diffusion-furry-30Unsupported

For masked inpainting (action: "infill"), append -inpainting to the model ID (e.g. nai-diffusion-5-full-inpainting). V5 Economy (Medium) is web-workspace-only.

Configure SillyTavern & third-party clients

4. Interactive runnable examples (Python / Node.js / JSON)

Select a model and operation to generate zero-dependency scripts for text-to-image, img2img, inpainting, Precise Reference (V5 & V4.5), and multi-character prompts.

POST /ai/generate-image

Download default Python script · Full parameter dictionary, v4_prompt characters & V5/V4.5 Precise Reference JSON

5. Submit with cURL

Save the JSON below as request.json. Strict JSON validation is enforced: do NOT send unknown fields or null values (omit seed for a random seed; never pass seed: null or -1).

json
{
  "input": "watercolor, a blue ceramic teapot on a wooden table, soft daylight",
  "model": "nai-diffusion-5-full",
  "action": "generate",
  "parameters": {
    "width": 832,
    "height": 1216,
    "steps": 23,
    "n_samples": 1,
    "scale": 5,
    "seed": 42,
    "sampler": "k_euler_ancestral",
    "negative_prompt": "lowres, blurry"
  }
}
bash
curl --fail-with-body 'https://noveadream.com/ai/generate-image' \
  -H "Authorization: Bearer $NOVEA_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H "Idempotency-Key: $REQUEST_ID" \
  --data-binary @request.json

6. Parse responses (JSON & official ZIP) and handle retries

Header / CaseHTTP Status & Payload
Accept: application/json (Recommended)201 Created; returns {"images": [{"image": "RAW_BASE64_PNG", "index": 0, "seed": 42}]} (not OpenAI data[].url).
No Accept header, or application/zip201 Created; binary application/zip archive containing image_0.png, image_1.png… matching official image.novelai.net.
Header X-Generation-IDServer generation ID for diagnostics.
Error body (400 / 401 / 402 / 403 / 409 / 502 / 504)Controller returns {"statusCode": 400, "message": "..."} (402 = insufficient balance, 403 = key scope / access restriction, 409 = Idempotency-Key mismatch or concurrency conflict); auth/rate-limit middleware (401/429) may return {"error": {"message": "..."}}. On 504, check header X-Retry-Same-Key: retry with the SAME Idempotency-Key ONLY when true; when false, the task terminally timed out & refunded (use a NEW UUID for a new generation).
json
{
  "images": [
    {
      "image": "BASE64_PNG",
      "index": 0,
      "seed": 42
    }
  ]
}
python
import io, json, os, uuid, zipfile
from urllib.request import Request, urlopen

payload = {
    "input": "1girl, solo, watercolor, soft daylight",
    "model": "nai-diffusion-5-full",
    "action": "generate",
    "parameters": {
        "width": 832, "height": 1216, "steps": 23, "n_samples": 1,
        "scale": 5, "seed": 42, "sampler": "k_euler_ancestral", "negative_prompt": "lowres, blurry"
    }
}
req = Request(
    "https://noveadream.com/ai/generate-image",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['NOVEA_API_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    method="POST",
)
with urlopen(req, timeout=660) as resp:
    assert 200 <= resp.status < 300  # HTTP 201 Created
    with zipfile.ZipFile(io.BytesIO(resp.read())) as zf:
        zf.extractall("outputs")  # Extracts image_0.png, image_1.png ...

Need quotes, Vibe Transfer, or SSE streaming? See the /v1/nai/* extension API