> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/stable-diffusion-webui.md).

# Stable Diffusion WebUI

Die beliebteste Weboberfläche für Stable Diffusion auf CLORE.AI-GPUs.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace).
{% endhint %}

## Serveranforderungen

| Parameter | Minimum       | Empfohlen |
| --------- | ------------- | --------- |
| RAM       | 16GB          | 32GB+     |
| VRAM      | 8GB           | 12GB+     |
| Netzwerk  | 500Mbps       | 1Gbps+    |
| Startzeit | 10–20 Minuten | -         |

{% hint style="warning" %}
**Startzeit:** Beim ersten Start werden Python-Abhängigkeiten installiert und das Basismodell heruntergeladen (10–20 Minuten, abhängig von der Netzwerkgeschwindigkeit). HTTP 502 während dieser Zeit ist normal.
{% endhint %}

## Warum SD WebUI?

* **Funktional reich** - txt2img, img2img, Inpainting, Outpainting
* **Erweiterungen** - Großes Ökosystem von Plugins
* **Benutzerfreundlich** - Intuitive Weboberfläche
* **Gut dokumentiert** - Große Community-Unterstützung

> 📚 Siehe auch: [Wie man Stable Diffusion auf einer Cloud-GPU betreibt](https://blog.clore.ai/how-to-run-stable-diffusion-cloud-gpu/)

## Schnelle Bereitstellung auf CLORE.AI

**Docker-Image:**

```
universonic/stable-diffusion-webui:latest
```

**Ports:**

```
22/tcp
8080/http
```

**Befehl:**

```bash
./webui.sh --listen --xformers
```

### Überprüfen, ob es funktioniert

Nach der Bereitstellung finden Sie Ihre `http_pub` URL in **Meine Bestellungen**:

```bash
# Prüfen, ob die UI erreichbar ist (kann beim ersten Start 10–20 Min dauern)
curl https://your-http-pub.clorecloud.net/
```

{% hint style="info" %}
Wenn Sie länger als 20 Minuten HTTP 502 erhalten, prüfen Sie:

1. Server hat 16GB+ RAM
2. Server hat 8GB+ VRAM
3. Netzwerkgeschwindigkeit ist ausreichend zum Herunterladen von Abhängigkeiten
   {% endhint %}

## Zugriff auf Ihren Dienst

Bei Bereitstellung auf CLORE.AI greifen Sie auf SD WebUI über die `http_pub` URL:

* **Web-UI:** `https://your-http-pub.clorecloud.net/`
* **API (falls aktiviert):** `https://your-http-pub.clorecloud.net/sdapi/v1/`

{% hint style="info" %}
Alle `localhost:7860` Die folgenden Beispiele funktionieren, wenn über SSH verbunden. Für externen Zugriff ersetzen Sie durch Ihre `https://your-http-pub.clorecloud.net/` URL.
{% endhint %}

## Installation

### Verwendung von Docker (empfohlen)

```bash
docker run -d --gpus all \
    -p 8080:8080 \
    -v sd-webui-data:/app/stable-diffusion-webui \
    universonic/stable-diffusion-webui:latest
```

### Manuelle Installation

```bash
# Abhängigkeiten installieren
sudo apt install python3.10 python3.10-venv git wget

# Repository klonen
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# Ausführen (installiert automatisch alles)
./webui.sh --listen --xformers
```

## Verzeichnisstruktur

```
stable-diffusion-webui/
├── models/
│   ├── Stable-diffusion/   # Hauptmodelle (.safetensors)
│   ├── Lora/               # LoRA-Modelle
│   ├── VAE/                # VAE-Modelle
│   ├── ControlNet/         # ControlNet-Modelle
│   └── ESRGAN/             # Upscaler
├── embeddings/             # Textuelle Inversionen
├── extensions/             # Installierte Erweiterungen
├── outputs/                # Generierte Bilder
└── scripts/                # Eigene Skripte
```

## Modelle herunterladen

### Checkpoints

```bash
cd models/Stable-diffusion

# SD 1.5
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors

# SDXL
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors

# Realistic Vision (fotorealistisch)
wget "https://civitai.com/api/download/models/245598" -O realisticVision_v60B1.safetensors

# DreamShaper (künstlerisch)
wget "https://civitai.com/api/download/models/351306" -O dreamshaper_8.safetensors
```

### VAE (bessere Farben)

```bash
cd models/VAE

# SD 1.5 VAE
wget https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors

# SDXL VAE
wget https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors
```

## Grundlegende Verwendung

### txt2img (Text zu Bild)

1. Modell aus dem Dropdown auswählen
2. Positiven Prompt eingeben: was Sie möchten
3. Negativen Prompt eingeben: was vermieden werden soll
4. Abmessungen einstellen (512x512 für SD1.5, 1024x1024 für SDXL)
5. Auf Generieren klicken

### img2img (Bild zu Bild)

1. Zum Tab img2img gehen
2. Quellbild hochladen
3. Prompt eingeben, der die gewünschten Änderungen beschreibt
4. Anpassen **Rauschreduktionsstärke** (0.3-0.8)
5. Generieren

### Inpainting

1. Zu img2img → Inpaint gehen
2. Bild hochladen
3. Maske über den zu ändernden Bereich zeichnen
4. Prompt für den maskierten Bereich eingeben
5. Generieren

## Wesentliche Einstellungen

### Generierungseinstellungen

| Einstellung | SD 1.5          | SDXL            |
| ----------- | --------------- | --------------- |
| Breite      | 512             | 1024            |
| Höhe        | 512             | 1024            |
| Schritte    | 20-30           | 20-40           |
| CFG-Skala   | 7               | 5-7             |
| Sampler     | DPM++ 2M Karras | DPM++ 2M Karras |

### Kommandozeilenargumente

```bash
./webui.sh \
    --listen \              # Externen Zugriff erlauben
    --port 7860 \           # Portnummer
    --xformers \            # Speicheroptimierung
    --enable-insecure-extension-access \  # Erweiterungen erlauben
    --api \                 # API aktivieren
    --no-half-vae           # Schwarze Bilder beheben
```

### Für wenig VRAM

```bash
./webui.sh \
    --listen \
    --medvram \           # 6–8GB VRAM
    # oder
    --lowvram \           # 4GB VRAM
    --xformers
```

## Beliebte Erweiterungen

### Must-Have

| Erweiterung               | Zweck                                |
| ------------------------- | ------------------------------------ |
| ControlNet                | Geleitete Generierung                |
| ADetailer                 | Automatische Gesichts-/Handkorrektur |
| Ultimate SD Upscale       | Besseres Upscaling                   |
| sd-webui-segment-anything | Segmentierung                        |
| Regional Prompter         | Mehrregionen-Prompts                 |

### Erweiterungen installieren

1. Gehe zu **Erweiterungen** Tab
2. Klicken **Verfügbar**
3. Klicken **Laden von**
4. Suchen und installieren
5. Anwenden und UI neu starten

Oder manuell:

```bash
cd extensions
git clone https://github.com/Mikubill/sd-webui-controlnet.git
```

## ControlNet

### Installation

```bash
# Erweiterung installieren
cd extensions
git clone https://github.com/Mikubill/sd-webui-controlnet.git

# Modelle herunterladen
cd ../models/ControlNet
wget https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth
wget https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose.pth
wget https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth.pth
```

### Verwendung

1. ControlNet-Bereich erweitern
2. Kontrollbild hochladen
3. Preprocessor auswählen (Canny, OpenPose, etc.)
4. Modell auswählen, das zum Preprocessor passt
5. Generieren

## API-Verwendung

Mit `--api` Flag aktivieren, dann:

```python
import requests
import base64

# Für externen Zugang verwenden Sie Ihre http_pub-URL:
API_URL = "https://your-http-pub.clorecloud.net"
# Oder über SSH: API_URL = "http://localhost:7860"

def txt2img(prompt, negative="", steps=20, width=512, height=512):
    response = requests.post(
        f"{API_URL}/sdapi/v1/txt2img",
        json={
            "prompt": prompt,
            "negative_prompt": negative,
            "steps": steps,
            "width": width,
            "height": height,
        }
    )
    return base64.b64decode(response.json()["images"][0])

# Generieren und speichern
image_data = txt2img("A beautiful sunset over mountains")
with open("output.png", "wb") as f:
    f.write(image_data)
```

### img2img API

```python
import base64

def img2img(prompt, image_path, denoising=0.5):
    with open(image_path, "rb") as f:
        image_b64 = base64.b64encode(f.read()).decode()

    response = requests.post(
        f"{API_URL}/sdapi/v1/img2img",
        json={
            "prompt": prompt,
            "init_images": [image_b64],
            "denoising_strength": denoising,
            "steps": 30,
        }
    )
    return base64.b64decode(response.json()["images"][0])
```

## Prompt-Schreiben

### Grundstruktur

```
[Subjekt], [Stil], [Details], [Beleuchtung], [Qualitäts-Tags]
```

### Beispiel-Prompts

```
# Porträt
Porträt einer jungen Frau, professionelle Fotografie,
weiche Beleuchtung, geringe Schärfentiefe, 8k uhd,
sehr detailliert, fotorealistisch

# Landschaft
majestätische Berglandschaft bei Sonnenuntergang, dramatische Wolken,
Goldstunde-Beleuchtung, National-Geographic-Stil,
8k Wallpaper, sehr detailliert

# Anime
1girl, silbernes Haar, blaue Augen, Schuluniform,
Kirschblüten, Frühling, Meisterwerk, beste Qualität
```

### Negative Prompts

```
# Allgemein
niedrige Auflösung, schlechte Anatomie, schlechte Hände, Text, Fehler,
fehlende Finger, abgeschnitten, schlechteste Qualität, niedrige Qualität,
JPEG-Artefakte, Signatur, Wasserzeichen, unscharf

# Für fotorealistisch
Cartoon, Anime, Illustration, Gemälde, Zeichnung,
3D-Render, CGI
```

## Leistungstipps

1. **xFormers aktivieren** - Deutlicher Geschwindigkeitsschub
2. **VAE verwenden** - Bessere Farben
3. **Batch-Größe 1** - Für begrenzten VRAM
4. **Hires-Fix** - Klein generieren und dann hochskalieren
5. **ADetailer** - Automatische Gesichtsreparatur

## GPU-Anforderungen

| Modell         | Minimales VRAM | Empfohlenes VRAM | Min. RAM |
| -------------- | -------------- | ---------------- | -------- |
| SD 1.5         | 4GB            | 8GB              | 16GB     |
| SD 2.1         | 6GB            | 8GB              | 16GB     |
| SDXL           | 8GB            | 12GB             | 16GB     |
| Mit ControlNet | +2GB           | +4GB             | 16GB     |

## GPU-Voreinstellungen

### RTX 3060 12GB (Budget)

```bash
# Startbefehl
./webui.sh --medvram --xformers

# Empfohlene settings.json:
# - SD 1.5: 512x512, Batch 4, 20–30 Schritte
# - SDXL: 768x768, Batch 1, 20 Schritte
# - VAE-Tiling in den Einstellungen aktivieren
# - ADetailer für Gesichter verwenden
```

**Beste Modelle:** SD 1.5, DreamShaper, RealisticVision

### RTX 3090 24GB (Optimal)

```bash
# Startbefehl
./webui.sh --xformers

# Empfohlene Einstellungen:
# - SD 1.5: 512x512, Batch 8, 30 Schritte
# - SDXL: 1024x1024, Batch 2, 30 Schritte
# - ControlNet + SD 1.5 funktioniert hervorragend
# - Hires-Fix bis 2x funktioniert
```

**Beste Modelle:** SDXL, Juggernaut, RealVisXL

### RTX 4090 24GB (Performance)

```bash
# Startbefehl
./webui.sh --xformers --opt-sdp-attention

# Empfohlene Einstellungen:
# - SD 1.5: 512x512, Batch 16, 30 Schritte
# - SDXL: 1024x1024, Batch 4, 40 Schritte
# - Mehrere ControlNets gleichzeitig
# - Hires-Fix bis 4x
```

**Beste Modelle:** SDXL, Pony Diffusion, Jedes hochauflösendes Modell

### A100 40GB/80GB (Produktion)

```bash
# Startbefehl
./webui.sh --opt-sdp-attention --no-half-vae

# Empfohlene Einstellungen:
# - SDXL: 1024x1024, Batch 8+, 50 Schritte
# - Mehrere ControlNet + IP-Adapter
# - Hires-Fix bis 4096x4096
# - AnimateDiff für Video
```

**Am besten für:** Batch-Generierung, komplexe Workflows, Video

## Kostenabschätzung

Typische CLORE.AI-Marktplatzpreise:

| GPU      | VRAM | Preis/Tag  | SD1.5-Geschwindigkeit | SDXL-Geschwindigkeit |
| -------- | ---- | ---------- | --------------------- | -------------------- |
| RTX 3060 | 12GB | $0.15–0.30 | \~4 Sek               | \~12 Sek             |
| RTX 3090 | 24GB | $0.30–1.00 | \~2 Sek               | \~6 Sek              |
| RTX 4090 | 24GB | $0.50–2.00 | \~1 Sek               | \~3 Sek              |
| A100     | 40GB | $1.50–3.00 | \~0.5 Sek             | \~2 Sek              |

*Preise in USD/Tag. Die Tarife variieren je nach Anbieter — prüfen Sie* [*CLORE.AI Marketplace*](https://clore.ai/marketplace) *für aktuelle Preise.*

## Fehlerbehebung

### HTTP 502 über lange Zeit

1. **RAM prüfen:** Server muss 16GB+ RAM haben
2. **VRAM prüfen:** Für SDXL werden mindestens 8GB benötigt
3. **Abhängigkeiten werden installiert:** Erster Start dauert 10–20 Min
4. **Langsames Netzwerk:** Geringe Bandbreite verursacht längeren Start

### Schwarze Bilder

```bash
# Zum Start-Argument hinzufügen
--no-half-vae
```

### Speicher erschöpft

```bash
# Optimierung verwenden
--medvram
--xformers
```

### Erweiterungen laden nicht

```bash
--enable-insecure-extension-access
```

### Langsame Generierung

1. xFormers aktivieren
2. Bildgröße reduzieren
3. Schritte verringern (20 ist oft ausreichend)

## Nächste Schritte

* [ComfyUI](/guides/guides_v2-de/bildgenerierung/comfyui.md) - Fortgeschrittene Workflows
* [FLUX.1](/guides/guides_v2-de/bildgenerierung/flux.md) - Aktuellstes Modell
* [ControlNet](/guides/guides_v2-de/bildverarbeitung/controlnet-advanced.md) - Geleitete Generierung
* [LoRA-Training](/guides/guides_v2-de/training/kohya-training.md) - Eigene Modelle


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/bildgenerierung/stable-diffusion-webui.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
