Stable Diffusion Commands

Complete Stable Diffusion commands reference — 136 commands across 2 categories. Quick reference cheat sheet for Cross-platform.

Environment variables (13)

ShortcutAction
PYTHONSets a custom path for Python executable
VENV_DIRSpecifies the path for the virtual environment. Default is venv. Special value - runs
COMMANDLINE_ARGSAdditional commandline arguments for the main program
IGNORE_CMD_ARGS_ERRORSSet to anything to make the program not exit with an error if an unexpected commandline
REQS_FILEName of requirements.txt file with dependencies that will be installed when launch.py is run
TORCH_COMMANDCommand for installing PyTorch
INDEX_URL--index-url parameter for pip
TRANSFORMERS_CACHEPath to where transformers library will download and keep its files related to the CLIP model
CUDA_VISIBLE_DEVICESSelect GPU to use for your instance on a system with multiple GPUs. For example, if you want
SD_WEBUI_LOG_LEVELLog verbosity. Supports any valid logging level supported by Python's built-in logging module
SD_WEBUI_CACHE_FILECache file path. Defaults to cache.json in the root directory if not set
SD_WEBUI_RESTARA value set by launcher script (like webui.bat webui.sh) informing Webui that restart function
SD_WEBUI_RESTARTINGA internal value signifying if webui is currently restarting or reloading, used for disabling

Running on CPU (123)

ShortcutAction
--exitTerminate after installation
--data-dirbase path where all user data is stored
--models-dirbase path where models are stored; overrides --data-dir
--configPath to config which constructs model
--ckptPath to checkpoint of Stable Diffusion model; if specified, this checkpoint will be added
--ckpt-dirPath to directory with Stable Diffusion checkpoints
--no-download-sd-modelDon't download SD1.5 model even if no model is found
--do-not-download-clipdo not download CLIP model even if it's not included in the checkpoint
--vae-dirPath to Variational Autoencoders model
--vae-pathCheckpoint to use as VAE; setting this argument
--gfpgan-dirGFPGAN directory
--codeformer-models-pathPath to directory with codeformer model file(s)
--gfpgan-models-pathPath to directory with GFPGAN model file(s)
--esrgan-models-pathPath to directory with ESRGAN model file(s)
--bsrgan-models-pathPath to directory with BSRGAN model file(s)
--realesrgan-models-pathPath to directory with RealESRGAN model file(s)
--scunet-models-pathPath to directory with ScuNET model file(s)
--swinir-models-pathPath to directory with SwinIR and SwinIR v2 model file(s)
--ldsr-models-pathPath to directory with LDSR model file(s)
--dat-models-pathPath to directory with DAT model file(s)
--lora-dirPath to directory with Lora networks
--clip-models-pathPath to directory with CLIP model file(s)
--embeddings-dirEmbeddings directory for textual inversion (default: embeddings)
--textual-inversion-templates-dirDirectory with textual inversion templates
--hypernetwork-dirhypernetwork directory
--localizations-dirLocalizations directory
--styles-filePath or wildcard path of styles files, allow multiple entries
--ui-config-fileFilename to use for UI configuration
--no-progressbar-hidingDo not hide progress bar in gradio UI
--ui-settings-fileFilename to use for UI settings
--allow-codeAllow custom script execution from web UI
--shareUse share=True for gradio and make the UI accessible through their site
--listenLaunch gradio with 0.0.0.0 as server name, allowing to respond to network requests
--portLaunch gradio with given server port, you need root/admin rights for ports < 1024; defaults
--hide-ui-dir-configHide directory configuration from web UI
--freeze-settingsdisable editing of all settings globally
--freeze-settings-in-sectionsdisable editing settings in specific sections of the settings page by specifying
--freeze-specific-settingsdisable editing of individual settings by specifying a comma-delimited list like
--enable-insecure-extension-accessEnable extensions tab regardless of other options
--gradio-debugLaunch gradio with --debug option
--gradio-authSet gradio authentication like username:password; or comma-delimit multiple like
--gradio-auth-pathSet gradio authentication file path ex. /path/to/auth/file same auth format as --gradio-auth
--disable-console-progressbarsDo not output progress bars to console
--enable-console-promptsPrint prompts to console when generating with txt2img and img2img
--apiLaunch web UI with API
--api-authSet authentication for API like username:password; or comma-delimit multiple like
--api-logEnable logging of all API requests
--nowebuiOnly launch the API, without the UI
--ui-debug-modeDon't load model to quickly launch UI
--device-idSelect the default CUDA device to use
--administratorAdministrator privileges
--cors-allow-originsAllowed CORS origin(s) in the form of a comma-separated list (no spaces)
--cors-allow-origins-regexAllowed CORS origin(s) in the form of a single regular expression
--tls-keyfilePartially enables TLS, requires --tls-certfile to fully function
--tls-certfilePartially enables TLS, requires --tls-keyfile to fully function
--disable-tls-verifyWhen passed, enables the use of self-signed certificates
--server-nameSets hostname of server
--no-gradio-queueDisables gradio queue; causes the webpage to use http requests instead of websockets; was
--gradio-allowed-pathAdd path to Gradio's allowed_paths; make it possible to serve files from it
--no-hashingDisable SHA-256 hashing of checkpoints to help loading performance
--skip-version-checkDo not check versions of torch and xformers
--skip-python-version-checkDo not check versions of Python
--skip-torch-cuda-testDo not check if CUDA is able to work properly
--skip-installSkip installation of packages
--loglevellog level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG
--log-startuplaunch.py argument: print a detailed log of what's happening at startup
--api-server-stopenable server stop/restart/kill via api
--timeout-keep-aliveset timeout_keep_alive for uvicorn
--xformersEnable xformers for cross attention layers
--force-enable-xformersEnable xformers for cross attention layers regardless of whether the checking code thinks you
--xformers-flash-attentionEnable xformers with Flash Attention to improve reproducibility
--opt-sdp-attentionEnable scaled dot product cross-attention layer optimization; requires PyTorch 2.*
--opt-sdp-no-mem-attentionEnable scaled dot product cross-attention layer optimization without memory efficient
--opt-split-attentionForce-enables Doggettx's cross-attention layer optimization. By default, it's
--opt-split-attention-invokeaiForce-enables InvokeAI's cross-attention layer optimization. By default, it's on when CUDA
--opt-split-attention-v1Enable older version of split attention optimization that does not consume all VRAM available
--opt-sub-quad-attentionEnable memory efficient sub-quadratic cross-attention layer optimization
--sub-quad-q-chunk-sizeQuery chunk size for the sub-quadratic cross-attention layer optimization to use
--sub-quad-kv-chunk-sizeKV chunk size for the sub-quadratic cross-attention layer optimization to use
--sub-quad-chunk-thresholdThe percentage of VRAM threshold for the sub-quadratic cross-attention layer optimization
--opt-channelslastEnable alternative layout for 4d tensors, may result in faster inference only on Nvidia cards
--disable-opt-split-attentionForce-disables cross-attention layer optimization
--disable-nan-checkDo not check if produced images/latent spaces have nans; useful for running without
--use-cpuUse CPU as torch device for specified modules
--use-ipexUse Intel XPU as torch device
--no-halfDo not switch the model to 16-bit floats
--precisionEvaluate at this precision
--no-half-vaeDo not switch the VAE model to 16-bit floats
--upcast-samplingUpcast sampling. No effect with --no-half. Usually produces similar results to --no-half
--medvramEnable Stable Diffusion model optimizations for sacrificing a some performance for low VRAM
--medvram-sdxlenable --medvram optimization just for SDXL models
--lowvramEnable Stable Diffusion model optimizations for sacrificing a lot of speed for very low VRAM
--lowramLoad Stable Diffusion checkpoint weights to VRAM instead of RAM
--disable-model-loading-ram-optimizationdisable an optimization that reduces RAM use when loading a model
--autolaunchOpen the web UI URL in the system's default browser upon launch
--themeOpen the web UI with the specified theme (light or dark). If not specified, uses the default
--use-textbox-seedUse textbox for seeds in UI (no up/down, but possible to input long seeds)
--disable-safe-unpickleDisable checking PyTorch models for malicious code
--ngrokngrok authtoken, alternative to gradio --share
--ngrok-regionThe region in which ngrok should start
--ngrok-optionsThe options to pass to ngrok in JSON format, e.g.: {"authtoken_from_env":true
--update-checkOn startup, notifies whether or not your web UI version (commit) is up-to-date with the current
--update-all-extensionsOn startup, it pulls the latest updates for all extensions you have installed
--reinstall-xformersForce-reinstall xformers. Useful for upgrading - but remove it after upgrading or you'll
--reinstall-torchForce-reinstall torch. Useful for upgrading - but remove it after upgrading or you'll reinstall
--testsRun test to validate web UI functionality, see wiki topic for more details
--no-testsDo not run tests even if --tests option is specified
--dump-sysinfolaunch.py argument: dump limited sysinfo file (without information about extensions, options)
--disable-all-extensionsdisable all extensions from running
--disable-extra-extensionsdisable all non-built-in extensions from running
--skip-load-model-at-startif load a model at web start, only take effect when --nowebui
--unix-filenames-sanitizationallow any symbols except '/' in filenames. May conflict with your browser and file system
--filenames-max-lengthmaximal length of filenames of saved images, longer filenames will be truncated. if overridden
--no-prompt-historydisable read prompt from last generation feature; disables --data-path/params.txt
--show-negative-promptNo longer has an effect
--deepdanbooruNo longer has an effect
--unload-gfpganNo longer has an effect
--gradio-img2img-toolNo longer has an effect
--gradio-inpaint-toolNo longer has an effect
--gradio-queueNo longer has an effect
--add-stop-routeNo longer has an effect
--always-batch-cond-uncondNo longer has an effect, move into UI under Setting > Optimizations
--max-batch-countNo longer has an effect. moved to ui-config.json txt2img/Batch count/maximum img2img/Batch
📄 View Printable Cheat Sheet — Download as PDF or print · 🧩 Combine with other tools

Related Shortcut Pages

ComfyUI Midjourney Ollama Docker Git Jupyter Notebook

Search 13,500+ shortcuts across 269 platforms

Explore All Platforms Practice Shortcuts

🤖 Ask AI about Stable Diffusion shortcuts

Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"

ChatGPT Claude Perplexity Gemini Grok
📜 Every shortcut on this page is taken from the official Stable Diffusion documentation — github.com
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.