Cart

    Sorry, we could not find any results for your search querry.

    Generating images in Open WebUI chat sessions

    Open WebUI offers additional tools besides regular chats, such as image generation and its own Workspace. In this supplementary manual, we show you how to generate images and how to use the five Workspace tabs to centrally manage models, knowledge, prompts, skills, and tools.


     

    Generating images in Open WebUI

     

    Open WebUI can not only generate text but also create and edit images. To do this, an administrator must first configure an image provider. Only then can users send a prompt from a chat that allows Open WebUI to generate an image.

    In the Open WebUI admin settings, multiple image engines are offered by default, including Default (Open AI), ComfyUI, Automatic1111, and Gemini.

     

     

    Step 1

    As administrator, open the user menu at the bottom left and click on ‘Admin Panel’.


     

    Step 2

    1. Open the ‘Settings’ tab and click on ‘Images’ on the left. 
    2. Then enable the ‘Image Generation’ option at the top. Without this setting, image generation remains disabled for the entire environment.
    3. Under ‘Create Image’, select which engine you want to use and then enter the requested information. For an OpenAI-compatible endpoint, these are, for example:
      1. Image Generation Engine: for example Default (Open AI).
      2. OpenAI API Base URL: for example https://api.openai.com/v1 or the address of your own OpenAI-compatible endpoint.
      3. OpenAI API Key: your provider's API key.
      4. OpenAI API Version: only if your provider requires this.
      5. Additional Parameters: optional, for additional JSON settings.

        Note: If you are using ComfyUI or Automatic1111, refer here to the address of that image server instead of an OpenAI-compatible endpoint. These options are currently outside the scope of this manual.
         
    4. Click on ‘Save’ to save the settings.

     

    Step 3

    Now open ‘Workspace’ > ‘Models’ and, if desired, create your own model preset via ‘New Model’, or edit an existing model. Under ‘Base Model (From)’, select the language model that handles the chat and then enable the ‘Image Generation’ option under ‘Capabilities’.

    If you want this model to work with image generation by default, also enable ‘Image Generation’ under ‘Default Features’.

     

    The model preset in Open WebUI does not determine which image model is used in the background. Here, you mainly link which chat agent gets access to the image tool and which extra knowledge, prompts, skills, and tools are active by default.

     

     

    Step 6

    Start a new chat and select the model or model preset that is allowed to use image generation. Then indicate in natural language what you want to have made, for example:

    Generate a realistic product photo of a blue water bottle on a white background.

    In modern configurations with native tool calling, the model then automatically calls the image tool. So you simply use a normal prompt and click on ‘Send’.


     

    Step 7

    Do you want to have an existing image modified? Then first enable ‘Image Edit’ under ‘Edit Image’ and configure the correct engine there as well. After that, upload an image in a chat and describe which change you want to have performed.


     

    Local image generation with ComfyUI in Ubuntu

     

    If you do not want to use an external image provider, you can connect Open WebUI to a local ComfyUI server. In this setup, ComfyUI handles the actual image generation.

    This setup works with both a GPU and a CPU-only server. If you do not have a GPU, you can run ComfyUI in CPU mode. Do keep in mind that with CPU this can take a very long time (256x256 pixels takes +/- 20 minutes with the described settings). 

     

     

    Step 1

    First, install the basic components on your Ubuntu 24.04 server and download ComfyUI.

    sudo apt -y update
    sudo apt install -y git python3-venv python3-pip
    
    cd /opt
    sudo git clone https://github.com/Comfy-Org/ComfyUI.git
    sudo chown -R $USER:$USER /opt/ComfyUI
    
    cd /opt/ComfyUI
    python3 -m venv .venv
    source .venv/bin/activate
    pip install --upgrade pip

     

    Step 2

    Next, install the correct PyTorch installation for your server (PyTorch is an open-source machine learning framework):

    CPU-only server (no GPU):

    BladeVPS, PerformanceVPS and the regular VPS come without a GPU.

    pip install torch torchvision
    pip install -r requirements.txt

    Server with GPU:
    Install the PyTorch build that matches your hardware (for example, CUDA or ROCm). To do this, simply use the table on this page. Copy and paste the command that the table shows you onto your server. Then install the remaining ComfyUI dependencies:

    pip install -r requirements.txt

     

    Step 3

    Download a checkpoint for ComfyUI. Within ComfyUI, a checkpoint is the base model used to generate images. 

    Below, we show an example of a lighter checkpoint for CPU-only, a heavier one for GPU, and how to optionally download a Lora on top of that (a Lora adjusts the style of generated images). 

    CPU-only checkpoint

    For a simple CPU-only setup, you can start with one basic checkpoint and put it in models/checkpoints/:

    cd /opt/ComfyUI/models/checkpoints
    
    curl -L -o v2-1_512-ema-pruned.safetensors\ 
    https://huggingface.co/sd2-community/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.safetensors
     
     

    GPU checkpoint

    cd /opt/ComfyUI/models/checkpoints
    
    curl -L -o sd_xl_base_1.0.safetensors \ 
    https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
     
     

    Downloading Lora

    If you are using a workflow that also supports LoRA, place that file in models/loras/:

    cd /opt/ComfyUI/models/loras
    
    curl -L -o sd_xl_offset_example-lora_1.0.safetensors \
    https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_offset_example-lora_1.0.safetensors

    A LoRA does not replace the main model, but works as a supplement on top of a compatible checkpoint.

     

     
     

     

    Step 4

    Create a systemd service for ComfyUI which starts automatically. This way, your image server remains available, also after a reboot.

    In both examples, replace User=ubuntu with the Linux user under which you'll be using ComfyUI.

    CPU-only server:

    sudo tee /etc/systemd/system/comfyui.service > /dev/null <<'EOF'
    [Unit]
    Description=ComfyUI
    After=network.target
    
    [Service]
    Type=simple
    User=ubuntu
    WorkingDirectory=/opt/ComfyUI
    ExecStart=/opt/ComfyUI/.venv/bin/python /opt/ComfyUI/main.py --listen 0.0.0.0 --cpu --preview-method none
    Restart=always
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
    EOF
     
     

    GPU-server

    sudo tee /etc/systemd/system/comfyui.service > /dev/null <<'EOF'
    [Unit]
    Description=ComfyUI
    After=network.target
    
    [Service]
    Type=simple
    User=ubuntu
    WorkingDirectory=/opt/ComfyUI
    ExecStart=/opt/ComfyUI/.venv/bin/python /opt/ComfyUI/main.py --listen 0.0.0.0
    Restart=always
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
    EOF
     
     

    Then activate the service:

    sudo systemctl daemon-reload
    sudo systemctl enable --now comfyui

     

    Step 5

    Open port 8188/tcp in your firewall (UFW at our Open WebUI installation):

    sudo ufw allow 8188/tcp

    After starting, ComfyUI is usually accessible at:

    http://<your-server-ip>:8188

     

    Step 6

    If Open WebUI is running in Docker (recommended) on the same server as ComfyUI, ensure that the container can reach the server via host.docker.internal. On Linux, you explicitly add a host-gateway mapping for this purpose.

    Docker Compose

    If you are using Docker Compose (this is the case for our Open WebUI installation), then add at least this to the Open WebUI service:

    extra_hosts:
    
    - "host.docker.internal:host-gateway"
    environment:
    - ENABLE_IMAGE_GENERATION=True
    - COMFYUI_BASE_URL=http://host.docker.internal:8188/
     
     

    Docker run

    If you use docker run, the command will look like this:

    docker run -d -p 3000:8080 \ 
    --add-host=host.docker.internal:host-gateway \ 
    -e ENABLE_IMAGE_GENERATION=True \ 
    -e COMFYUI_BASE_URL=http://host.docker.internal:8188/ \ 
    -v open-webui:/app/backend/data \ 
    --name open-webui \
    --restart always \
    ghcr.io/open-webui/open-webui:main
     
     

    If Open WebUI is not running in Docker but directly on the same server, you can usually just use http://127.0.0.1:8188/ or the local server address.


     

    Step 7

    Now enable ComfyUI for use with Open WebUI. Click on the icon with the letters of your first and last name in the bottom left and select ‘Admin Panel’.


     

    Step 8

    Are you using a VPS without a GPU? Then generating a 512x512 pixel image with 20 steps will easily take about 5 minutes (excluding the time your LLM needs to process the instruction and generate response text for the image). 

     

    Next, open the ‘Settings’ tab (1) at the top and click on ‘Images’ (2) in the left menu.

    3. Image Generation: Enable to generate images.
    4. Image Generation Engine: Select ComfyUI and click the reload icon next to ‘ComfyUI Base URL’ (5) to test the connection.
    6. Model: Click once with the left mouse button to see the available models and select the name of the checkpoint you downloaded earlier.
    7. Image Size: Adjust the maximum resolution as desired. 
    8. Steps: Adjust the number of steps as desired. 50 is a good guideline for servers with a GPU, between 10-20 steps for a server without a GPU. In general, the more steps, the more accurate the image and the longer the model needs to achieve it.
    9. ComfyUI Workflow: With ComfyUI, you create workflows in which you define how images (or videos/music) are generated. For the scope of this manual, we will assume a simple workflow for generating images. Copy the code in the element below, then click on ‘Edit’ (9) and paste the copied code over the existing code. Then close the window. 

    ComfyUI Workflow code

    Are you using a checkpoint other than v2-1_512-ema-pruned.safetensors? Then adjust the name in the code, or expand the available options as follows:

        "inputs": {
          "ckpt_name": "v2-1_256-ema-pruned.safetensors",
          "ckpt_name": "v2-1_512-ema-pruned.safetensors",
          "ckpt_name": "v2-1_1024-ema-pruned.safetensors"
        },
     
    {
      "3": {
        "inputs": {
          "seed": 0,
          "steps": 12,
          "cfg": 8,
          "sampler_name": "euler",
          "scheduler": "normal",
          "denoise": 1,
          "model": [
            "4",
            0
          ],
          "positive": [
            "6",
            0
          ],
          "negative": [
            "7",
            0
          ],
          "latent_image": [
            "5",
            0
          ]
        },
        "class_type": "KSampler",
        "_meta": {
          "title": "KSampler"
        }
      },
      "4": {
        "inputs": {
          "ckpt_name": "v2-1_512-ema-pruned.safetensors"
        },
        "class_type": "CheckpointLoaderSimple",
        "_meta": {
          "title": "Load Checkpoint"
        }
      },
      "5": {
        "inputs": {
          "width": 256,
          "height": 256,
          "batch_size": 1
        },
        "class_type": "EmptyLatentImage",
        "_meta": {
          "title": "Empty Latent Image"
        }
      },
      "6": {
        "inputs": {
          "text": "Prompt",
          "clip": [
            "4",
            1
          ]
        },
        "class_type": "CLIPTextEncode",
        "_meta": {
          "title": "CLIP Text Encode (Prompt)"
        }
      },
      "7": {
        "inputs": {
          "text": "",
          "clip": [
            "4",
            1
          ]
        },
        "class_type": "CLIPTextEncode",
        "_meta": {
          "title": "CLIP Text Encode (Negative Prompt)"
        }
      },
      "8": {
        "inputs": {
          "samples": [
            "3",
            0
          ],
          "vae": [
            "4",
            2
          ]
        },
        "class_type": "VAEDecode",
        "_meta": {
          "title": "VAE Decode"
        }
      },
      "9": {
        "inputs": {
          "filename_prefix": "ComfyUI",
          "images": [
            "8",
            0
          ]
        },
        "class_type": "SaveImage",
        "_meta": {
          "title": "Save Image"
        }
      }
    }
     
     

    In steps 10 through 15, indicate in which node of the ComfyUI workflow added in step 9 various components are located.

    10. text: 6
    11. ckpt_name: 4
    12. width: 5
    13. height: 5
    14. steps: 3
    15. seed: 3
    16. Save: save the changes.


     

    Step 9

    Still, click on ‘Models’ in the ‘Settings’ tab in the left menu. Then click on the pencil icon next to the model to which you want to assign image generation capabilities.

    Scroll down and check the option 'Image Generation' under ‘Default Features’ and click on ‘Save & Update’.

    Repeat this step for every LLM for which you want to enable image generation. You can now use image generation in a chat session!


     

    Using ComfyUI outside the context of Open WebUI

     

    For this guide, we assume that you are using ComfyUI on a VPS without a desktop environment. In that case, you cannot open a browser on the VPS itself to manage ComfyUI. There is a relatively simple and secure way to still access the ComfyUI dashboard: by setting up an SSH tunnel. You can easily do this from the terminal/powershell/WSL on your own computer or laptop with a single command:

    ssh -N -L 8188:127.0.0.1:8188 -p 12345 username@123.123.123.123

    Replace in this command:

    • 12345 with the port number you use for SSH connections. Did you not change the port number? Then use -p 22 (or leave it out).
    • username with the username you are connected to your VPS with.
    • 123.123.123.123 by the IP address or a (sub)domain name pointing to your VPS (e.g. claw.voorbeeld.nl). 

    Open your browser on the computer/laptop where you set up the SSH tunnel and go to 127.0.0.1:8188 in your browser. You will now end up in the ComfyUI dashboard.


     

    Problems with local image generation via ComfyUI

     

    • Open WebUI cannot reach ComfyUI: check if ComfyUI is running with --listen 0.0.0.0 and if port 8188 is reachable.
    • Base URL test fails in Docker: check if your Open WebUI container is started with --add-host=host.docker.internal:host-gateway or the equivalent Compose setting.
    • CPU-only generation takes a very long time: that is normal in --cpu mode. Lower the resolution, use fewer steps, and start with a simple workflow.
    • You are getting a workflow error or JSON error: re-export the workflow via Export (API) and not via a regular save.
    • No image appears: check if the selected model is actually available in ComfyUI and if the workflow refers to the correct model name.
    • Image editing does not work: for image-to-image or inpainting, use a workflow that also expects image input; a pure text-to-image workflow is not sufficient for this.

    Need help?

    Receive personal support from our supporters

    Contact us