src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
// Path settings
.field(
"sdCliPath",
"string",
{
displayName: "sd-cli Path",
subtitle: "Full path to sd-cli executable",
},
"" // User must configure
)
.field(
"modelPath",
"string",
{
displayName: "Model Path",
subtitle: "Path to SDXL .safetensors model",
},
""
)
.field(
"outputDirectory",
"string",
{
displayName: "Output Directory",
subtitle: "Where to save generated images",
},
"~/Downloads/" // Common default
)
// Generation settings
.field(
"width",
"numeric",
{
displayName: "Image Width",
subtitle: "Pixels (multiple of 64)",
min: 256,
max: 1536,
int: true,
slider: { min: 256, max: 1536, step: 64 },
},
1024
)
.field(
"height",
"numeric",
{
displayName: "Image Height",
subtitle: "Pixels (multiple of 64)",
min: 256,
max: 1536,
int: true,
slider: { min: 256, max: 1536, step: 64 },
},
1024
)
.field(
"steps",
"numeric",
{
displayName: "Sampling Steps",
subtitle: "More = better quality, slower",
min: 1,
max: 50,
int: true,
slider: { min: 1, max: 50, step: 1 },
},
8
)
.field(
"cfgScale",
"numeric",
{
displayName: "CFG Scale",
subtitle: "1-2 for DMD2/LCM, 7-12 for standard",
min: 1,
max: 20,
slider: { min: 1, max: 20, step: 0.5 },
},
1.0
)
.field(
"sampler",
"select",
{
displayName: "Sampling Method",
options: [
{ value: "lcm", displayName: "LCM (Fast)" },
{ value: "euler_a", displayName: "Euler Ancestral" },
{ value: "euler", displayName: "Euler" },
{ value: "dpm++2m", displayName: "DPM++ 2M" },
{ value: "dpm++2s_a", displayName: "DPM++ 2S Ancestral" },
{ value: "heun", displayName: "Heun" },
],
},
"lcm"
)
.field(
"scheduler",
"select",
{
displayName: "Scheduler",
subtitle: "Sigma schedule (use LCM for DMD2/Lightning models)",
options: [
{ value: "discrete", displayName: "Discrete" },
{ value: "karras", displayName: "Karras" },
{ value: "exponential", displayName: "Exponential" },
{ value: "ays", displayName: "AYS (Align Your Steps)" },
{ value: "gits", displayName: "GITS" },
{ value: "smoothstep", displayName: "Smoothstep" },
{ value: "sgm_uniform", displayName: "SGM Uniform" },
{ value: "simple", displayName: "Simple" },
{ value: "kl_optimal", displayName: "KL Optimal" },
{ value: "lcm", displayName: "LCM" },
{ value: "bong_tangent", displayName: "Bong Tangent" },
],
},
"exponential"
)
.field(
"previewScale",
"numeric",
{
displayName: "Preview Scale %",
subtitle: "Resize preview image (full size saved separately)",
min: 10,
max: 100,
int: true,
slider: { min: 10, max: 100, step: 10 },
},
50
)
// Upscaling settings
.field(
"enableUpscale",
"select",
{
displayName: "Enable Upscaling",
subtitle: "Upscale after generation using ESRGAN",
options: [
{ value: "false", displayName: "No" },
{ value: "true", displayName: "Yes" },
],
},
"false"
)
.field(
"upscaleModelPath",
"string",
{
displayName: "Upscale Model Path",
subtitle: "Path to ESRGAN model (e.g., 4x_ultrasharp.pth)",
},
""
)
.field(
"upscaleFactor",
"select",
{
displayName: "Upscale Factor",
subtitle: "Target scale (4x model runs then resizes to target)",
options: [
{ value: "2", displayName: "2x" },
{ value: "3", displayName: "3x" },
{ value: "4", displayName: "4x (native)" },
],
},
"2"
)
.field(
"upscaleTileSize",
"numeric",
{
displayName: "Upscale Tile Size",
subtitle: "Smaller = less VRAM, slower",
min: 32,
max: 512,
int: true,
slider: { min: 32, max: 512, step: 32 },
},
128
)
// Advanced settings
.field(
"vaeTiling",
"select",
{
displayName: "VAE Tiling",
subtitle: "Process VAE in tiles (reduces VRAM, can improve quality at high res)",
options: [
{ value: "false", displayName: "No" },
{ value: "true", displayName: "Yes" },
],
},
"false"
)
.field(
"clipOnCpu",
"select",
{
displayName: "CLIP on CPU",
subtitle: "Required for SDXL on Metal GPU",
options: [
{ value: "true", displayName: "Yes (recommended)" },
{ value: "false", displayName: "No" },
],
},
"true"
)
.build();
src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
// Path settings
.field(
"sdCliPath",
"string",
{
displayName: "sd-cli Path",
subtitle: "Full path to sd-cli executable",
},
"" // User must configure
)
.field(
"modelPath",
"string",
{
displayName: "Model Path",
subtitle: "Path to SDXL .safetensors model",
},
""
)
.field(
"outputDirectory",
"string",
{
displayName: "Output Directory",
subtitle: "Where to save generated images",
},
"~/Downloads/" // Common default
)
// Generation settings
.field(
"width",
"numeric",
{
displayName: "Image Width",
subtitle: "Pixels (multiple of 64)",
min: 256,
max: 1536,
int: true,
slider: { min: 256, max: 1536, step: 64 },
},
1024
)
.field(
"height",
"numeric",
{
displayName: "Image Height",
subtitle: "Pixels (multiple of 64)",
min: 256,
max: 1536,
int: true,
slider: { min: 256, max: 1536, step: 64 },
},
1024
)
.field(
"steps",
"numeric",
{
displayName: "Sampling Steps",
subtitle: "More = better quality, slower",
min: 1,
max: 50,
int: true,
slider: { min: 1, max: 50, step: 1 },
},
8
)
.field(
"cfgScale",
"numeric",
{
displayName: "CFG Scale",
subtitle: "1-2 for DMD2/LCM, 7-12 for standard",
min: 1,
max: 20,
slider: { min: 1, max: 20, step: 0.5 },
},
1.0
)
.field(
"sampler",
"select",
{
displayName: "Sampling Method",
options: [
{ value: "lcm", displayName: "LCM (Fast)" },
{ value: "euler_a", displayName: "Euler Ancestral" },
{ value: "euler", displayName: "Euler" },
{ value: "dpm++2m", displayName: "DPM++ 2M" },
{ value: "dpm++2s_a", displayName: "DPM++ 2S Ancestral" },
{ value: "heun", displayName: "Heun" },
],
},
"lcm"
)
.field(
"scheduler",
"select",
{
displayName: "Scheduler",
subtitle: "Sigma schedule (use LCM for DMD2/Lightning models)",
options: [
{ value: "discrete", displayName: "Discrete" },
{ value: "karras", displayName: "Karras" },
{ value: "exponential", displayName: "Exponential" },
{ value: "ays", displayName: "AYS (Align Your Steps)" },
{ value: "gits", displayName: "GITS" },
{ value: "smoothstep", displayName: "Smoothstep" },
{ value: "sgm_uniform", displayName: "SGM Uniform" },
{ value: "simple", displayName: "Simple" },
{ value: "kl_optimal", displayName: "KL Optimal" },
{ value: "lcm", displayName: "LCM" },
{ value: "bong_tangent", displayName: "Bong Tangent" },
],
},
"exponential"
)
.field(
"previewScale",
"numeric",
{
displayName: "Preview Scale %",
subtitle: "Resize preview image (full size saved separately)",
min: 10,
max: 100,
int: true,
slider: { min: 10, max: 100, step: 10 },
},
50
)
// Upscaling settings
.field(
"enableUpscale",
"select",
{
displayName: "Enable Upscaling",
subtitle: "Upscale after generation using ESRGAN",
options: [
{ value: "false", displayName: "No" },
{ value: "true", displayName: "Yes" },
],
},
"false"
)
.field(
"upscaleModelPath",
"string",
{
displayName: "Upscale Model Path",
subtitle: "Path to ESRGAN model (e.g., 4x_ultrasharp.pth)",
},
""
)
.field(
"upscaleFactor",
"select",
{
displayName: "Upscale Factor",
subtitle: "Target scale (4x model runs then resizes to target)",
options: [
{ value: "2", displayName: "2x" },
{ value: "3", displayName: "3x" },
{ value: "4", displayName: "4x (native)" },
],
},
"2"
)
.field(
"upscaleTileSize",
"numeric",
{
displayName: "Upscale Tile Size",
subtitle: "Smaller = less VRAM, slower",
min: 32,
max: 512,
int: true,
slider: { min: 32, max: 512, step: 32 },
},
128
)
// Advanced settings
.field(
"vaeTiling",
"select",
{
displayName: "VAE Tiling",
subtitle: "Process VAE in tiles (reduces VRAM, can improve quality at high res)",
options: [
{ value: "false", displayName: "No" },
{ value: "true", displayName: "Yes" },
],
},
"false"
)
.field(
"clipOnCpu",
"select",
{
displayName: "CLIP on CPU",
subtitle: "Required for SDXL on Metal GPU",
options: [
{ value: "true", displayName: "Yes (recommended)" },
{ value: "false", displayName: "No" },
],
},
"true"
)
.build();