|
@@ -25,6 +25,118 @@ const credentialTypes = [
|
|
|
|
|
|
|
|
const configSchema = {
|
|
const configSchema = {
|
|
|
type: 'object',
|
|
type: 'object',
|
|
|
|
|
+ // Generated from the server's own reference at /options/generation - see
|
|
|
|
|
+ // scripts/gen-sdcpp-generation-options.py. Every field the endpoint accepts
|
|
|
|
|
+ // has a setting here, grouped the way the server groups them.
|
|
|
|
|
+ uiGroups: [
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Server",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "serverUrl",
|
|
|
|
|
+ "credentialId"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Core",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "prompt",
|
|
|
|
|
+ "negativePrompt",
|
|
|
|
|
+ "width",
|
|
|
|
|
+ "height",
|
|
|
|
|
+ "steps",
|
|
|
|
|
+ "cfgScale",
|
|
|
|
|
+ "seed",
|
|
|
|
|
+ "sampler",
|
|
|
|
|
+ "scheduler",
|
|
|
|
|
+ "batchCount"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Cache Acceleration",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "cacheMode",
|
|
|
|
|
+ "easycacheThreshold",
|
|
|
|
|
+ "easycacheStart",
|
|
|
|
|
+ "easycacheEnd",
|
|
|
|
|
+ "spectrumW",
|
|
|
|
|
+ "spectrumM",
|
|
|
|
|
+ "spectrumLam",
|
|
|
|
|
+ "spectrumWindowSize",
|
|
|
|
|
+ "spectrumFlexWindow",
|
|
|
|
|
+ "spectrumWarmupSteps",
|
|
|
|
|
+ "spectrumStopPercent"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "ControlNet",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "controlImageBase64",
|
|
|
|
|
+ "controlStrength"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Prompt Expansion",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "expandPrompt"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Guidance",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "distilledGuidance",
|
|
|
|
|
+ "eta",
|
|
|
|
|
+ "shiftedTimestep",
|
|
|
|
|
+ "flowShift",
|
|
|
|
|
+ "clipSkip"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Image Input (img2img / image-edit)",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "initImageBase64",
|
|
|
|
|
+ "maskImageBase64",
|
|
|
|
|
+ "strength",
|
|
|
|
|
+ "imgCfgScale",
|
|
|
|
|
+ "refImages",
|
|
|
|
|
+ "refImageArgs"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Skip Layer Guidance (SLG)",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "slgScale",
|
|
|
|
|
+ "skipLayers",
|
|
|
|
|
+ "slgStart",
|
|
|
|
|
+ "slgEnd",
|
|
|
|
|
+ "customSigmas"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Upscale After Generation",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "upscale",
|
|
|
|
|
+ "upscaleRepeats",
|
|
|
|
|
+ "upscaleAutoUnload"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "VAE Tiling (per-generation)",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "vaeTiling",
|
|
|
|
|
+ "vaeTileSizeX",
|
|
|
|
|
+ "vaeTileSizeY",
|
|
|
|
|
+ "vaeTileOverlap"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Job",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ "title",
|
|
|
|
|
+ "extraOptions",
|
|
|
|
|
+ "timeout"
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
properties: {
|
|
properties: {
|
|
|
serverUrl: {
|
|
serverUrl: {
|
|
|
type: 'string', title: 'Server URL',
|
|
type: 'string', title: 'Server URL',
|
|
@@ -36,63 +148,56 @@ const configSchema = {
|
|
|
description: 'A basic credential holding the sdcpp-restapi username and password',
|
|
description: 'A basic credential holding the sdcpp-restapi username and password',
|
|
|
dynamicOptions: { source: 'credentials', filter: { type: ['sdcpp', 'basic'] } }
|
|
dynamicOptions: { source: 'credentials', filter: { type: ['sdcpp', 'basic'] } }
|
|
|
},
|
|
},
|
|
|
- prompt: {
|
|
|
|
|
- type: 'string', title: 'Prompt',
|
|
|
|
|
- description: 'What to generate. Supports {{variable}} interpolation, <lora:name:weight>, and {a|b|c} dynamic prompts which the server expands into one queue item per variation',
|
|
|
|
|
- format: 'textarea'
|
|
|
|
|
- },
|
|
|
|
|
- negativePrompt: {
|
|
|
|
|
- type: 'string', title: 'Negative Prompt',
|
|
|
|
|
- description: 'Concepts to exclude. Has no effect on LCM and one-step SDXS models',
|
|
|
|
|
- format: 'textarea'
|
|
|
|
|
- },
|
|
|
|
|
- initImageBase64: {
|
|
|
|
|
- type: 'string', title: 'Image (base64)',
|
|
|
|
|
- description: 'The image to edit, base64 without a data: prefix'
|
|
|
|
|
- },
|
|
|
|
|
- refImages: {
|
|
|
|
|
- type: 'array', title: 'Reference Images (base64)',
|
|
|
|
|
- description: 'Extra images the edit model conditions on. Only edit-capable models use these',
|
|
|
|
|
- items: { type: 'string' }
|
|
|
|
|
- },
|
|
|
|
|
- refImageArgs: {
|
|
|
|
|
- type: 'string', title: 'Reference Image Options',
|
|
|
|
|
- description: 'Comma separated k=v options for the reference images, such as resize_before_vae=0,ref_index_mode=increase'
|
|
|
|
|
- },
|
|
|
|
|
- strength: {
|
|
|
|
|
- type: 'number', title: 'Strength',
|
|
|
|
|
- description: 'How far the result may move from the original, 0 to 1'
|
|
|
|
|
- },
|
|
|
|
|
- width: { type: 'number', title: 'Width', description: 'Leave empty to use the loaded architecture default' },
|
|
|
|
|
- height: { type: 'number', title: 'Height', description: 'Leave empty to use the loaded architecture default' },
|
|
|
|
|
- steps: { type: 'number', title: 'Steps', description: 'Leave empty for the architecture default - 4 for Flux Schnell and LCM, 20 for most others' },
|
|
|
|
|
- cfgScale: { type: 'number', title: 'CFG Scale', description: 'Leave empty for the architecture default. Distilled models such as Flux Schnell, LCM and Z-Image want 1.0' },
|
|
|
|
|
- sampler: {
|
|
|
|
|
- type: 'string', title: 'Sampler',
|
|
|
|
|
- enum: ['', 'euler', 'euler_a', 'heun', 'dpm2', 'dpm++2s_a', 'dpm++2m', 'dpm++2mv2',
|
|
|
|
|
- 'ipndm', 'ipndm_v', 'lcm', 'ddim_trailing', 'tcd', 'res_multistep', 'res_2s',
|
|
|
|
|
- 'er_sde', 'euler_cfg_pp', 'euler_a_cfg_pp', 'euler_ge'],
|
|
|
|
|
- default: '', description: 'Leave empty to use the architecture default'
|
|
|
|
|
- },
|
|
|
|
|
- scheduler: {
|
|
|
|
|
- type: 'string', title: 'Scheduler',
|
|
|
|
|
- enum: ['', 'discrete', 'karras', 'exponential', 'ays', 'gits', 'sgm_uniform',
|
|
|
|
|
- 'simple', 'smoothstep', 'kl_optimal', 'lcm', 'bong_tangent', 'ltx2'],
|
|
|
|
|
- default: '', description: 'Leave empty to use the architecture default'
|
|
|
|
|
- },
|
|
|
|
|
- seed: { type: 'number', title: 'Seed', description: 'Use -1 for a random seed. Any other value reproduces the same image' },
|
|
|
|
|
- batchCount: { type: 'number', title: 'Batch Count', description: 'How many to generate in this one job, all sharing the prompt' },
|
|
|
|
|
- clipSkip: { type: 'number', title: 'CLIP Skip', description: 'Skip the last N CLIP layers. Negative means the model default' },
|
|
|
|
|
- title: { type: 'string', title: 'Job Title', description: 'Optional label stored with the job, useful for finding it again in the queue' },
|
|
|
|
|
- extraOptions: {
|
|
|
|
|
- type: 'object', title: 'Extra Options',
|
|
|
|
|
- description: 'Any other generation field passed straight through, such as slg_scale, cache_mode or vae_tiling. See /options/generation on the server for the full list'
|
|
|
|
|
- },
|
|
|
|
|
- timeout: {
|
|
|
|
|
- type: 'number', title: 'Timeout (ms)',
|
|
|
|
|
- description: 'Applies to queueing the job, not to the render. The call returns as soon as the job is accepted',
|
|
|
|
|
- default: 30000
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ batchCount: { title: "Batch Count", description: "Number of independent images to produce in this single job. Each image gets a different seed (`seed`, `seed+1`, …). Total VRAM doesn't grow with batch_count — sd.cpp serializes. Recommended: 1 for interactive, higher when you want a grid of variations from one prompt. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ cacheMode: { title: "Cache Mode", description: "DiT-model intermediate caching strategy. Skips redundant computation across consecutive sampler steps when the model's intermediate state hasn't changed enough to matter. `easycache` is the simplest; `spectrum` is the newest, generally best for Flux/SD3/Z-Image. Recommended: spectrum for Flux/SD3/Z-Image when generation is too slow. Off for SD1.5/SDXL (UNet is too small for caching to win). Leave empty for the architecture default.", type: "string", enum: ["", "easycache", "spectrum"], enumLabels: ["(architecture default)", "EasyCache — single threshold, simple", "Spectrum — frequency-domain analysis (best quality/speed tradeoff)"], default: "" },
|
|
|
|
|
+ cfgScale: { title: "CFG Scale", description: "Classifier-Free Guidance scale. Strength of pushing the cond toward the prompt vs the uncond. Higher = follows prompt more aggressively but can over-saturate. Set to 1.0 to disable CFG (skips the uncond pass — twice as fast). Recommended: SD1.5: 7. SDXL: 4–8. Flux Dev: 1 (CFG bypassed in flow models). Z-Image: 1. Schnell/Turbo: 1. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ clipSkip: { title: "CLIP Skip", description: "Skip the last N layers of CLIP when encoding the prompt. -1 = use the model's recommended default. 2 is the classic anime-model setting. Recommended: -1 (auto). Set to 2 for anime/cartoon SD1.5 fine-tunes. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ controlImageBase64: { title: "ControlNet Image (base64)", description: "Base64-encoded pre-processed control image. Must match the ControlNet model loaded — Canny edges for canny model, depth map for depth model, etc. sd.cpp does not pre-process; you do that client-side. Recommended: Required when using ControlNet. Leave empty for the architecture default.", type: "string" },
|
|
|
|
|
+ controlStrength: { title: "ControlNet Strength", description: "How much the ControlNet influences the diffusion process (0.0–1.0). Lower = looser following, higher = tighter following at cost of overall coherence. Recommended: 0.6–0.9 for most uses. Lower for creative prompts where control should be a hint, not a constraint. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ customSigmas: { title: "Custom Sigma Schedule", description: "Replace the scheduler's noise sigma sequence with a hand-tuned one. Bypasses `scheduler`. Empty array = use the chosen scheduler. Recommended: Empty unless you're hand-tuning per-step noise levels — niche. Leave empty for the architecture default.", type: "array", items: {"type": "number"} },
|
|
|
|
|
+ distilledGuidance: { title: "Distilled Guidance", description: "Distilled-CFG scale for models that bake the CFG behavior into the diffusion model itself (Flux). Replaces the runtime CFG split. Recommended: Flux Dev: 3.5 (sd.cpp default). Other architectures: ignored. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ easycacheEnd: { title: "EasyCache End (% of steps)", description: "Fraction of steps after which EasyCache turns off (last few steps fully recomputed for sharpness). Recommended: 0.95. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ easycacheStart: { title: "EasyCache Start (% of steps)", description: "Fraction of steps before EasyCache becomes active. Small to skip the early high-noise steps where caching hurts. Recommended: 0.15. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ easycacheThreshold: { title: "EasyCache Threshold", description: "Reuse threshold for EasyCache. Higher = more aggressive reuse (faster but more quality loss). Range typically 0.05–0.4. Recommended: 0.2 starting point. Tune up for more speed, down for more quality. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ eta: { title: "Eta", description: "Stochasticity parameter for DDIM-family samplers. 0 = deterministic, 1 = max stochasticity (matches DDPM noise schedule). Most other samplers ignore this. Recommended: 0 (deterministic, reproducible). Raise only with DDIM-trailing for some variation. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ expandPrompt: { title: "Expand Prompt Template", description: "If true, parse `prompt` for a1111-style dynamic-prompts syntax (`{a|b|c}`, `{N$$a|b|c}`) and create one queue item per variation. The response then carries `group_id` + `variation_count` + `job_ids[]` instead of a single `job_id`. Hard cap: 200 variations per request. Recommended: Enable when your prompt actually contains `{…}` syntax. Leave empty for the architecture default.", type: "boolean" },
|
|
|
|
|
+ flowShift: { title: "Flow Shift", description: "Per-generation flow-matching shift parameter for Flux / SD3 / Z-Image models. Higher values shift sampling toward larger noise levels longer. Per-call override; the load-time `flow_shift` is the default if this isn't set. Recommended: Flux Dev: 1.0. Z-Image: 3.0. SD3 Medium: 3.0. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ height: { title: "Height (px)", description: "Output image height in pixels. Same divisibility constraint as `width`. Recommended: Match training resolution. For non-square: total pixel count close to native is more important than aspect ratio. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ imgCfgScale: { title: "Image CFG Scale", description: "Image-CFG for instruct-pix2pix-style models. -1 = same as `cfg_scale`. Different from `cfg_scale`: balances text-prompt influence against image-prompt influence. Recommended: -1 unless using an instruct-pix2pix variant. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ initImageBase64: { title: "Init Image (base64)", description: "Base64-encoded source image for img2img / image-edit. Required for /img2img. Recommended: Required for img2img. Leave empty for the architecture default.", type: "string" },
|
|
|
|
|
+ maskImageBase64: { title: "Mask Image (base64)", description: "Base64-encoded inpainting mask. White areas are repainted, black areas preserved. Recommended: Optional. Empty mask = standard img2img (no inpainting). Leave empty for the architecture default.", type: "string" },
|
|
|
|
|
+ negativePrompt: { title: "Negative Prompt", description: "What to push the model away from. Has effect only when `cfg_scale > 1` (CFG is what compares cond vs uncond). Ignored on architectures that don't use CFG (most flow-matching models default to `cfg_scale = 1`). Recommended: Optional. Empty is a fine default for Flux / SD3 / Z-Image. Leave empty for the architecture default.", type: "string", format: "textarea" },
|
|
|
|
|
+ prompt: { title: "Prompt", description: "Text prompt fed to the model's text encoder (CLIP / T5 / LLM). Supports inline `<lora:name:weight>` tags — these are auto-extracted into the LoRA list before being sent to the encoder. Supports a1111-style dynamic-prompts (`{a|b|c}`) when `expand_prompt: true` is set. Recommended: Required. Leave empty for the architecture default.", type: "string", format: "textarea" },
|
|
|
|
|
+ refImageArgs: { title: "Reference Image Args", description: "Comma-separated k=v flags controlling reference-image preprocessing (e.g. `resize_before_vae=0,ref_index_mode=increase`). Replaces the previous auto_resize_ref_image / increase_ref_index bools. See sd.cpp docs. Recommended: Leave empty unless you need to override defaults. Leave empty for the architecture default.", type: "string" },
|
|
|
|
|
+ refImages: { title: "Reference Images (base64)", description: "Base64-encoded reference images for Flux Kontext / image-edit. Each image gets encoded into the conditioner alongside the text prompt. Recommended: Use for Flux Kontext or models that accept reference images. Leave empty for the architecture default.", type: "array", items: {"type": "string"} },
|
|
|
|
|
+ sampler: { title: "Sampler", description: "Sampling algorithm. Different samplers can produce different images at the same seed; quality and speed differ too. Recommended: euler_a (general), dpmpp2m (SD1.5/SDXL), euler (Flux/SD3/Z-Image), lcm (LCM models). Leave empty for the architecture default.", type: "string", enum: ["", "ddim_trailing", "dpm2", "dpmpp2m", "dpmpp2mv2", "dpmpp2s_a", "er_sde", "euler", "euler_a", "heun", "ipndm", "ipndm_v", "lcm", "res_2s", "res_multistep", "tcd"], enumLabels: ["(architecture default)", "DDIM trailing — required for some fine-tunes", "DPM2 — 2nd-order, balanced", "DPM++ 2M — fast, good quality", "DPM++ 2M v2 — improved schedule", "DPM++ 2S ancestral — popular for SDXL", "ER SDE — SDE sampler (added recently)", "Euler — simple, fast, deterministic", "Euler ancestral — adds noise each step (less reproducible, more variet", "Heun — 2nd-order, slower, sometimes higher quality", "IPNDM", "IPNDM-V", "LCM — for LCM-finetuned models (4–8 step generation)", "RES 2S", "RES multistep — flow-model variant", "TCD — for TCD-finetuned models"], default: "" },
|
|
|
|
|
+ scheduler: { title: "Scheduler", description: "Determines the noise schedule (the timesteps the sampler walks through). Pairs with the sampler — some combinations (e.g. karras+dpmpp2m) are well-tested, others may be off. Recommended: discrete or karras for SD1.5/SDXL; simple for Flux/SD3; smoothstep for Z-Image. Leave empty for the architecture default.", type: "string", enum: ["", "ays", "bong_tangent", "discrete", "exponential", "gits", "karras", "kl_optimal", "lcm", "sgm_uniform", "simple", "smoothstep"], enumLabels: ["(architecture default)", "Align Your Steps (AYS) — auto-tuned", "Bong Tangent", "Discrete — uniform across model timesteps (default)", "Exponential", "GITS", "Karras — concentrates more steps near the end, common for SDXL", "KL optimal", "LCM — for LCM samplers", "SGM uniform — for SGM-trained models", "Simple — used by Flux / SD3 flow models", "Smoothstep — Z-Image's recommended scheduler"], default: "" },
|
|
|
|
|
+ seed: { title: "Seed", description: "RNG seed for the initial noise tensor (and stochastic samplers). -1 = pick a random one each generation. Same seed + same prompt + same model = same image. Recommended: -1 for variety. Pin a specific number for A/B comparing prompt or sampler changes. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ shiftedTimestep: { title: "Shifted Timestep", description: "Start the sampling schedule from a non-final timestep (used by NitroFusion and similar fast-sampling fine-tunes). 0 = standard schedule. 250–500 = NitroFusion's range. Recommended: 0 unless you're explicitly running a NitroFusion-style fine-tune. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ skipLayers: { title: "SLG Skip Layers", description: "Which transformer layers to skip during the SLG unconditional pass. SD3.5 Medium uses [7, 8, 9]. Recommended: [7,8,9] for SD3.5 Medium. Other models: leave default, ignored when slg_scale=0. Leave empty for the architecture default.", type: "array", items: {"type": "number"} },
|
|
|
|
|
+ slgEnd: { title: "SLG End (% of steps)", description: "Fraction of the sampler schedule at which SLG turns off. Recommended: 0.2 (early-cycle only — late-cycle SLG hurts quality). Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ slgScale: { title: "SLG Scale", description: "Skip Layer Guidance scale. Selectively zeros out a few diffusion layers when computing the unconditional pass — improves anatomy / coherence on SD3.5-medium and similar. 0 = disabled. Recommended: 0 for most models. 2.5 for SD3.5 Medium with the recommended skip layers. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ slgStart: { title: "SLG Start (% of steps)", description: "Fraction of the sampler schedule (0.0–1.0) at which SLG kicks in. Recommended: 0.01 (almost from the start). Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumFlexWindow: { title: "Spectrum Cache: flex window", description: "Spectrum-cache flexibility window (0.0–1.0). Recommended: 0.5. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumLam: { title: "Spectrum Cache: λ", description: "Spectrum-cache regularization λ. Recommended: 0.5. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumM: { title: "Spectrum Cache: m", description: "Spectrum-cache moving-average length. Recommended: 5. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumStopPercent: { title: "Spectrum Cache: stop percent", description: "Fraction of steps after which spectrum cache disengages (last steps recomputed). Recommended: 0.8. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumW: { title: "Spectrum Cache: w", description: "Spectrum-cache `w` weight (frequency cutoff). Higher = retains more spectrum, less speedup. Recommended: 0.5 default. See sd.cpp PR #1322 for tuning. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumWarmupSteps: { title: "Spectrum Cache: warmup steps", description: "Steps at the start of sampling before spectrum cache becomes active. Recommended: 2. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ spectrumWindowSize: { title: "Spectrum Cache: window size", description: "Spectrum-cache analysis window size in steps. Recommended: 3. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ steps: { title: "Sampling Steps", description: "Number of denoising steps the sampler runs. More steps = closer to the model's converged output, with diminishing returns. Distilled models (Flux Schnell, SDXL Turbo, Z-Image Turbo) need only 4–8. Recommended: 20–30 for SD1.5/SDXL, 20 for Flux Dev, 4–8 for *-Turbo or Schnell variants. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ strength: { title: "Denoising Strength", description: "How much of the init image's noise to keep (0.0 = identical to init, 1.0 = ignore init entirely). Controls how aggressively img2img diverges from the input. Recommended: 0.5–0.75 for natural-looking edits. 0.9+ for radical reinterpretation. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ upscale: { title: "Upscale After Generate", description: "Run the loaded ESRGAN upscaler on the output image after generation. Requires an upscaler to be loaded via POST /upscaler/load. Recommended: On for one-shot 'generate then upscale' workflows. Leave empty for the architecture default.", type: "boolean" },
|
|
|
|
|
+ upscaleAutoUnload: { title: "Auto-unload Upscaler", description: "Free upscaler VRAM right after the upscale step. Useful when you generated with `upscale: true` and want VRAM back for other work. Recommended: On. Leave empty for the architecture default.", type: "boolean" },
|
|
|
|
|
+ upscaleRepeats: { title: "Upscale Repeats", description: "Number of post-generation auto-upscale passes (each with the upscaler's native factor — 4× ESRGAN × 2 passes = 16×). DISTINCT from the `/upscale` endpoint's own `repeats` field, which controls passes inside a single upscale job. `upscale_repeats` only chains additional /upscale calls after txt2img / img2img finish. Recommended: 1. Two passes amplify artifacts, but produces large outputs from small inputs. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ vaeTileOverlap: { title: "VAE Tile Overlap", description: "Overlap fraction between VAE tiles for seam blending. Recommended: 0.5. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ vaeTileSizeX: { title: "VAE Tile Width", description: "Width of VAE tiles when tiling is on. 0 = use load-time default. Recommended: 0. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ vaeTileSizeY: { title: "VAE Tile Height", description: "Height of VAE tiles. 0 = use load-time default. Recommended: 0. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ vaeTiling: { title: "VAE Tiling", description: "Per-generation override of the model-load `vae_tiling`. Process VAE encode/decode in tiles to reduce peak VRAM. Recommended: Enable for ≥2048 px outputs. Otherwise leave to the load-time default. Leave empty for the architecture default.", type: "boolean" },
|
|
|
|
|
+ width: { title: "Width (px)", description: "Output image width in pixels. Must be divisible by the model's patch size (typically 8 or 16). Architectures have native resolutions they were trained at — going far off them can degrade quality. Recommended: Match the architecture's training resolution: SD1.5=512, SDXL=1024, Flux/SD3/Z-Image=1024, Wan video=832. Leave empty for the architecture default.", type: "number" },
|
|
|
|
|
+ title: { type: "string", title: "Job Title", description: "Optional label stored with the job, useful for finding it again in the queue" },
|
|
|
|
|
+ extraOptions: { type: "object", title: "Extra Options", description: "Any other generation field passed straight through. Everything the server documents already has a setting above, so this is only needed for a field a newer server has gained" },
|
|
|
|
|
+ timeout: { type: "number", title: "Timeout (ms)", description: "Applies to queueing the job, not to the render. The call returns as soon as the job is accepted", default: 30000 }
|
|
|
},
|
|
},
|
|
|
required: ['credentialId']
|
|
required: ['credentialId']
|
|
|
};
|
|
};
|
|
@@ -201,11 +306,57 @@ function putIfSet(target, key, value) {
|
|
|
target[key] = value;
|
|
target[key] = value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Width, steps, cfg_scale and the rest are architecture defaults: the server
|
|
|
|
|
-// fills them from the loaded model's preset when the field is absent. Sending an
|
|
|
|
|
-// empty box as 0 would override that preset with nonsense, so a field the user
|
|
|
|
|
-// did not fill is left out of the body entirely - and the test is emptiness,
|
|
|
|
|
-// never truthiness, because seed 0 and clip_skip 0 are legitimate values.
|
|
|
|
|
|
|
+// Every generation field the server documents, and the setting it comes
|
|
|
|
|
+// from. Generated alongside the schema above so the two cannot drift.
|
|
|
|
|
+const GENERATION_OPTIONS = [
|
|
|
|
|
+ { setting: "batchCount", server: "batch_count" },
|
|
|
|
|
+ { setting: "cacheMode", server: "cache_mode" },
|
|
|
|
|
+ { setting: "cfgScale", server: "cfg_scale" },
|
|
|
|
|
+ { setting: "clipSkip", server: "clip_skip" },
|
|
|
|
|
+ { setting: "controlImageBase64", server: "control_image_base64" },
|
|
|
|
|
+ { setting: "controlStrength", server: "control_strength" },
|
|
|
|
|
+ { setting: "customSigmas", server: "custom_sigmas" },
|
|
|
|
|
+ { setting: "distilledGuidance", server: "distilled_guidance" },
|
|
|
|
|
+ { setting: "easycacheEnd", server: "easycache_end" },
|
|
|
|
|
+ { setting: "easycacheStart", server: "easycache_start" },
|
|
|
|
|
+ { setting: "easycacheThreshold", server: "easycache_threshold" },
|
|
|
|
|
+ { setting: "eta", server: "eta" },
|
|
|
|
|
+ { setting: "expandPrompt", server: "expand_prompt" },
|
|
|
|
|
+ { setting: "flowShift", server: "flow_shift" },
|
|
|
|
|
+ { setting: "height", server: "height" },
|
|
|
|
|
+ { setting: "imgCfgScale", server: "img_cfg_scale" },
|
|
|
|
|
+ { setting: "initImageBase64", server: "init_image_base64" },
|
|
|
|
|
+ { setting: "maskImageBase64", server: "mask_image_base64" },
|
|
|
|
|
+ { setting: "negativePrompt", server: "negative_prompt" },
|
|
|
|
|
+ { setting: "prompt", server: "prompt" },
|
|
|
|
|
+ { setting: "refImageArgs", server: "ref_image_args" },
|
|
|
|
|
+ { setting: "refImages", server: "ref_images" },
|
|
|
|
|
+ { setting: "sampler", server: "sampler" },
|
|
|
|
|
+ { setting: "scheduler", server: "scheduler" },
|
|
|
|
|
+ { setting: "seed", server: "seed" },
|
|
|
|
|
+ { setting: "shiftedTimestep", server: "shifted_timestep" },
|
|
|
|
|
+ { setting: "skipLayers", server: "skip_layers" },
|
|
|
|
|
+ { setting: "slgEnd", server: "slg_end" },
|
|
|
|
|
+ { setting: "slgScale", server: "slg_scale" },
|
|
|
|
|
+ { setting: "slgStart", server: "slg_start" },
|
|
|
|
|
+ { setting: "spectrumFlexWindow", server: "spectrum_flex_window" },
|
|
|
|
|
+ { setting: "spectrumLam", server: "spectrum_lam" },
|
|
|
|
|
+ { setting: "spectrumM", server: "spectrum_m" },
|
|
|
|
|
+ { setting: "spectrumStopPercent", server: "spectrum_stop_percent" },
|
|
|
|
|
+ { setting: "spectrumW", server: "spectrum_w" },
|
|
|
|
|
+ { setting: "spectrumWarmupSteps", server: "spectrum_warmup_steps" },
|
|
|
|
|
+ { setting: "spectrumWindowSize", server: "spectrum_window_size" },
|
|
|
|
|
+ { setting: "steps", server: "steps" },
|
|
|
|
|
+ { setting: "strength", server: "strength" },
|
|
|
|
|
+ { setting: "upscale", server: "upscale" },
|
|
|
|
|
+ { setting: "upscaleAutoUnload", server: "upscale_auto_unload" },
|
|
|
|
|
+ { setting: "upscaleRepeats", server: "upscale_repeats" },
|
|
|
|
|
+ { setting: "vaeTileOverlap", server: "vae_tile_overlap" },
|
|
|
|
|
+ { setting: "vaeTileSizeX", server: "vae_tile_size_x" },
|
|
|
|
|
+ { setting: "vaeTileSizeY", server: "vae_tile_size_y" },
|
|
|
|
|
+ { setting: "vaeTiling", server: "vae_tiling" },
|
|
|
|
|
+ { setting: "width", server: "width" }
|
|
|
|
|
+];
|
|
|
|
|
|
|
|
async function execute(config, input, context) {
|
|
async function execute(config, input, context) {
|
|
|
const server = normalizeServer(config.serverUrl);
|
|
const server = normalizeServer(config.serverUrl);
|
|
@@ -215,30 +366,32 @@ async function execute(config, input, context) {
|
|
|
const token = login(server, credential, timeout);
|
|
const token = login(server, credential, timeout);
|
|
|
|
|
|
|
|
const body = {};
|
|
const body = {};
|
|
|
- putIfSet(body, 'prompt', config.prompt);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Built from the table above rather than field by field, so a setting the
|
|
|
|
|
+ // server documents cannot be quietly missing from the request. A setting
|
|
|
|
|
+ // left empty is left out of the body entirely: the server fills an absent
|
|
|
|
|
+ // field from the loaded model's architecture preset, and sending an empty
|
|
|
|
|
+ // box as 0 would override that preset with nonsense. The test is emptiness,
|
|
|
|
|
+ // never truthiness - seed 0 and clip_skip 0 are legitimate values.
|
|
|
|
|
+ for (let i = 0; i < GENERATION_OPTIONS.length; i++) {
|
|
|
|
|
+ const option = GENERATION_OPTIONS[i];
|
|
|
|
|
+ const value = config[option.setting];
|
|
|
|
|
+ if (Array.isArray(value)) {
|
|
|
|
|
+ if (value.length > 0) {
|
|
|
|
|
+ body[option.server] = value;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ putIfSet(body, option.server, value);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ putIfSet(body, 'title', config.title);
|
|
|
|
|
+
|
|
|
if (!body.prompt) {
|
|
if (!body.prompt) {
|
|
|
throw new Error('SD.cpp: an edit needs a prompt describing the change');
|
|
throw new Error('SD.cpp: an edit needs a prompt describing the change');
|
|
|
}
|
|
}
|
|
|
- putIfSet(body, 'negative_prompt', config.negativePrompt);
|
|
|
|
|
- putIfSet(body, 'width', config.width);
|
|
|
|
|
- putIfSet(body, 'height', config.height);
|
|
|
|
|
- putIfSet(body, 'steps', config.steps);
|
|
|
|
|
- putIfSet(body, 'cfg_scale', config.cfgScale);
|
|
|
|
|
- putIfSet(body, 'sampler', config.sampler);
|
|
|
|
|
- putIfSet(body, 'scheduler', config.scheduler);
|
|
|
|
|
- putIfSet(body, 'seed', config.seed);
|
|
|
|
|
- putIfSet(body, 'batch_count', config.batchCount);
|
|
|
|
|
- putIfSet(body, 'clip_skip', config.clipSkip);
|
|
|
|
|
- putIfSet(body, 'init_image_base64', config.initImageBase64);
|
|
|
|
|
- putIfSet(body, 'strength', config.strength);
|
|
|
|
|
- putIfSet(body, 'ref_image_args', config.refImageArgs);
|
|
|
|
|
- if (Array.isArray(config.refImages) && config.refImages.length > 0) {
|
|
|
|
|
- body.ref_images = config.refImages;
|
|
|
|
|
- }
|
|
|
|
|
if (!body.init_image_base64 && !body.ref_images) {
|
|
if (!body.init_image_base64 && !body.ref_images) {
|
|
|
throw new Error('SD.cpp: an edit needs an image, or at least one reference image');
|
|
throw new Error('SD.cpp: an edit needs an image, or at least one reference image');
|
|
|
}
|
|
}
|
|
|
- putIfSet(body, 'title', config.title);
|
|
|
|
|
|
|
|
|
|
// Anything else the API accepts, passed through, so a new server field does
|
|
// Anything else the API accepts, passed through, so a new server field does
|
|
|
// not need a node change to be reachable.
|
|
// not need a node change to be reachable.
|