Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't create images with the API/API Docs Outdated #6918

Open
1 task done
ghost opened this issue Jan 19, 2023 · 12 comments
Open
1 task done

[Bug]: Can't create images with the API/API Docs Outdated #6918

ghost opened this issue Jan 19, 2023 · 12 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@ghost
Copy link

ghost commented Jan 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

I was experimenting with the api by following the api wiki at https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API. I tried making a post request to the gradio server but kept responding with 404 (I had the api flag enabled). I also checked the docs on the site itself ([url]/docs) and couldn't find any documentation regarding the sdapi endpoint used for generating a new image via the api.

Steps to reproduce the problem

  1. Start the webui with the api flag
  2. Attempt to send a post request to [link]/sdapi/v1/txt2img

What should have happened?

It should generate an image and respond with that.

Commit where the problem happens

26a6a78

What platforms do you use to access UI ?

Other/Cloud

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

api, share and gradio-debug

Additional information, context and logs

I used thunder client on visual studio code to send the request.

@ghost ghost added the bug-report Report of a bug, yet to be confirmed label Jan 19, 2023
@sing817
Copy link

sing817 commented Jan 19, 2023

try it in CMD
curl -X POST [link]/sdapi/v1/txt2img -d "{"prompt": "dog","steps": "5"}" -H "Content-Type: application/json"

@Straafe
Copy link

Straafe commented Jan 20, 2023

For some reason it seems like the API has completely changed since earlier this week? "/sdapi/v1/txt2img" no longer exists at all in the included api docs in latest version.

@Straafe
Copy link

Straafe commented Jan 20, 2023

In this image you can see how the api docs looked a few days ago vs today: https://i.imgur.com/5H7InyR.png

Looks like most of the main api calls are no longer in there, including /sdapi/v1/txt2img

@ghost
Copy link
Author

ghost commented Jan 21, 2023

try it in CMD
curl -X POST [link]/sdapi/v1/txt2img -d "{"prompt": "dog","steps": "5"}" -H "Content-Type: application/json"
Getting the same error, {"detail":"Not Found"}

@ghost
Copy link
Author

ghost commented Jan 22, 2023

In this image you can see how the api docs looked a few days ago vs today: https://i.imgur.com/5H7InyR.png

Looks like most of the main api calls are no longer in there, including /sdapi/v1/txt2img

Oh, so I just revert to a version with the sdapi?

@Straafe
Copy link

Straafe commented Jan 22, 2023

Oh, so I just revert to a version with the sdapi?
@default-box

I am using commit 82725f0 and api works as expected, I haven't checked if it has been updated since my last comment but commit 82725f0 's API works normally.

@DragoNext
Copy link

DragoNext commented Jan 24, 2023

I had the same issue it only appeared when using "--gradio-debug" when i switched to "--gradio-auth user:password" the /sdapi/ appears normally, i'm using latest commit 82725f0

@snusnumrik
Copy link

snusnumrik commented Jan 26, 2023

adding --nowebui allows me to use api but does not allow me to use webui at the same time

@sigeisment
Copy link

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API

@Sieboldianus
Copy link

Sieboldianus commented Sep 8, 2023

/sdapi/v1/txt2img

I have the same issue on 1.6.0 - most api calls are not listed in the FastAPI /docs. This is how the API /docs look:
api

@Straafe
Copy link

Straafe commented Sep 8, 2023

The issue I was having I believe was caused by a bad extension. You could try starting it up without any extensions to see if the API's come back.

@Sieboldianus
Copy link

Sieboldianus commented Sep 11, 2023

I tested, removed all extensions, but still, no /sdapi in API docs:

The logs look good, no error report:

Python 3.10.6 (main, Oct  7 2022, 20:19:58) [GCC 11.2.0]
Version: v1.6.0
...
Launching API server with arguments: --xformers --api
Loading weights [89c108e712] from ...
Startup time: 21.1s (prepare environment: 4.5s, import torch: 7.2s, import gradio: 2.1s, setup paths: 3.3s, initialize shared: 0.4s, other imports: 1.7s, setup codeformer: 0.4s, load scripts: 1.0s, lora_script.py: 0.6s).
INFO:     Started server process [44784]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:7861 (Press CTRL+C to quit)

[edit]

Solved. I had to use --nowebui (COMMANDLINE_ARGS="--xformers --api --nowebui") and further switch from port 7860 to 7861! Now it looks good:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

6 participants