# Stable Diffusion Web UI

The Stable Diffusion web UI piece in ZBrain Flow connects to your local or hosted Stable Diffusion interface, allowing you to generate AI images from text prompts. This action is ideal for workflows that involve visual generation, content automation, or creative experimentation.

### **How to use Stable Diffusion Web UI in ZBrain Flow** <a href="#how-to-use-stable-diffusion-web-ui-in-zbrain-flow" id="how-to-use-stable-diffusion-web-ui-in-zbrain-flow"></a>

#### **Select Stable Diffusion web UI as your connection** <a href="#select-stable-diffusion-web-ui-as-your-connection" id="select-stable-diffusion-web-ui-as-your-connection"></a>

* Click the '+' button in your Flow and search for Stable Diffusion Web UI.
* Select it and choose the action ‘Text to Image’.

#### **How to connect to your Stable Diffusion web UI** <a href="#how-to-connect-to-your-stable-diffusion-web-ui" id="how-to-connect-to-your-stable-diffusion-web-ui"></a>

Before using the Stable Diffusion web UI, you first need to connect to the UI. The steps involved in it are:

* From the ‘Connection’ dropdown, select ‘Create Connection.’
* A pop-up window appears where you need to do the following:
  * In the ‘Connection Name’ field, enter a label for your connection
  * In the ‘Stable Diffusion web UI API base URL’ field, provide your Web UI endpoint
  * Click ‘Save’ to create the connection.

#### **How to configure the text-to-image action** <a href="#how-to-configure-the-text-to-image-action" id="how-to-configure-the-text-to-image-action"></a>

1. In the ‘Prompt’ field, enter a text description of the image you want to generate.
2. In the ‘Model’ field, select the model to be used for image generation.
3. Under ‘Advanced parameters’, add any optional key-value pairs based on your model’s capabilities. This can include fields like:
   * ‘steps’
   * ‘cfg\_scale’
   * ‘width’ and ‘height’
   * ‘negative\_prompt’

Refer to your Web UI’s API documentation for valid parameter names and formats.


---

# Agent Instructions: 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.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/stable-diffusion-web-ui.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.
