stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Feature Request]: Expose available VAEs through the API
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What would your feature do ?
Add an API endpoint that returns a list of VAE names (and possibly hashes), so that people building an app with the Web UI as the backend can display to users which VAEs are available to choose from, removing the need to use the web interface and allowing greater automation.
Proposed workflow
The endpoint could act similarly to /sdapi/v1/sd-models
, where it would return an array containing one object per VAE, with its name and optionally hashes.
You'd then be able to supply either a name or hash as a POST request to /sdapi/v1/options
replacing the sd_vae
value to switch the VAE.
Additional information
No response
I think you can try the code below: option_payload = { "sd_vae": "vae-ft-mse-840000-ema-pruned.ckpt" } res = requests.post(f'{url}/sdapi/v1/options', json.dumps(option_payload), "application/json")
The issue is not setting the VAE, it's getting a list of which ones can be loaded by the server, there is no endpoint for that.
I want it too, now we just can got it in sd_vae.py - vae_dict
The response will likely be large but it is possible to retrieve the VAE list and more via the /config
endpoint. Look for where the elem_id
is setting_sd_vae
. There are no hashes because they're currently not computed for VAEs.
https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/10845