forked from comfyanonymous/ComfyUI
-
Notifications
You must be signed in to change notification settings - Fork 12
/
openapi.yaml
875 lines (858 loc) · 26.5 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
openapi: 3.1.0
info:
title: comfyui
version: 0.0.1
servers:
- description: localhost
url: http://localhost:8188
paths:
/:
get:
summary: (UI) index.html
operationId: get_root_ui
responses:
200:
description: the index.html of the website
content:
text/html:
schema:
type: string
example: "<!DOCTYPE html>..."
/embeddings:
get:
summary: (UI) Get embeddings
operationId: get_embeddings_ui
responses:
200:
description: |
Returns a list of the files located in the embeddings/ directory that can be used as arguments for
embedding nodes. The file extension is omitted.
content:
application/json:
schema:
description: |
File names without extensions in embeddings/ directory
type: array
items:
type: string
/extensions:
get:
summary: (UI) Get extensions
operationId: get_extensions_ui
responses:
200:
description: Returns a list of files located in extensions/**/*.js
content:
application/json:
schema:
type: array
items:
type: string
/upload/image:
post:
summary: (UI) Upload an image.
description: |
Uploads an image to the input/ directory.
Never replaces files. The method will return a renamed file name if it would have overwritten an existing file.
operationId: upload_image_ui
requestBody:
content:
multipart/form-data:
schema:
type: object
description: The upload data
properties:
image:
description: The image binary data
type: string
format: binary
responses:
'200':
description: Successful upload
content:
application/json:
schema:
type: object
properties:
name:
description: |
The name to use in a workflow.
type: string
'400':
description: |
The request was missing an image upload.
/view:
get:
summary: (UI) View image
operationId: view_image_ui
description: |
Reads the image with the specified file name and located in the specified subfolder.
parameters:
- in: query
name: filename
schema:
type: string
required: true
- in: query
name: type
schema:
type: string
enum:
- output
- input
- temp
- in: query
name: subfolder
schema:
type: string
- in: query
name: channel
schema:
type: string
enum:
- 'rgba'
- 'rgb'
- 'a'
- in: query
name: preview
schema:
type: string
pattern: '^(?<format>webp|jpeg);(?<quality>\d{1,2})$'
responses:
'200':
description: Successful retrieval of file
headers:
Content-Disposition:
schema:
type: string
pattern: '^filename=".+"'
content:
image/png:
schema:
type: string
format: binary
image/jpeg:
schema:
type: string
format: binary
image/webp:
schema:
type: string
format: binary
'400':
description: Bad Request
'403':
description: Forbidden
'404':
description: Not Found
/prompt:
get:
summary: (UI) Get queue info
operationId: get_prompt_ui
responses:
200:
description: The current queue information
content:
application/json:
schema:
type: object
properties:
exec_info:
type: object
properties:
queue_remaining:
type: integer
post:
summary: (UI) Post prompt
operationId: post_prompt_ui
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PromptRequest"
responses:
'200':
description: The prompt was queued and a prompt ID was returned.
content:
application/json:
example:
prompt_id: "some-value"
schema:
type: object
properties:
prompt_id:
description: The ID of the prompt that was queued
type: string
text/plain:
example: "some-value"
schema:
type: string
'400':
description: The prompt was invalid. The validation error is returned as the content.
content:
text/plain:
schema:
type: string
/object_info:
get:
summary: (UI) Get object info
operationId: get_object_info_ui
responses:
'200':
description: The list of supported nodes
content:
application/json:
schema:
type: object
additionalProperties:
$ref: "#/components/schemas/Node"
/history:
get:
summary: (UI) Get history
operationId: get_history_ui
responses:
"200":
description: History
content:
application/json:
schema:
type: object
additionalProperties:
type: object
properties:
prompt:
$ref: "#/components/schemas/QueueTuple"
outputs:
$ref: "#/components/schemas/Outputs"
status:
type: object
properties:
status_str:
type: string
completed:
type: boolean
messages:
type: array
items:
type: string
post:
summary: (UI) Post history
operationId: post_history_ui
requestBody:
content:
application/json:
schema:
type: object
properties:
clear:
type: boolean
delete:
type: array
items:
type: integer
responses:
'200':
description: OK
/queue:
get:
summary: (UI) Get queue
operationId: get_queue_ui
responses:
"200":
description: the queue state
content:
application/json:
schema:
type: object
properties:
queue_running:
type: array
items:
$ref: "#/components/schemas/QueueTuple"
queue_pending:
type: array
items:
$ref: "#/components/schemas/QueueTuple"
post:
summary: (UI) Post queue
operationId: post_queue_ui
requestBody:
content:
application/json:
schema:
type: object
properties:
clear:
type: boolean
delete:
type: array
items:
type: integer
responses:
'200':
description: OK
/interrupt:
post:
summary: (UI) Post interrupt
operationId: post_interrupt_ui
responses:
'200':
description: OK
/free:
# from 6d281b4ff4ad3918a4f3b4ca4a8b547a2ba3bf80
post:
summary: (UI) Unload models or free memory
operationId: free_ui
responses:
200:
description: The free request was accepted. No content body.
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
properties:
unload_models:
type: boolean
enum: [ true ]
required:
- unload_models
additionalProperties: false
- type: object
properties:
free_memory:
type: boolean
enum: [ true ]
required:
- free_memory
additionalProperties: false
description: >-
A POST request to /free with: {"unload_models":true} will unload models from vram.
A POST request to /free with: {"free_memory":true} will unload models and free all cached data from the last run workflow.
/api/v1/prompts/{prompt_id}:
get:
operationId: get_prompt
summary: (API) Get prompt status
parameters:
- in: path
name: prompt_id
schema:
type: string
required: true
description: |
The ID of the prompt to query.
responses:
204:
description: |
The prompt is still in progress
200:
description: |
Prompt outputs
content:
application/json:
$ref: "#/components/schemas/Outputs"
404:
description: |
The prompt was not found
/api/v1/prompts:
get:
operationId: list_prompts
summary: (API) Get last prompt
description: |
Return the last prompt run anywhere that was used to produce an image
The prompt object can be POSTed to run the image again with your own parameters.
The last prompt, whether it was in the UI or via the API, will be returned here.
responses:
200:
description: |
The last prompt.
content:
application/json:
schema:
$ref: "#/components/schemas/Prompt"
404:
description: |
There were no prompts in the history to return.
post:
operationId: generate
summary: (API) Generate image
description: |
Run a prompt to generate an image.
Blocks until the image is produced. This may take an arbitrarily long amount of time due to model loading.
Prompts that produce multiple images will return the last SaveImage output node in the Prompt by default. To return a specific image, remove other
SaveImage nodes.
When images are included in your request body, these are saved and their
filenames will be used in your Prompt.
responses:
200:
headers:
Idempotency-Key:
description: |
The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. When creating or updating an object, use an idempotency key. Then, if a connection error occurs, you can safely repeat the request without risk of creating a second object or performing the update twice.
To perform an idempotent request, provide an additional IdempotencyKey element to the request options.
Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeds or fails. Subsequent requests with the same key return the same result, including 500 errors.
A client generates an idempotency key, which is a unique key that the server uses to recognize subsequent retries of the same request. How you create unique keys is up to you, but we suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions. Idempotency keys are up to 255 characters long.
You can remove keys from the system automatically after they’re at least 24 hours old. We generate a new request if a key is reused after the original is pruned. The idempotency layer compares incoming parameters to those of the original request and errors if they’re the same to prevent accidental misuse.
example: XFDSF000213
schema:
type: string
Digest:
description: The digest of the request body
example: SHA256=e5187160a7b2c496773c1c5a45bfd3ffbf25eaa5969328e6469d36f31cf240a3
schema:
type: string
Content-Disposition:
description: The filename when exactly one SaveImage node is specified.
example: filename=ComfyUI_00001.png
schema:
type: string
pattern: '^filename=.+'
description: |
The content of the last SaveImage node.
content:
image/png:
schema:
description: |
Binary image data. This will be the contents of the last node that returns image outputs in the workflow.
type: string
format: binary
application/json:
schema:
description: |
The complete outputs dictionary from the workflow.
type: object
required:
- urls
- outputs
properties:
urls:
deprecated: true
description: |
A deprecated list of URLs to binary outputs, whenever save nodes are used.
For each SaveImage node, there will be two URLs: the internal URL returned by the worker, and
the URL for the image based on the `--external-address` / `COMFYUI_EXTERNAL_ADDRESS` configuration.
type: array
items:
type: string
outputs:
$ref: "#/components/schemas/Outputs"
example:
outputs: { }
202:
description: |
The prompt was successfully queued.
content:
application/json:
description: Information about the item that was queued
schema:
type: object
properties:
prompt_id:
type: string
description: The ID of the prompt that was queued
headers:
Location:
description: The relative URL to check on the status of the request
schema:
type: string
Retry-After:
description: |
A hint for the number of seconds to check the provided Location for the status of your request.
This is the server's estimate for when the request will be completed.
204:
description: |
The prompt was run but did not contain any SaveImage outputs, so nothing will be returned.
This could be run to e.g. cause the backend to pre-load a model.
400:
description: |
The prompt is invalid.
content:
application/json:
description: A validation error dictionary from the ComfyUI frontend.
schema:
$ref: "#/components/schemas/ValidationErrorDict"
429:
description: |
The queue is currently too long to process your request.
500:
description: |
An execution error occurred while processing your prompt.
content:
application/json:
description:
An execution status directly from the workers
schema:
$ref: "#/components/schemas/ExecutionStatusAsDict"
507:
description: |
The server had an IOError like running out of disk space.
503:
description: |
The server is too busy to process this request right now.
This should only be returned by a load balancer. Standalone comfyui does not return this.
parameters:
- in: header
name: Accept
schema:
type: string
enum:
- "application/json"
- "image/png"
- "application/json+respond-async"
required: false
description: |
Specifies the media type the client is willing to receive.
If +respond-async is specified after your Accept mimetype, the request will be run async and you will get 202 when the prompt was queued.
- in: header
title: prefer_header
name: Prefer
schema:
type: string
enum:
- "respond-async"
- ""
required: false
allowEmptyValue: true
description: |
When respond-async is in your Prefer header, the request will be run async and you will get 202 when the prompt was queued.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Prompt"
multipart/formdata:
schema:
type: object
properties:
prompt:
$ref: "#/components/schemas/Prompt"
files:
description: |
Files to upload along with this request.
The filename specified in the content-disposition can be used in your Prompt.
type: array
items:
type: string
format: binary
components:
schemas:
InputSpec:
type: array
prefixItems:
- oneOf:
- type: string
- type: array
items:
oneOf:
- type: string
- type: number
- type: boolean
- type: object
properties:
default:
type: string
min:
type: number
max:
type: number
step:
type: number
multiline:
type: boolean
items: false
Node:
type: object
properties:
input:
type: object
required:
- required
properties:
required:
type: object
additionalProperties:
$ref: "#/components/schemas/InputSpec"
optional:
type: object
additionalProperties:
$ref: "#/components/schemas/InputSpec"
hidden:
type: object
additionalProperties:
$ref: "#/components/schemas/InputSpec"
output:
type: array
items:
type: string
output_is_list:
description: Indicates if the output of the corresponding index as the item in this array is a list output.
type: array
items:
type: boolean
output_name:
type: array
items:
type: string
name:
type: string
display_name:
type: string
description:
type: string
category:
type: string
output_node:
type: boolean
ExtraData:
type: object
properties:
extra_pnginfo:
type: object
properties:
workflow:
$ref: "#/components/schemas/Workflow"
Prompt:
type: object
description: |
The keys are stringified integers corresponding to nodes.
You can retrieve the last prompt run using GET /api/v1/prompts
additionalProperties:
$ref: '#/components/schemas/PromptNode'
PromptNode:
type: object
required:
- class_type
- inputs
properties:
_meta:
type: object
properties:
title:
type: string
description: |
The title of the node when authored in the workflow. Set only when the end user changed it using the
panel properties in the UI.
class_type:
type: string
description: The node's class type, which maps to a class in NODE_CLASS_MAPPINGS.
inputs:
type: object
additionalProperties:
oneOf:
- type: number
- type: string
- type: boolean
- type: array
description: |
When this is specified, it is a node connection, followed by an output.
minItems: 2
maxItems: 2
prefixItems:
- type: string
- type: integer
description: The inputs for the node, which can be scalar values or references to other nodes' outputs.
is_changed:
oneOf:
- type: array
description: An array of hashes representing whether the node has changed (optional).
items:
type: string
- type: string
description: A string representing whether the node has changed (optional).
Workflow:
type: object
properties:
last_node_id:
type: integer
last_link_id:
type: integer
nodes:
type: array
items:
type: object
properties:
id:
type: integer
type:
type: string
pos:
type: array
maxItems: 2
minItems: 2
items:
type: number
size:
type: object
properties:
"0":
type: number
"1":
type: number
flags:
type: object
additionalProperties:
type: object
order:
type: integer
mode:
type: integer
inputs:
type: array
items:
type: object
properties:
name:
type: string
type:
type: string
link:
type: integer
outputs:
type: array
items:
type: object
properties:
name:
type: string
type:
type: string
links:
type: array
items:
type: integer
slot_index:
type: integer
properties:
type: object
widgets_values:
type: array
items:
type: string
links:
type: array
items:
type: array
items:
minItems: 6
maxItems: 6
oneOf:
- type: integer
- type: string
groups:
type: array
items:
type: object
config:
type: object
extra:
type: object
version:
type: number
PromptRequest:
type: object
required:
- prompt
properties:
client_id:
type: string
prompt:
$ref: "#/components/schemas/Prompt"
extra_data:
$ref: "#/components/schemas/ExtraData"
QueueTuple:
type: array
description: |
An item that was added to the queue.
minItems: 3
maxItems: 5
prefixItems:
- type: number
description: Queue priority.
- type: string
description: The hash id of the prompt object. This should be the the prompt ID.
- $ref: "#/components/schemas/Prompt"
- $ref: "#/components/schemas/ExtraData"
- type: array
description: A list of "good output" node IDs in the prompt.
items:
type: string
Outputs:
description: |
The keys are node IDs, the values are output objects.
type: object
additionalProperties:
$ref: "#/components/schemas/Output"
Output:
type: object
properties:
images:
type: array
items:
$ref: "#/components/schemas/FileOutput"
latents:
type: array
items:
$ref: "#/components/schemas/FileOutput"
additionalProperties:
$ref: "#/components/schemas/FileOutput"
FileOutput:
type: object
required:
- filename
- subfolder
- type
- abs_path
properties:
filename:
type: string
subfolder:
type: string
type:
type: string
abs_path:
type: string
ValidationErrorDict:
type: object
properties:
type:
type: string
message:
type: string
details:
type: string
extra_info:
type: object
required:
- exception_type
- traceback
properties:
exception_type:
type: string
traceback:
type: array
items:
type: string
required:
- type
- details
- extra_info
- message
ExecutionStatusAsDict:
type: object
required:
- status_str
- completed
- messages
properties:
status_str:
type: string
enum:
- "success"
- "error"
completed:
type: boolean
messages:
type: array
items:
type: string