New Tool Radar

Local AI

How to Generate an Image in Text Generation WebUI with the sd_api_pictures Extension

Load the sd_api_pictures extension in Text Generation WebUI, point it at a running Automatic1111 Stable Diffusion WebUI, and get the chat bot to answer with a generated picture.

Schematic diagram with three steps: start Automatic1111 WebUI with the API flag, load TextGen in chat mode with the sd_api_pictures extension, and ask for a picture to get a generated image back.

Text Generation WebUI is a text chat app, but with the right extension the bot can answer you with a picture. The sd_api_pictures extension, version 1.2.0, connects TextGen to an Automatic1111 Stable Diffusion WebUI and lets you receive pictures generated by its API. This guide is about that extension; it is different from the text chat guides, the character card guide, and the extensions-install guide, which cover other parts of the app.

Start Automatic1111 with its API on

The extension does not generate images itself — it asks a separate Stable Diffusion WebUI to do it. You need an available instance of Automatic1111’s WebUI running with an --api flag. To run it locally in parallel on the same machine, specify a custom --listen-port for either Automatic1111’s or TextGen’s WebUI, so the two servers do not clash. Keep that WebUI running while you use the extension; without it, there is nothing to generate the picture.

Load TextGen with the sd_api_pictures extension

Load it in --chat mode with --extension sd_api_pictures, alongside send_pictures. The README says send_pictures is not really required, but it completes the picture. Once loaded, insert the Automatic1111 WebUI address in the extension’s address box and press Enter — that is the connection check. A green mark confirms the extension can communicate with the Automatic1111 API at that address; a red cross means something is not right and the extension will not work. The extension also manages VRAM by shuffling models, so the language model and the image model can share the graphics card.

Ask for a picture in chat

Image generation is triggered in three ways. Manually, through the “Force the picture response” button while in Manual or Immersive/Interactive mode. Automatically, in Immersive/Interactive mode, if the words “send”, “main”, “message”, or “me” are followed by “image”, “pic”, “picture”, “photo”, “snap”, “snapshot”, “selfie”, or “meme” in your prompt — so “send me an image” works. Or always on, in Picturebook/Adventure mode, unless you use “Suppress the picture response”. For a practice check, type “send me a picture of a lighthouse at sunset” and look for the picture in the bot’s reply. You can make settings stick by creating or modifying settings.json in the textgen root directory — the README’s example sets the VRAM management and keep-original-images options on and changes the prompt prefix and the sampler name to “DPM++ 2M Karras”.

Try it: four checks

Check What you should see If you do not see it
SD WebUI Automatic1111’s WebUI is running with the --api flag Start it with --api — the extension talks to its API, not to a closed app
Connected A green mark after you enter the WebUI address and press Enter A red cross means the address is wrong or the WebUI is not reachable — check both
Loaded TextGen is in --chat mode with --extension sd_api_pictures Add the extension flag when you launch TextGen — it is not loaded by default
Picture “send me an image” in Immersive/Interactive mode returns a picture Use the “Force the picture response” button, or switch to Picturebook/Adventure mode

Expected result. We checked the sd_api_pictures README for the version 1.2.0 description, loading with –chat mode and –extension sd_api_pictures alongside send_pictures, the Automatic1111 WebUI with –api prerequisite, the custom –listen-port note, the address-box connection check with its green mark and red cross, the three trigger modes with the exact trigger words, VRAM management, and the settings.json example with DPM++ 2M Karras; and the Image Generation Tutorial for the separate built-in Image AI page. We did not run Text Generation WebUI or generate any image.

Limits

This extension needs a second app: without a running Automatic1111 WebUI with its API on, it cannot generate anything. The README notes it has not been used with a notebook or cloud-hosted instance, so a local instance is the documented setup. Do not confuse this extension with the built-in Image AI page described in the project’s Image Generation Tutorial, which generates images with diffusers models such as Z-Image-Turbo inside the web UI itself and needs no separate Stable Diffusion WebUI — that is a separate feature with its own download and quantization steps. We did not run Text Generation WebUI, so no image here is a recorded result.

Sources

See all