Reasons to use the API
1. Automated Processes. You can create a script that generates images while you do other things. The script can randomize parameters to achieve different results. Or the script could go through a list of prompts and generates images for each prompt.
2. Building a client app. Build and monetize an app that will generate images for other users.
Getting Started
When you start Automatic1111, make sure to include the --api
option. For example:
stable-diffusion-webui/webui.sh --listen --xformers --api
All endpoints are located at: /sdapi/v1/*
. For example, http://localhost:7860/sdapi/v1/txt2img
.
The official api spec can be seen by going to /docs
on your server, but it is very basic.