Complete Guide to AUTOMATIC1111 Configuration Command Line Arguments

All startup parameters for the AUTOMATIC1111 Stable Diffusion WebUI are defined in modules/cmd_args.py, parsed by launch.py via argparse, and stored in a global opts namespace that drives the application behavior from model loading to network security.

The AUTOMATIC1111/stable-diffusion-webui repository exposes over one hundred command line flags that allow granular control over hardware utilization, server deployment, and feature availability without editing configuration files. These arguments are processed immediately upon execution to set up the Python environment, configure PyTorch device settings, and initialize the Gradio web interface.

Where Arguments Are Defined and Parsed

The central registry for all command line options resides in modules/cmd_args.py. At line 6, the script instantiates an argparse.ArgumentParser, and each subsequent line calls parser.add_argument() to register flags, types, and help text.

When you execute python launch.py, the entry point imports this parser and invokes opts = parser.parse_args() (see launch.py). The resulting opts object becomes the authoritative configuration source consumed throughout the codebase. For example, modules/shared_options.py holds this parsed state globally, while modules/devices.py applies VRAM-related flags to torch device selection.

Installation and Environment Control

These flags manage Python package installation, CUDA detection, and startup routines:

  • --skip-prepare-environment – Bypasses all environment setup steps in modules/install.py.
  • --skip-install – Skips package installation checks entirely.
  • --skip-python-version-check – Suppresses the Python version compatibility validation.
  • --skip-torch-cuda-test – Bypasses the CUDA availability test at startup.
  • --reinstall-torch – Forces a fresh install of the torch library.
  • --reinstall-xformers – Forces a fresh install of the xformers library.
  • --update-check – Queries the repository for new WebUI releases on launch.
  • --update-all-extensions – Downloads updates for all installed extensions at startup.
  • --loglevel – Sets the logging verbosity; accepts CRITICAL, ERROR, WARNING, INFO, or DEBUG.
  • --dump-sysinfo – Writes a limited system information file to disk and exits immediately.

VRAM and Performance Optimization

Hardware-specific tuning options control how models are loaded and executed on GPU or CPU:

  • --medvram – Enables modest VRAM-saving optimizations suitable for GPUs with limited memory.
  • --medvram-sdxl – Applies VRAM optimizations only when loading SDXL models.
  • --lowvram – Activates aggressive VRAM-saving measures that trade speed for memory efficiency.
  • --lowram – Loads checkpoint weights directly into VRAM instead of system RAM.
  • --no-half – Disables 16-bit floating point model weights, forcing full precision.
  • --no-half-vae – Keeps the VAE component in full precision while allowing other weights to use half precision.
  • --precision – Sets evaluation precision; choices are full, half, or autocast (default).
  • --upcast-sampling – Upcasts sampling operations for improved compatibility when using --no-half.
  • --disable-model-loading-ram-optimization – Disables the RAM-saving optimizations applied during model loading.
  • --use-cpu – Accepts a comma-separated list of modules (e.g., vae,txt2img) to force onto CPU execution.
  • --use-ipex – Enables the Intel XPU backend for Arc GPUs.

Attention Mechanism Optimizations

These flags select specific cross-attention implementations that significantly impact generation speed and memory usage:

  • --xformers – Enables the xformers library for optimized cross-attention computation.
  • --force-enable-xformers – Forces xformers initialization even if compatibility checks fail.
  • --xformers-flash-attention – Uses the Flash-Attention variant (SD 2.x only).
  • --opt-split-attention – Prefers the Doggettx split-attention optimization.
  • --opt-sub-quad-attention – Prefers sub-quadratic attention, configurable via chunk size parameters.
  • --sub-quad-q-chunk-size – Defines the query chunk size for sub-quadratic attention (integer).
  • --sub-quad-kv-chunk-size – Defines the key/value chunk size for sub-quadratic attention (integer).
  • --sub-quad-chunk-threshold – Sets the VRAM threshold percentage for triggering chunking.
  • --opt-split-attention-invokeai – Prefers the InvokeAI implementation of split-attention.
  • --opt-split-attention-v1 – Uses the legacy split-attention version.
  • --opt-sdp-attention – Prefers PyTorch 2.x scaled-dot-product attention.
  • --opt-sdp-no-mem-attention – Uses scaled-dot-product attention without memory optimization (deterministic).
  • --disable-opt-split-attention – Disables all split-attention optimizations.
  • --opt-channelslast – Switches to channels-last memory format for potential performance gains.

Web Server and Networking Configuration

Control the Gradio interface binding, public sharing, and transport layer security:

  • --listen – Binds the server to 0.0.0.0, making it accessible from other devices on the network.
  • --port – Overrides the default Gradio port (7860) with a custom integer.
  • --share – Generates a public Gradio URL via tunneling.
  • --ngrok – Provides an ngrok authtoken as an alternative sharing mechanism.
  • --ngrok-options – Accepts a JSON string of additional ngrok configuration parameters.
  • --ngrok-region – Specifies the ngrok region (currently has no effect).
  • --server-name – Sets the hostname advertised by the server.
  • --subpath – Configures a custom sub-path for deployment behind reverse proxies (e.g., /sd).
  • --cors-allow-origins – Comma-separated list of allowed CORS origins without spaces.
  • --cors-allow-origins-regex – Single regular expression pattern for allowed CORS origins.
  • --tls-keyfile – Path to the TLS private key file.
  • --tls-certfile – Path to the TLS certificate file.
  • --disable-tls-verify – Accepts self-signed certificates when TLS is enabled.
  • --gradio-queue – Uses Gradio's async queue (default behavior).
  • --no-gradio-queue – Switches to HTTP-only mode without WebSockets.
  • --timeout-keep-alive – Sets the Uvicorn keep-alive timeout in seconds (default 30).
  • --autolaunch – Opens the UI URL automatically in the system default browser.

Security and Authentication

Restrict access and control execution privileges:

  • --gradio-auth – Sets basic authentication in the format "user:pass"; supports comma-separated pairs for multiple users.
  • --gradio-auth-path – Path to a file containing authentication lines.
  • --api-auth – Sets basic authentication for the HTTP API endpoint specifically.
  • --api – Launches the REST API alongside the web interface.
  • --nowebui – Runs only the API server without the Gradio UI.
  • --enable-insecure-extension-access – Displays the Extensions tab regardless of other security flags.
  • --allow-code – Permits execution of custom scripts from within the UI.
  • --disable-safe-unpickle – Disables safety checks on loaded PyTorch models (security risk).
  • --administrator – Runs with elevated administrator rights.
  • -f – Allows the application to run as the root user (suppressed in the UI).

Extension and Model Management

Control which extensions load and how models are handled:

  • --disable-all-extensions – Prevents any extension from loading at startup.
  • --disable-extra-extensions – Loads only built-in extensions, ignoring user-installed ones.
  • --ckpt – Directly loads a specific checkpoint file path.
  • --ckpt-dir – Specifies the directory containing model checkpoints.
  • --vae-path – Loads a specific VAE checkpoint, disabling VAE selection in the UI.
  • --vae-dir – Directory containing VAE files.
  • --data-dir – Base directory for all user data (defaults to repository root).
  • --models-dir – Overrides the models location, ignoring --data-dir.
  • --no-download-sd-model – Prevents automatic download of the default SD 1.5 model.
  • --do-not-download-clip – Prevents automatic CLIP model download.
  • --no-hashing – Disables SHA-256 checkpoint hashing for faster model loading.

File Paths and Storage Configuration

Customize directories for auxiliary models and generated content:

  • --embeddings-dir – Path to textual inversion embeddings.
  • --hypernetwork-dir – Path to hypernetwork files.
  • --localizations-dir – Path to UI localization files.
  • --gfpgan-dir and --gfpgan-model – GFPGAN directory and specific model file.
  • --codeformer-models-path – Directory for CodeFormer models.
  • --esrgan-models-path – Directory for ESRGAN models.
  • --bsrgan-models-path – Directory for BSRGAN models.
  • --realesrgan-models-path – Directory for RealESRGAN models.
  • --dat-models-path – Directory for DAT models.
  • --clip-models-path – Directory for CLIP models.
  • --styles-file – One or more style definition files (wildcards supported).
  • --ui-config-file – Path to the UI configuration JSON.
  • --ui-settings-file – Path to the UI settings JSON.
  • --gradio-allowed-path – Adds extra paths to Gradio's allowed-files list.

UI Behavior and Debugging

Adjust interface elements and diagnostic output:

  • --theme – Forces the UI theme to light or dark.
  • --freeze-settings – Makes all settings read-only.
  • --freeze-settings-in-sections – Freezes specific UI sections (comma-separated list).
  • --freeze-specific-settings – Freezes particular settings by name.
  • --use-textbox-seed – Uses a text input instead of a spin-box for seed entry.
  • --no-progressbar-hiding – Keeps Gradio progress bars visible during generation.
  • --disable-console-progressbars – Suppresses progress bars in the console output.
  • --enable-console-prompts – Mirrors prompts to the console (legacy flag).
  • --log-startup – Emits a detailed log during startup sequence.
  • --ui-debug-mode – Skips model loading for rapid UI testing.
  • --test-server – Configures the server for automated testing environments.
  • --api-log – Logs every API request to the console.
  • --api-server-stop – Enables API endpoints for stopping, restarting, or killing the server.
  • --skip-load-model-at-start – Defers model loading when used with --nowebui.
  • --unix-filenames-sanitization – Allows any character except / in saved filenames.
  • --filenames-max-length – Sets the maximum character length for saved image filenames (default 128).
  • --no-prompt-history – Disables reading and writing of the prompt history file.
  • --disable-nan-check – Skips NaN checks in generated latents.

Practical Usage Examples

Run the UI with a public sharing link and aggressive VRAM optimization for low-end GPUs:

python launch.py --share --lowvram

Start a headless API server with basic authentication on port 8000, accessible from any network interface:

python launch.py --nowebui --api --api-auth "admin:secret" --port 8000 --listen

Disable all third-party extensions and force the VAE and text-to-image modules to run on CPU while keeping the main model on GPU:

python launch.py --disable-all-extensions --use-cpu=vae,txt2img

Deploy behind a reverse proxy at the /sd/ sub-path with custom TLS certificates:

python launch.py --listen --subpath /sd --tls-keyfile /path/to/key.pem --tls-certfile /path/to/cert.pem

How Arguments Flow Through the Codebase

The parsed arguments from cmd_args.py propagate through specific modules to alter runtime behavior:

  • modules/devices.py – Reads --medvram, --lowvram, --precision, and --no-half to configure PyTorch device settings and memory management.
  • modules/extensions.py – Checks --disable-all-extensions and --disable-extra-extensions before loading extension scripts.
  • modules/ui.py – Applies --listen, --port, --share, and authentication flags when instantiating the Gradio server.
  • modules/model.py – Uses checkpoint-related paths and precision flags to load Stable Diffusion weights.

Summary

  • Central Definition: All command line arguments are registered in modules/cmd_args.py using Python's argparse library.
  • Entry Point: launch.py parses these arguments into a global opts object available throughout the application.
  • Hardware Tuning: Flags like --medvram, --lowvram, and --xformers directly influence PyTorch memory allocation and attention mechanisms.
  • Network Deployment: Use --listen, --port, --share, and --gradio-auth to configure remote access and security.
  • Extension Control: --disable-all-extensions and --disable-extra-extensions provide granular control over code execution from third-party extensions.

Frequently Asked Questions

Where are AUTOMATIC1111 command line arguments stored in the source code?

All arguments are defined in the modules/cmd_args.py file, where an argparse.ArgumentParser instance is configured with every available flag. The launch.py script imports this module and calls parser.parse_args() to process the command line input when you start the application.

How do I run AUTOMATIC1111 on a server with low VRAM?

Use the --lowvram flag for aggressive memory optimization, or --medvram for moderate savings with better speed. Combine with --xformers or --opt-sdp-attention to further reduce memory usage during cross-attention operations. For extremely constrained systems, add --use-cpu=vae to offload the VAE to system RAM.

Can I disable the web interface and run only the API?

Yes. Pass the --nowebui flag to suppress the Gradio interface and use --api to enable the REST API. You can specify --api-auth "user:pass" for authentication and --port to set a custom listening port. Use --skip-load-model-at-start to defer model initialization until the first API call.

What is the difference between --disable-all-extensions and --disable-extra-extensions?

--disable-all-extensions prevents any extension from loading, including built-in extensions that ship with the WebUI. --disable-extra-extensions loads only the built-in extensions while ignoring user-installed extensions from the extensions directory, providing a middle ground for troubleshooting.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →