forked from jkawamoto/go-civitai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
711 lines (711 loc) · 18.6 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
swagger: "2.0"
info:
title: Civitai API
version: "2023-04-27"
host: civitai.com
basePath: /api/v1
schemes:
- https
consumes:
- application/json
produces:
- application/json
paths:
/creators:
get:
operationId: getCreators
parameters:
- name: limit
type: integer
format: int64
in: query
description: >-
The number of results to be returned per page.
This can be a number between 0 and 200. By default, each page will return 20 results.
If set to 0, it'll return all the creators.
default: 20
minimum: 0
maximum: 200
- name: page
type: integer
format: int64
in: query
description: >-
The page from which to start fetching creators.
- name: query
type: string
in: query
description: >-
Search query to filter creators by username.
responses:
200:
description: A list of creators.
schema:
$ref: "#/definitions/CreatorsResponse"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/images:
get:
operationId: getImages
parameters:
- name: limit
type: integer
format: int64
in: query
description: The number of results to be returned per page.
default: 100
minimum: 0
maximum: 200
- name: postId
type: integer
format: int64
in: query
description: The ID of a post to get images from.
- name: modelId
type: integer
format: int64
in: query
description: The ID of a model to get images from (model gallery).
- name: modelVersionId
type: integer
format: int64
in: query
description: The ID of a model version to get images from (model gallery filtered to version).
- name: username
type: string
in: query
description: Filter to images from a specific user.
- name: nsfw
type: boolean
in: query
description: Filter to images that contain mature content flags or not (undefined returns both).
- name: sort
type: string
enum:
- Most Reactions
- Most Comments
- Newest
in: query
description: The order in which you wish to sort the results.
- name: period
type: string
enum:
- AllTime
- Year
- Month
- Week
- Day
in: query
description: The time frame in which the images will be sorted.
- name: page
type: integer
format: int64
in: query
description: The page from which to start fetching creators.
responses:
200:
description: A list of images.
schema:
$ref: "#/definitions/ImagesResponse"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/models:
get:
operationId: getModels
parameters:
- name: limit
type: integer
format: int64
in: query
description: >-
The number of results to be returned per page. This can be a number between 1 and 200.
By default, each page will return 100 results.
default: 100
minimum: 0
maximum: 200
- name: page
type: integer
format: int64
in: query
description: >-
The page from which to start fetching models.
- name: query
type: string
in: query
description: >-
Search query to filter models by name.
- name: tag
type: string
in: query
description: >-
Search query to filter models by tag.
- name: username
type: string
in: query
description: >-
Search query to filter models by user.
- name: types
type: string
enum:
- Checkpoint
- TextualInversion
- Hypernetwork
- AestheticGradient
- LORA
- LyCORIS
- Controlnet
- Wildcards
- Poses
- Other
in: query
description: >-
The type of model you want to filter with. If none is specified, it will return all types.
- name: sort
type: string
enum:
- Highest Rated
- Most Downloaded
- Newest
in: query
description: >-
The order in which you wish to sort the results.
- name: period
type: string
enum:
- AllTime
- Year
- Month
- Week
- Day
in: query
description: >-
The time frame in which the models will be sorted.
- name: rating
type: number
format: int64
in: query
description: >-
The rating you wish to filter the models with.
If none is specified, it will return models with any rating.
- name: favorites
type: boolean
in: query
description: >-
Filter to favorites of the authenticated user (this requires an API token or session cookie).
- name: hidden
type: boolean
in: query
description: >-
Filter to hidden models of the authenticated user (this requires an API token or session cookie).
- name: primaryFileOnly
type: boolean
in: query
description: >-
Only include the primary file for each model
(This will use your preferred format options if you use an API token or session cookie).
responses:
200:
description: A list of models.
schema:
$ref: "#/definitions/ModelsResponse"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/models/{modelId}:
get:
operationId: getModel
parameters:
- name: modelId
type: integer
format: int64
in: path
required: true
responses:
200:
description: The model info.
schema:
$ref: "#/definitions/Model"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/model-versions/{modelVersionId}:
get:
operationId: getModelVersion
parameters:
- name: modelVersionId
type: integer
format: int64
in: path
required: true
responses:
200:
description: The model version info.
schema:
$ref: "#/definitions/ModelVersion"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/model-versions/by-hash/{hash}:
get:
operationId: getModelVersionByHash
parameters:
- name: hash
type: string
in: path
required: true
responses:
200:
description: The model version info.
schema:
$ref: "#/definitions/ModelVersion"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
/tags:
get:
operationId: getTags
parameters:
- name: limit
type: integer
format: int64
in: query
description: >-
The number of results to be returned per page. This can be a number between 1 and 200.
By default, each page will return 20 results. If set to 0, it'll return all the tags.
default: 20
minimum: 0
maximum: 200
- name: page
type: integer
format: int64
in: query
description: >-
The page from which to start fetching tags.
- name: query
type: string
in: query
description: >-
Search query to filter tags by name.
responses:
200:
description: A list of tags.
schema:
$ref: "#/definitions/TagsResponse"
default:
description: Error Response
schema:
$ref: "#/definitions/StandardError"
definitions:
CreatorsResponse:
properties:
items:
type: array
items:
$ref: "#/definitions/Creator"
metadata:
$ref: "#/definitions/Metadata"
ImagesResponse:
properties:
items:
type: array
items:
$ref: "#/definitions/Image"
metadata:
$ref: "#/definitions/Metadata"
ModelsResponse:
properties:
items:
type: array
items:
$ref: "#/definitions/Model"
metadata:
$ref: "#/definitions/Metadata"
TagsResponse:
properties:
items:
type: array
items:
$ref: "#/definitions/Tag"
metadata:
$ref: "#/definitions/Metadata"
Creator:
properties:
username:
type: string
description: The username of the creator.
example: Civitai
modelCount:
type: integer
format: int64
description: The amount of models linked to this user.
example: 848
link:
type: string
description: Url to get all models from this user.
example: https://civitai.com/api/v1/models?username=Civitai
Model:
properties:
id:
type: integer
format: int64
description: The identifier for the model.
name:
type: string
description: The name of the model.
description:
type: string
description: The description of the model (HTML).
type:
type: string
enum:
- Checkpoint
- TextualInversion
- Hypernetwork
- AestheticGradient
- LORA
- LyCORIS
- Controlnet
- Wildcards
- Poses
- Other
description: The model type.
poi:
type: boolean
nsfw:
type: boolean
description: Whether the model is NSFW or not.
allowNoCredit:
type: boolean
allowCommercialUse:
type: string
allowDerivatives:
type: boolean
allowDifferentLicense:
type: boolean
stats:
$ref: "#/definitions/Stats"
rank:
$ref: "#/definitions/Rank"
creator:
$ref: "#/definitions/ModelCreator"
tags:
type: array
items:
type: object
description: The tags associated with the model.
modelVersions:
type: array
items:
$ref: "#/definitions/ModelVersion"
Stats:
properties:
downloadCount:
type: integer
format: int64
favoriteCount:
type: integer
format: int64
commentCount:
type: integer
format: int64
ratingCount:
type: integer
format: int64
rating:
type: number
format: double
Rank:
properties:
downloadCountAllTime:
type: integer
format: int64
commentCountAllTime:
type: integer
format: int64
favoriteCountAllTime:
type: integer
format: int64
ratingCountAllTime:
type: integer
format: int64
ratingAllTime:
type: number
format: double
ModelCreator:
properties:
username:
type: string
description: The name of the creator.
image:
type: string
description: The url of the creators avatar.
ModelVersion:
properties:
id:
type: integer
format: int64
description: The identifier for the model version.
modelId:
type: integer
format: int64
name:
type: string
description: The name of the model version.
createdAt:
type: string
format: date-time
description: The date in which the version was created.
updatedAt:
type: string
format: date-time
trainedWords:
type: array
items:
type: string
description: The words used to trigger the model.
baseModel:
type: string
earlyAccessTimeFrame:
type: integer
format: int64
description:
type: string
description: The description of the model version (usually a changelog).
files:
type: array
items:
$ref: "#/definitions/File"
images:
type: array
items:
$ref: "#/definitions/Image"
downloadUrl:
type: string
description: The download url to get the model file for this specific version.
File:
properties:
name:
type: string
id:
type: integer
format: int64
sizeKB:
type: number
format: double
description: The size of the model file.
type:
type: string
format:
type: string
description: The format of the file ('pickle' or 'safetensor').
pickleScanResult:
type: string
description: Status of the pickle scan ('Pending', 'Success', 'Danger', 'Error').
pickleScanMessage:
type: string
virusScanResult:
type: string
description: Status of the virus scan ('Pending', 'Success', 'Danger', 'Error').
scannedAt:
type: string
format: date-time
description: The date in which the file was scanned.
hashes:
$ref: "#/definitions/Hash"
downloadUrl:
type: string
primary:
type: boolean
description: If the file is the primary file for the model version.
Hash:
properties:
AutoV1:
type: string
example: 95F8D0A7
AutoV2:
type: string
example: 95AFA0D9EA
SHA256:
type: string
example: 95AFA0D9EADAC2A04671ED18202FCF09C990148E1CD0AE477BF57F763B948615
CRC32:
type: string
example: F28B4B59
BLAKE3:
type: string
example: CC4CD6EA2B502C61B4BD86CA5C4B07AF269877877CEC7FB14EEAE846555CED1E
Image:
properties:
id:
type: integer
format: int64
description: The id of the image.
url:
type: string
description: The url for the image.
nsfw:
type: object
description: >-
Whether or not the image is NSFW (note: if the model is NSFW, treat all images on the model as NSFW).
width:
type: integer
format: int64
description: The original width of the image.
height:
type: integer
format: int64
description: The original height of the image.
hash:
type: string
description: The blurhash of the image.
createdAt:
type: string
format: date-time
description: The date the image was posted.
example: 2023-04-06T09:14:50.762Z
postId:
type: integer
format: int64
description: The ID of the post the image belongs to.
stats:
$ref: "#/definitions/ImageStats"
meta:
$ref: "#/definitions/ImageMetadata"
description: The generation params of the image.
username:
type: string
description: The username of the creator.
userId:
type: integer
format: int64
generationProcess:
type: string
needsReview:
type: boolean
scannedAt:
type: string
format: date-time
tags:
type: array
items:
$ref: "#/definitions/ImageTag"
ImageMetadata:
properties:
resources:
type: array
items:
$ref: "#/definitions/ImageResource"
additionalProperties: true
ImageResource:
properties:
name:
type: string
type:
type: string
hash:
type: string
weight:
type: number
format: double
ImageTag:
properties:
tag:
$ref: "#/definitions/ImageTagData"
automated:
type: boolean
needsReview:
type: boolean
ImageTagData:
properties:
id:
type: integer
format: int64
name:
type: string
isCategory:
type: boolean
type:
type: string
ImageStats:
properties:
cryCount:
type: integer
format: int64
description: The number of cry reactions.
laughCount:
type: integer
format: int64
description: The number of laugh reactions.
likeCount:
type: integer
format: int64
description: The number of like reactions.
dislikeCount:
type: integer
format: int64
heartCount:
type: integer
format: int64
description: The number of heart reactions.
commentCount:
type: integer
format: int64
description: The number of comment reactions.
Tag:
properties:
name:
type: string
description: The name of the tag.
modelCount:
type: integer
format: int64
description: The amount of models linked to this tag.
link:
type: string
description: Url to get all models from this tag.
Metadata:
properties:
totalItems:
type: integer
format: int64
description: The total number of items available.
example: 46
currentPage:
type: integer
format: int64
description: The the current page you are at.
example: 2
pageSize:
type: integer
format: int64
description: The the size of the batch.
example: 3
totalPages:
type: integer
format: int64
description: The total number of pages.
example: 16
nextPage:
type: string
description: The url to get the next batch of items.
example: https://civitai.com/api/v1/creators?limit=3&page=3
prevPage:
type: string
description: The url to get the previous batch of items.
example: https://civitai.com/api/v1/creators?limit=3&page=1
StandardError:
required:
- error
properties:
error:
type: string
example: >-
Something went wrong while writing the file to disk, the server may be out of storage space.