Setup guide

Provider setup guide

Browse setup steps and troubleshooting by tool.

Provider setup guide/Stable Diffusion WebUI Configuration

Stable Diffusion WebUI Configuration

Stable Diffusion WebUI is commonly used for local image generation. It is different from chat tools: you mainly configure the model files, sampler, size, steps, and prompts. If you want other tools to call it, you need to enable the API first.

Official information Downloads and documentation are subject to the official site.

Enable API

Configuration itemFilling Method
Startup parameters--api
Web addresshttp://127.0.0.1:7860
API documentationhttp://127.0.0.1:7860/docs
Text-to-image API/sdapi/v1/txt2img
WebUI interface reference This image is used to confirm the main interface layout. Whether the API is available depends on whether --api was added during startup and if /docs can be opened.
Screenshot from the official Stable Diffusion WebUI repository
  1. Install and start Stable Diffusion WebUI.
  2. If you want scripts to call it, add the following at startup --api.
  3. Open http://127.0.0.1:7860/docsand confirm that the API documentation can be opened.
  4. First generate an image successfully in the web interface, then test with the API.
  5. If errors occur, first check the model files, video memory, sampler name, and image size.

Understanding image generation parameters

SettingMeaningTips for beginners
promptPositive promptsWrite what you want to appear in the image
negative_promptNegative promptsWrite what you do not want to appear
stepsSampling stepsStart with 20 to 30 steps, do not set it too high initially
width / heightImage SizeStart with 512 or 768 level, lower it if VRAM is insufficient
sampler_nameSamplerStart with the default or the sampler that works on the web

API Example

Minimum request for text-to-image in SD WebUI
curl -X POST http://127.0.0.1:7860/sdapi/v1/txt2img \ -H "Content-Type: application/json" \ -d '{ "prompt": "a clean product photo of a white ceramic cup", "negative_prompt": "blurry, low quality", "steps": 20, "width": 512, "height": 512 }'

Common Questions for Beginners

PhenomenonPriority checkHandle
/docs Cannot openWhether it was added at startup --apiRestart WebUI and make sure there are no errors in the console
Images work on the web, but not through the APIIs the API address /sdapi/v1/txt2imgTest with the minimum request first, do not add too many parameters at once
Sampler errorDoes sampler_name existTry not filling in sampler_name, or use the sampler that currently works on the web
Insufficient video memoryWidth, height, steps, batch quantityStart with 512x512, 20 steps, then gradually increase