Repository navigation
Expand file tree
/
Copy pathswagger.yaml
More file actions
858 lines (844 loc) · 23.6 KB
/
Copy pathswagger.yaml
File metadata and controls
858 lines (844 loc) · 23.6 KB
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
openapi: 3.0.0
info:
version: 1.0.1
title: api.trace.moe
description: api.trace.moe
servers:
- description: Production Server
url: https://api.trace.moe/
components:
securitySchemes:
ApiKeyInHeader:
type: apiKey
name: x-trace-key
description: API Key (if any)
in: header
parameters:
url:
name: url
description: Image URL
in: query
required: false
allowEmptyValue: false
schema:
type: string
vector:
name: vector
description: Base64 hash string of Color Layout vector
in: query
required: false
allowEmptyValue: false
schema:
type: string
cutBorders:
name: cutBorders
description: "Cut black borders: 0 = original image, 1 = cropped image (same as cutBorders without number), 2 = both original and cropped image (merged top results, consumes 2 credits if two vectors differ)"
in: query
required: false
allowEmptyValue: true
schema:
type: string
enum:
- ""
- "0"
- "1"
- "2"
anilistInfo:
name: anilistInfo
description: Include Anilist info
in: query
required: false
allowEmptyValue: true
schema:
type: string
pattern: ^$
anilistID:
name: anilistID
description: Filter by Anilist ID
in: query
required: false
allowEmptyValue: false
schema:
type: integer
period:
name: period
in: query
description: Group stats by minute (past 60 min), hour (past 72 hours), or day (past 60 days)
required: false
schema:
type: string
enum:
- minute
- hour
- day
responses:
User:
description: A user response or time-series usage logs
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/User"
- $ref: "#/components/schemas/UserLogs"
ErrorBadRequest:
description: Image is malformed, or some params are incorrect
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorPaymentRequired:
description: Search quota or concurrency limit exceeded
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorUnauthorized:
description: API key is invalid
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorForbidden:
description: No permission to access
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorNotFound:
description: The requested resource is not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorMethodNotAllowed:
description: Wrong HTTP method used
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorTooManyRequests:
description: HTTP rate limit exceeded
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorInternalServerError:
description: Database error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorServiceUnavailable:
description: Database is overloaded
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ErrorGatewayTimeout:
description: Database is not responding
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
Success:
description: A search response
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResult"
schemas:
Error:
type: object
properties:
error:
type: string
description: Error message
required:
- error
User:
type: object
properties:
id:
type: string
description: IP address (guest) or email address (user)
priority:
type: integer
description: Your priority in search queue
concurrency:
type: integer
description: Number of parallel search requests you can make
quota:
type: integer
description: Daily search quota you have
quotaUsed:
type: integer
description: Daily search quota you have used last 24 hours
required:
- id
- priority
- concurrency
- quota
- quotaUsed
UserLogs:
type: array
items:
type: object
properties:
time:
type: string
format: date-time
"200":
type: integer
"400":
type: integer
"402":
type: integer
"405":
type: integer
"500":
type: integer
"503":
type: integer
total:
type: integer
SearchResult:
type: object
properties:
quota:
type: integer
description: Daily search quota you have
quotaUsed:
type: integer
description: Daily search quota you have used last 24 hours
frameCount:
type: integer
description: frames compared for image search
error:
type: string
description: Error message
result:
type: array
description: Search results (array of results, or array of arrays for batch vector searches)
items:
oneOf:
- $ref: "#/components/schemas/Result"
- type: array
items:
$ref: "#/components/schemas/Result"
required:
- frameCount
- error
- result
Result:
type: object
properties:
anilist:
description: The matching Anilist ID or Anilist info
oneOf:
- type: integer
- $ref: "#/components/schemas/Anilist"
filename:
type: string
description: The filename of file where the match is found
episode:
description: The extracted episode number from filename
oneOf:
- type: number
nullable: true
- type: string
nullable: true
- type: array
items:
oneOf:
- type: number
- type: string
episode_start:
type: number
nullable: true
description: The starting episode number covered by the file
episode_end:
type: number
nullable: true
description: The ending episode number covered by the file
from:
type: number
description: Starting time of the matching scene (seconds)
to:
type: number
description: Ending time of the matching scene (seconds)
at:
type: number
description: Time of the matching frame (seconds)
duration:
type: number
description: Duration of the matching video (seconds)
similarity:
type: number
description: Similarity compared to the search image
video:
type: string
description: URL to the preview video of the matching scene
image:
type: string
description: URL to the preview image of the matching scene
required:
- anilist
- filename
- episode
- from
- to
- similarity
- video
- image
Anilist:
type: object
properties:
id:
type: integer
description: Anilist ID
idMal:
type: integer
description: MyAnimeList ID
nullable: true
isAdult:
type: boolean
description: Adult anime or not
synonyms:
type: array
description: Alias titles
items:
type: string
title:
type: object
properties:
native:
type: string
description: Native title
nullable: true
romaji:
type: string
description: Romaji title
english:
type: string
description: English title
nullable: true
required:
- native
- romaji
- english
required:
- id
- idMal
- isAdult
- synonyms
- title
SystemStatus:
type: object
properties:
updated:
type: string
format: date-time
rowCount:
type: integer
description: Total vector rows in Milvus collection
memory:
type: integer
description: Total system memory (bytes)
memoryUsage:
type: integer
description: Used system memory (bytes)
storage:
type: integer
description: Total disk space (bytes)
storageFree:
type: integer
description: Free disk space (bytes)
storageAvailable:
type: integer
description: Available disk space (bytes)
mediaCount:
type: integer
description: Total media files
mediaFramesTotal:
type: integer
description: Total indexed video frames
mediaDurationTotal:
type: number
description: Total indexed video duration in seconds
security:
- ApiKeyInHeader: []
paths:
/anilist:
get:
summary: Search anime by name
parameters:
- name: q
in: query
description: Anime name to search
required: true
schema:
type: string
responses:
"200":
description: Search results containing anime entries with similarity scores
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Anilist ID
title:
type: string
description: The title or synonym that matched the search
similarity:
type: number
description: Similarity score (0 to 1)
anilist:
$ref: "#/components/schemas/Anilist"
"400":
$ref: "#/components/responses/ErrorBadRequest"
"500":
$ref: "#/components/responses/ErrorInternalServerError"
/search:
get:
summary: Get search result of an anime screenshot
parameters:
- $ref: "#/components/parameters/anilistInfo"
- $ref: "#/components/parameters/cutBorders"
- $ref: "#/components/parameters/url"
- $ref: "#/components/parameters/vector"
- $ref: "#/components/parameters/anilistID"
responses:
"200":
$ref: "#/components/responses/Success"
"400":
$ref: "#/components/responses/ErrorBadRequest"
"402":
$ref: "#/components/responses/ErrorPaymentRequired"
"403":
$ref: "#/components/responses/ErrorForbidden"
"404":
$ref: "#/components/responses/ErrorNotFound"
"405":
$ref: "#/components/responses/ErrorMethodNotAllowed"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
"500":
$ref: "#/components/responses/ErrorInternalServerError"
"503":
$ref: "#/components/responses/ErrorServiceUnavailable"
"504":
$ref: "#/components/responses/ErrorGatewayTimeout"
post:
summary: Get search result of an anime screenshot
parameters:
- $ref: "#/components/parameters/anilistInfo"
- $ref: "#/components/parameters/cutBorders"
- $ref: "#/components/parameters/anilistID"
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
image:
type: string
format: binary
application/json:
schema:
type: object
properties:
vector:
description: A 33-element color layout vector array, base64 encoded string, or an array of up to 10 vectors
oneOf:
- type: array
items:
type: integer
- type: string
- type: array
items:
oneOf:
- type: array
items:
type: integer
- type: string
required:
- vector
image/jpeg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/*:
schema:
type: string
format: binary
application/octet-stream:
schema:
type: string
format: binary
responses:
"200":
$ref: "#/components/responses/Success"
"400":
$ref: "#/components/responses/ErrorBadRequest"
"402":
$ref: "#/components/responses/ErrorPaymentRequired"
"403":
$ref: "#/components/responses/ErrorForbidden"
"404":
$ref: "#/components/responses/ErrorNotFound"
"405":
$ref: "#/components/responses/ErrorMethodNotAllowed"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
"500":
$ref: "#/components/responses/ErrorInternalServerError"
"503":
$ref: "#/components/responses/ErrorServiceUnavailable"
"504":
$ref: "#/components/responses/ErrorGatewayTimeout"
/me:
get:
summary: Get info about your account or usage history
parameters:
- $ref: "#/components/parameters/period"
responses:
"200":
$ref: "#/components/responses/User"
"400":
$ref: "#/components/responses/ErrorBadRequest"
"403":
$ref: "#/components/responses/ErrorForbidden"
"404":
$ref: "#/components/responses/ErrorNotFound"
"405":
$ref: "#/components/responses/ErrorMethodNotAllowed"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
/status:
get:
summary: Get system status metrics or list of indexed file paths for an anilist ID
parameters:
- name: id
in: query
required: false
description: Anilist ID to list indexed files for
schema:
type: integer
responses:
"200":
description: System status metrics or file path list
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/SystemStatus"
- type: array
items:
type: object
properties:
path:
type: string
"400":
$ref: "#/components/responses/ErrorBadRequest"
"500":
$ref: "#/components/responses/ErrorInternalServerError"
/stats:
get:
summary: Get aggregated system metrics (traffic, speed/latency percentiles, accuracy)
parameters:
- name: type
in: query
required: true
description: Type of metric
schema:
type: string
enum:
- traffic
- speed
- accuracy
- name: period
in: query
required: true
description: Aggregation period
schema:
type: string
enum:
- minute
- hour
- day
responses:
"200":
description: System statistics time-series data
content:
application/json:
schema:
type: array
items:
type: object
"400":
$ref: "#/components/responses/ErrorBadRequest"
"500":
$ref: "#/components/responses/ErrorInternalServerError"
/image/{id}:
get:
summary: Get scene preview image by hash ID
parameters:
- name: id
in: path
required: true
description: Encoded preview ID from search result
schema:
type: string
- name: size
in: query
required: false
description: "Image size: s (160px), m (320px), l (640px)"
schema:
type: string
enum:
- s
- m
- l
default: m
responses:
"200":
description: Preview image
content:
image/jpeg:
schema:
type: string
format: binary
image/webp:
schema:
type: string
format: binary
image/jxl:
schema:
type: string
format: binary
"304":
description: Not Modified
"400":
$ref: "#/components/responses/ErrorBadRequest"
"403":
$ref: "#/components/responses/ErrorForbidden"
"404":
$ref: "#/components/responses/ErrorNotFound"
"410":
description: Preview link has expired
content:
text/plain:
schema:
type: string
"500":
$ref: "#/components/responses/ErrorInternalServerError"
"503":
$ref: "#/components/responses/ErrorServiceUnavailable"
/video/{id}:
get:
summary: Get scene preview video clip by hash ID
parameters:
- name: id
in: path
required: true
description: Encoded preview ID from search result
schema:
type: string
- name: size
in: query
required: false
description: "Video size: s (160px), m (320px), l (640px)"
schema:
type: string
enum:
- s
- m
- l
default: m
- name: minDuration
in: query
required: false
description: Minimum scene duration in seconds (0.5 to 2.0)
schema:
type: number
default: 0.5
- name: maxDuration
in: query
required: false
description: Maximum scene duration in seconds (0.5 to 5.0)
schema:
type: number
default: 5.0
- name: mute
in: query
required: false
allowEmptyValue: true
description: Mute audio track
schema:
type: string
pattern: ^$
responses:
"200":
description: Preview video MP4
headers:
x-video-start:
description: Start time of scene
schema:
type: number
x-video-end:
description: End time of scene
schema:
type: number
x-video-duration:
description: Duration of scene
schema:
type: number
content:
video/mp4:
schema:
type: string
format: binary
"304":
description: Not Modified
"400":
$ref: "#/components/responses/ErrorBadRequest"
"403":
$ref: "#/components/responses/ErrorForbidden"
"404":
$ref: "#/components/responses/ErrorNotFound"
"410":
description: Preview link has expired
content:
text/plain:
schema:
type: string
"500":
$ref: "#/components/responses/ErrorInternalServerError"
"503":
$ref: "#/components/responses/ErrorServiceUnavailable"
/user/login:
post:
summary: User login to retrieve API key
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- password
properties:
email:
type: string
format: email
password:
type: string
responses:
"200":
description: Login successful
content:
application/json:
schema:
type: object
properties:
key:
type: string
description: User API key
"403":
$ref: "#/components/responses/ErrorForbidden"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
/user/create:
post:
summary: Admin endpoint to create a new user
security:
- ApiKeyInHeader: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- tier
properties:
email:
type: string
format: email
tier:
type: integer
description: User tier ID
responses:
"200":
description: User created successfully
content:
application/json:
schema:
type: object
"400":
$ref: "#/components/responses/ErrorBadRequest"
"403":
$ref: "#/components/responses/ErrorForbidden"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
/user/reset-key:
post:
summary: Regenerate API key for the authenticated user
security:
- ApiKeyInHeader: []
responses:
"200":
description: New API key generated
content:
application/json:
schema:
type: object
properties:
key:
type: string
description: Newly generated API key
"403":
$ref: "#/components/responses/ErrorForbidden"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"
/user/reset-password:
post:
summary: Change password for the authenticated user
security:
- ApiKeyInHeader: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- password
properties:
password:
type: string
minLength: 8
responses:
"200":
description: Password updated successfully
content:
application/json:
schema:
type: object
"400":
$ref: "#/components/responses/ErrorBadRequest"
"403":
$ref: "#/components/responses/ErrorForbidden"
"429":
$ref: "#/components/responses/ErrorTooManyRequests"