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

API documentation #2110

Open
kanbekotori opened this issue Nov 30, 2023 · 9 comments
Open

API documentation #2110

kanbekotori opened this issue Nov 30, 2023 · 9 comments

Comments

@kanbekotori
Copy link

Where can I get the documentation for the comfyui api, like what are the urls and descriptions of the parameters and such.

@cornpip
Copy link

cornpip commented Nov 30, 2023

@DuckyBlender
Copy link

Is there going to be more documented API? Two file examples isn't an API documentation

@johnbenac
Copy link

Yes, I want to build a GUI using Vue, that grabs images created in input or output folders, and then lets the users call the API by filling out JSON templates that use the assets already in the comfyUI library.

Say, for example, you want to upscale an image, and you may want to use different models to do the upscale. The GUI would show you all the models that you can use, polled from the models folder, and it will also give you a gallery of images presented on the client on the client machine (What is the API endpoint that will enable this? Is there an API endpoint for this? Can I add one?) and then when the user selects an image on their client machine, it sends the path of that image where it lives on the server in the API call to the server.

What are the API endpoints that will enable this?

I know that there are api endpoint that give you the models. Even just a simple readme that points to the the file where the API endpoints are defined.

@johnbenac
Copy link

This file seems somewhat self explanatory:

[ComfyUI/web/scripts
/api.js](https://github.com/comfyanonymous/ComfyUI/blob/master/web/scripts/api.js)

@DuckyBlender
Copy link

DuckyBlender commented Apr 30, 2024

This file seems somewhat self explanatory:

[ComfyUI/web/scripts /api.js](https://github.com/comfyanonymous/ComfyUI/blob/master/web/scripts/api.js)

LLAMA 3 generated documentation based on this file:

Endpoints

GET Endpoints

/prompt

  • Returns the current status of the prompt queue
  • Response: JSON object with status information

/extensions

  • Returns a list of extension URLs to import
  • Response: JSON array of script URLs

/embeddings

  • Returns a list of embedding names
  • Response: JSON array of embedding names

/object_info

  • Returns node object definitions for the graph
  • Response: JSON object with node definitions

/queue

  • Returns the current state of the queue
  • Response: JSON object with running and pending items

/history

  • Returns the prompt execution history
  • Response: JSON object with history items

/system_stats

  • Returns system and device stats
  • Response: JSON object with system stats

/settings

  • Returns all setting values for the current user
  • Response: JSON object with setting values

/settings/:id

  • Returns a specific setting value for the current user
  • Response: JSON value of the setting

/userdata/:file

  • Returns a user data file for the current user
  • Response: File contents

POST Endpoints

/prompt

  • Queues a new prompt
  • Request Body: JSON object with prompt data
  • Response: JSON object with queue status

/interrupt

  • Interrupts the execution of the running prompt
  • Response: JSON object with interrupt status

/users

  • Creates a new user
  • Request Body: JSON object with username
  • Response: JSON object with user data

/settings

  • Stores a dictionary of settings for the current user
  • Request Body: JSON object with setting values
  • Response: JSON object with setting values

/settings/:id

  • Stores a specific setting value for the current user
  • Request Body: JSON value of the setting
  • Response: JSON object with setting value

/userdata/:file

  • Stores a user data file for the current user
  • Request Body: File contents
  • Response: JSON object with file upload status

DELETE Endpoints

/queue/:id

  • Deletes an item from the queue
  • Response: JSON object with delete status

/history/:id

  • Deletes an item from the history
  • Response: JSON object with delete status

Note that this documentation only covers the endpoints and methods defined in the provided JavaScript file. There may be additional endpoints or methods not included in this documentation.

@JulianKingman
Copy link

Would a PR with API documentation be welcome/accepted?

@Spritan
Copy link

Spritan commented Aug 25, 2024

is there any /health endpint to acertain if my comfyui instance is running

@ltdrdata
Copy link
Collaborator

is there any /health endpint to acertain if my comfyui instance is running

You can utilize /system_stats.

@TimRutjens04
Copy link

I've found the API code, not much of an addition to the response of @DuckyBlender but it's something I guess, its over here: https://github.com/comfyanonymous/ComfyUI/blob/master/server.py

All code for the endpoints are found here, hope it might help give a little more understanding on how to use them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants