@runapi.ai/suno 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,8 +2,1176 @@
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-music.ts
5
- import { compactParams } from "@runapi.ai/core";
5
+ import { compactParams, validateParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
+
8
+ // src/contract_gen.ts
9
+ var contract = {
10
+ "add-instrumental": {
11
+ "models": [
12
+ "suno-v4.5-plus",
13
+ "suno-v5",
14
+ "suno-v5.5"
15
+ ],
16
+ "fields_by_model": {
17
+ "suno-v4.5-plus": {
18
+ "model": {
19
+ "required": true
20
+ },
21
+ "upload_url": {
22
+ "required": true
23
+ },
24
+ "vocal_gender": {
25
+ "enum": [
26
+ "male",
27
+ "female"
28
+ ]
29
+ }
30
+ },
31
+ "suno-v5": {
32
+ "model": {
33
+ "required": true
34
+ },
35
+ "upload_url": {
36
+ "required": true
37
+ },
38
+ "vocal_gender": {
39
+ "enum": [
40
+ "male",
41
+ "female"
42
+ ]
43
+ }
44
+ },
45
+ "suno-v5.5": {
46
+ "model": {
47
+ "required": true
48
+ },
49
+ "upload_url": {
50
+ "required": true
51
+ },
52
+ "vocal_gender": {
53
+ "enum": [
54
+ "male",
55
+ "female"
56
+ ]
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "add-vocals": {
62
+ "models": [
63
+ "suno-v4.5-plus",
64
+ "suno-v5"
65
+ ],
66
+ "fields_by_model": {
67
+ "suno-v4.5-plus": {
68
+ "lyrics": {
69
+ "required": true
70
+ },
71
+ "model": {
72
+ "required": true
73
+ },
74
+ "upload_url": {
75
+ "required": true
76
+ },
77
+ "vocal_gender": {
78
+ "enum": [
79
+ "male",
80
+ "female"
81
+ ]
82
+ }
83
+ },
84
+ "suno-v5": {
85
+ "lyrics": {
86
+ "required": true
87
+ },
88
+ "model": {
89
+ "required": true
90
+ },
91
+ "upload_url": {
92
+ "required": true
93
+ },
94
+ "vocal_gender": {
95
+ "enum": [
96
+ "male",
97
+ "female"
98
+ ]
99
+ }
100
+ }
101
+ }
102
+ },
103
+ "boost-style": {
104
+ "models": [],
105
+ "fields_by_model": {
106
+ "_": {}
107
+ }
108
+ },
109
+ "check-voice": {
110
+ "models": [],
111
+ "fields_by_model": {
112
+ "_": {
113
+ "task_id": {
114
+ "required": true
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "convert-audio": {
120
+ "models": [],
121
+ "fields_by_model": {
122
+ "_": {}
123
+ }
124
+ },
125
+ "cover-audio": {
126
+ "models": [
127
+ "suno-v4",
128
+ "suno-v4.5",
129
+ "suno-v4.5-all",
130
+ "suno-v4.5-plus",
131
+ "suno-v5",
132
+ "suno-v5.5"
133
+ ],
134
+ "fields_by_model": {
135
+ "suno-v4": {
136
+ "model": {
137
+ "required": true
138
+ },
139
+ "persona_type": {
140
+ "enum": [
141
+ "style",
142
+ "voice"
143
+ ]
144
+ },
145
+ "upload_url": {
146
+ "required": true
147
+ },
148
+ "vocal_gender": {
149
+ "enum": [
150
+ "male",
151
+ "female"
152
+ ]
153
+ },
154
+ "vocal_mode": {
155
+ "enum": [
156
+ "auto_lyrics",
157
+ "exact_lyrics",
158
+ "instrumental"
159
+ ],
160
+ "required": true
161
+ }
162
+ },
163
+ "suno-v4.5": {
164
+ "model": {
165
+ "required": true
166
+ },
167
+ "persona_type": {
168
+ "enum": [
169
+ "style",
170
+ "voice"
171
+ ]
172
+ },
173
+ "upload_url": {
174
+ "required": true
175
+ },
176
+ "vocal_gender": {
177
+ "enum": [
178
+ "male",
179
+ "female"
180
+ ]
181
+ },
182
+ "vocal_mode": {
183
+ "enum": [
184
+ "auto_lyrics",
185
+ "exact_lyrics",
186
+ "instrumental"
187
+ ],
188
+ "required": true
189
+ }
190
+ },
191
+ "suno-v4.5-all": {
192
+ "model": {
193
+ "required": true
194
+ },
195
+ "persona_type": {
196
+ "enum": [
197
+ "style",
198
+ "voice"
199
+ ]
200
+ },
201
+ "upload_url": {
202
+ "required": true
203
+ },
204
+ "vocal_gender": {
205
+ "enum": [
206
+ "male",
207
+ "female"
208
+ ]
209
+ },
210
+ "vocal_mode": {
211
+ "enum": [
212
+ "auto_lyrics",
213
+ "exact_lyrics",
214
+ "instrumental"
215
+ ],
216
+ "required": true
217
+ }
218
+ },
219
+ "suno-v4.5-plus": {
220
+ "model": {
221
+ "required": true
222
+ },
223
+ "persona_type": {
224
+ "enum": [
225
+ "style",
226
+ "voice"
227
+ ]
228
+ },
229
+ "upload_url": {
230
+ "required": true
231
+ },
232
+ "vocal_gender": {
233
+ "enum": [
234
+ "male",
235
+ "female"
236
+ ]
237
+ },
238
+ "vocal_mode": {
239
+ "enum": [
240
+ "auto_lyrics",
241
+ "exact_lyrics",
242
+ "instrumental"
243
+ ],
244
+ "required": true
245
+ }
246
+ },
247
+ "suno-v5": {
248
+ "model": {
249
+ "required": true
250
+ },
251
+ "persona_type": {
252
+ "enum": [
253
+ "style",
254
+ "voice"
255
+ ]
256
+ },
257
+ "upload_url": {
258
+ "required": true
259
+ },
260
+ "vocal_gender": {
261
+ "enum": [
262
+ "male",
263
+ "female"
264
+ ]
265
+ },
266
+ "vocal_mode": {
267
+ "enum": [
268
+ "auto_lyrics",
269
+ "exact_lyrics",
270
+ "instrumental"
271
+ ],
272
+ "required": true
273
+ }
274
+ },
275
+ "suno-v5.5": {
276
+ "model": {
277
+ "required": true
278
+ },
279
+ "persona_type": {
280
+ "enum": [
281
+ "style",
282
+ "voice"
283
+ ]
284
+ },
285
+ "upload_url": {
286
+ "required": true
287
+ },
288
+ "vocal_gender": {
289
+ "enum": [
290
+ "male",
291
+ "female"
292
+ ]
293
+ },
294
+ "vocal_mode": {
295
+ "enum": [
296
+ "auto_lyrics",
297
+ "exact_lyrics",
298
+ "instrumental"
299
+ ],
300
+ "required": true
301
+ }
302
+ }
303
+ },
304
+ "rules": [
305
+ {
306
+ "when": {
307
+ "vocal_mode": "auto_lyrics"
308
+ },
309
+ "required": [
310
+ "prompt"
311
+ ],
312
+ "forbidden": [
313
+ "lyrics",
314
+ "style",
315
+ "title"
316
+ ]
317
+ },
318
+ {
319
+ "when": {
320
+ "vocal_mode": "exact_lyrics"
321
+ },
322
+ "required": [
323
+ "lyrics",
324
+ "style",
325
+ "title"
326
+ ],
327
+ "forbidden": [
328
+ "prompt"
329
+ ]
330
+ },
331
+ {
332
+ "when": {
333
+ "vocal_mode": "instrumental"
334
+ },
335
+ "required": [
336
+ "style",
337
+ "title"
338
+ ],
339
+ "forbidden": [
340
+ "prompt",
341
+ "lyrics"
342
+ ]
343
+ }
344
+ ]
345
+ },
346
+ "create-mashup": {
347
+ "models": [
348
+ "suno-v4",
349
+ "suno-v4.5",
350
+ "suno-v4.5-all",
351
+ "suno-v4.5-plus",
352
+ "suno-v5",
353
+ "suno-v5.5"
354
+ ],
355
+ "fields_by_model": {
356
+ "suno-v4": {
357
+ "model": {
358
+ "required": true
359
+ },
360
+ "persona_type": {
361
+ "enum": [
362
+ "style",
363
+ "voice"
364
+ ]
365
+ },
366
+ "upload_url_list": {
367
+ "required": true
368
+ },
369
+ "vocal_gender": {
370
+ "enum": [
371
+ "male",
372
+ "female"
373
+ ]
374
+ },
375
+ "vocal_mode": {
376
+ "enum": [
377
+ "auto_lyrics",
378
+ "exact_lyrics",
379
+ "instrumental"
380
+ ],
381
+ "required": true
382
+ }
383
+ },
384
+ "suno-v4.5": {
385
+ "model": {
386
+ "required": true
387
+ },
388
+ "persona_type": {
389
+ "enum": [
390
+ "style",
391
+ "voice"
392
+ ]
393
+ },
394
+ "upload_url_list": {
395
+ "required": true
396
+ },
397
+ "vocal_gender": {
398
+ "enum": [
399
+ "male",
400
+ "female"
401
+ ]
402
+ },
403
+ "vocal_mode": {
404
+ "enum": [
405
+ "auto_lyrics",
406
+ "exact_lyrics",
407
+ "instrumental"
408
+ ],
409
+ "required": true
410
+ }
411
+ },
412
+ "suno-v4.5-all": {
413
+ "model": {
414
+ "required": true
415
+ },
416
+ "persona_type": {
417
+ "enum": [
418
+ "style",
419
+ "voice"
420
+ ]
421
+ },
422
+ "upload_url_list": {
423
+ "required": true
424
+ },
425
+ "vocal_gender": {
426
+ "enum": [
427
+ "male",
428
+ "female"
429
+ ]
430
+ },
431
+ "vocal_mode": {
432
+ "enum": [
433
+ "auto_lyrics",
434
+ "exact_lyrics",
435
+ "instrumental"
436
+ ],
437
+ "required": true
438
+ }
439
+ },
440
+ "suno-v4.5-plus": {
441
+ "model": {
442
+ "required": true
443
+ },
444
+ "persona_type": {
445
+ "enum": [
446
+ "style",
447
+ "voice"
448
+ ]
449
+ },
450
+ "upload_url_list": {
451
+ "required": true
452
+ },
453
+ "vocal_gender": {
454
+ "enum": [
455
+ "male",
456
+ "female"
457
+ ]
458
+ },
459
+ "vocal_mode": {
460
+ "enum": [
461
+ "auto_lyrics",
462
+ "exact_lyrics",
463
+ "instrumental"
464
+ ],
465
+ "required": true
466
+ }
467
+ },
468
+ "suno-v5": {
469
+ "model": {
470
+ "required": true
471
+ },
472
+ "persona_type": {
473
+ "enum": [
474
+ "style",
475
+ "voice"
476
+ ]
477
+ },
478
+ "upload_url_list": {
479
+ "required": true
480
+ },
481
+ "vocal_gender": {
482
+ "enum": [
483
+ "male",
484
+ "female"
485
+ ]
486
+ },
487
+ "vocal_mode": {
488
+ "enum": [
489
+ "auto_lyrics",
490
+ "exact_lyrics",
491
+ "instrumental"
492
+ ],
493
+ "required": true
494
+ }
495
+ },
496
+ "suno-v5.5": {
497
+ "model": {
498
+ "required": true
499
+ },
500
+ "persona_type": {
501
+ "enum": [
502
+ "style",
503
+ "voice"
504
+ ]
505
+ },
506
+ "upload_url_list": {
507
+ "required": true
508
+ },
509
+ "vocal_gender": {
510
+ "enum": [
511
+ "male",
512
+ "female"
513
+ ]
514
+ },
515
+ "vocal_mode": {
516
+ "enum": [
517
+ "auto_lyrics",
518
+ "exact_lyrics",
519
+ "instrumental"
520
+ ],
521
+ "required": true
522
+ }
523
+ }
524
+ },
525
+ "rules": [
526
+ {
527
+ "when": {
528
+ "vocal_mode": "auto_lyrics"
529
+ },
530
+ "required": [
531
+ "prompt"
532
+ ],
533
+ "forbidden": [
534
+ "lyrics",
535
+ "style",
536
+ "title"
537
+ ]
538
+ },
539
+ {
540
+ "when": {
541
+ "vocal_mode": "exact_lyrics"
542
+ },
543
+ "required": [
544
+ "lyrics",
545
+ "style",
546
+ "title"
547
+ ],
548
+ "forbidden": [
549
+ "prompt"
550
+ ]
551
+ },
552
+ {
553
+ "when": {
554
+ "vocal_mode": "instrumental"
555
+ },
556
+ "required": [
557
+ "style",
558
+ "title"
559
+ ],
560
+ "forbidden": [
561
+ "prompt",
562
+ "lyrics"
563
+ ]
564
+ }
565
+ ]
566
+ },
567
+ "extend-music": {
568
+ "models": [
569
+ "suno-v4",
570
+ "suno-v4.5",
571
+ "suno-v4.5-all",
572
+ "suno-v4.5-plus",
573
+ "suno-v5",
574
+ "suno-v5.5"
575
+ ],
576
+ "fields_by_model": {
577
+ "suno-v4": {
578
+ "model": {
579
+ "required": true
580
+ },
581
+ "parameter_mode": {
582
+ "enum": [
583
+ "source",
584
+ "custom"
585
+ ]
586
+ },
587
+ "persona_type": {
588
+ "enum": [
589
+ "style",
590
+ "voice"
591
+ ]
592
+ },
593
+ "vocal_gender": {
594
+ "enum": [
595
+ "male",
596
+ "female"
597
+ ]
598
+ }
599
+ },
600
+ "suno-v4.5": {
601
+ "model": {
602
+ "required": true
603
+ },
604
+ "parameter_mode": {
605
+ "enum": [
606
+ "source",
607
+ "custom"
608
+ ]
609
+ },
610
+ "persona_type": {
611
+ "enum": [
612
+ "style",
613
+ "voice"
614
+ ]
615
+ },
616
+ "vocal_gender": {
617
+ "enum": [
618
+ "male",
619
+ "female"
620
+ ]
621
+ }
622
+ },
623
+ "suno-v4.5-all": {
624
+ "model": {
625
+ "required": true
626
+ },
627
+ "parameter_mode": {
628
+ "enum": [
629
+ "source",
630
+ "custom"
631
+ ]
632
+ },
633
+ "persona_type": {
634
+ "enum": [
635
+ "style",
636
+ "voice"
637
+ ]
638
+ },
639
+ "vocal_gender": {
640
+ "enum": [
641
+ "male",
642
+ "female"
643
+ ]
644
+ }
645
+ },
646
+ "suno-v4.5-plus": {
647
+ "model": {
648
+ "required": true
649
+ },
650
+ "parameter_mode": {
651
+ "enum": [
652
+ "source",
653
+ "custom"
654
+ ]
655
+ },
656
+ "persona_type": {
657
+ "enum": [
658
+ "style",
659
+ "voice"
660
+ ]
661
+ },
662
+ "vocal_gender": {
663
+ "enum": [
664
+ "male",
665
+ "female"
666
+ ]
667
+ }
668
+ },
669
+ "suno-v5": {
670
+ "model": {
671
+ "required": true
672
+ },
673
+ "parameter_mode": {
674
+ "enum": [
675
+ "source",
676
+ "custom"
677
+ ]
678
+ },
679
+ "persona_type": {
680
+ "enum": [
681
+ "style",
682
+ "voice"
683
+ ]
684
+ },
685
+ "vocal_gender": {
686
+ "enum": [
687
+ "male",
688
+ "female"
689
+ ]
690
+ }
691
+ },
692
+ "suno-v5.5": {
693
+ "model": {
694
+ "required": true
695
+ },
696
+ "parameter_mode": {
697
+ "enum": [
698
+ "source",
699
+ "custom"
700
+ ]
701
+ },
702
+ "persona_type": {
703
+ "enum": [
704
+ "style",
705
+ "voice"
706
+ ]
707
+ },
708
+ "vocal_gender": {
709
+ "enum": [
710
+ "male",
711
+ "female"
712
+ ]
713
+ }
714
+ }
715
+ }
716
+ },
717
+ "generate-artwork": {
718
+ "models": [],
719
+ "fields_by_model": {
720
+ "_": {
721
+ "task_id": {
722
+ "required": true
723
+ }
724
+ }
725
+ }
726
+ },
727
+ "generate-lyrics": {
728
+ "models": [],
729
+ "fields_by_model": {
730
+ "_": {}
731
+ }
732
+ },
733
+ "generate-midi": {
734
+ "models": [],
735
+ "fields_by_model": {
736
+ "_": {}
737
+ }
738
+ },
739
+ "generate-persona": {
740
+ "models": [],
741
+ "fields_by_model": {
742
+ "_": {}
743
+ }
744
+ },
745
+ "generate-voice": {
746
+ "models": [],
747
+ "fields_by_model": {
748
+ "_": {
749
+ "singer_skill_level": {
750
+ "enum": [
751
+ "beginner",
752
+ "intermediate",
753
+ "advanced",
754
+ "professional"
755
+ ]
756
+ },
757
+ "task_id": {
758
+ "required": true
759
+ },
760
+ "verify_url": {
761
+ "required": true
762
+ }
763
+ }
764
+ }
765
+ },
766
+ "get-timestamped-lyrics": {
767
+ "models": [],
768
+ "fields_by_model": {
769
+ "_": {}
770
+ }
771
+ },
772
+ "regenerate-validation-phrase": {
773
+ "models": [],
774
+ "fields_by_model": {
775
+ "_": {
776
+ "task_id": {
777
+ "required": true
778
+ }
779
+ }
780
+ }
781
+ },
782
+ "replace-section": {
783
+ "models": [],
784
+ "fields_by_model": {
785
+ "_": {
786
+ "full_lyrics": {
787
+ "required": true
788
+ },
789
+ "infill_end_time": {
790
+ "required": true
791
+ },
792
+ "infill_start_time": {
793
+ "required": true
794
+ },
795
+ "lyrics": {
796
+ "required": true
797
+ },
798
+ "model": {
799
+ "enum": [
800
+ "suno-v4",
801
+ "suno-v4.5",
802
+ "suno-v4.5-all",
803
+ "suno-v4.5-plus",
804
+ "suno-v5",
805
+ "suno-v5.5"
806
+ ]
807
+ },
808
+ "tags": {
809
+ "required": true
810
+ },
811
+ "title": {
812
+ "required": true
813
+ }
814
+ }
815
+ }
816
+ },
817
+ "separate-audio-stems": {
818
+ "models": [],
819
+ "fields_by_model": {
820
+ "_": {
821
+ "audio_id": {
822
+ "required": true
823
+ },
824
+ "task_id": {
825
+ "required": true
826
+ }
827
+ }
828
+ }
829
+ },
830
+ "text-to-music": {
831
+ "models": [
832
+ "suno-v4",
833
+ "suno-v4.5",
834
+ "suno-v4.5-all",
835
+ "suno-v4.5-plus",
836
+ "suno-v5",
837
+ "suno-v5.5"
838
+ ],
839
+ "fields_by_model": {
840
+ "suno-v4": {
841
+ "duration_seconds": {
842
+ "type": "integer"
843
+ },
844
+ "model": {
845
+ "required": true
846
+ },
847
+ "persona_type": {
848
+ "enum": [
849
+ "style",
850
+ "voice"
851
+ ]
852
+ },
853
+ "vocal_gender": {
854
+ "enum": [
855
+ "male",
856
+ "female"
857
+ ]
858
+ },
859
+ "vocal_mode": {
860
+ "enum": [
861
+ "auto_lyrics",
862
+ "exact_lyrics",
863
+ "instrumental"
864
+ ],
865
+ "required": true
866
+ }
867
+ },
868
+ "suno-v4.5": {
869
+ "duration_seconds": {
870
+ "type": "integer"
871
+ },
872
+ "model": {
873
+ "required": true
874
+ },
875
+ "persona_type": {
876
+ "enum": [
877
+ "style",
878
+ "voice"
879
+ ]
880
+ },
881
+ "vocal_gender": {
882
+ "enum": [
883
+ "male",
884
+ "female"
885
+ ]
886
+ },
887
+ "vocal_mode": {
888
+ "enum": [
889
+ "auto_lyrics",
890
+ "exact_lyrics",
891
+ "instrumental"
892
+ ],
893
+ "required": true
894
+ }
895
+ },
896
+ "suno-v4.5-all": {
897
+ "duration_seconds": {
898
+ "type": "integer"
899
+ },
900
+ "model": {
901
+ "required": true
902
+ },
903
+ "persona_type": {
904
+ "enum": [
905
+ "style",
906
+ "voice"
907
+ ]
908
+ },
909
+ "vocal_gender": {
910
+ "enum": [
911
+ "male",
912
+ "female"
913
+ ]
914
+ },
915
+ "vocal_mode": {
916
+ "enum": [
917
+ "auto_lyrics",
918
+ "exact_lyrics",
919
+ "instrumental"
920
+ ],
921
+ "required": true
922
+ }
923
+ },
924
+ "suno-v4.5-plus": {
925
+ "duration_seconds": {
926
+ "type": "integer"
927
+ },
928
+ "model": {
929
+ "required": true
930
+ },
931
+ "persona_type": {
932
+ "enum": [
933
+ "style",
934
+ "voice"
935
+ ]
936
+ },
937
+ "vocal_gender": {
938
+ "enum": [
939
+ "male",
940
+ "female"
941
+ ]
942
+ },
943
+ "vocal_mode": {
944
+ "enum": [
945
+ "auto_lyrics",
946
+ "exact_lyrics",
947
+ "instrumental"
948
+ ],
949
+ "required": true
950
+ }
951
+ },
952
+ "suno-v5": {
953
+ "duration_seconds": {
954
+ "type": "integer"
955
+ },
956
+ "model": {
957
+ "required": true
958
+ },
959
+ "persona_type": {
960
+ "enum": [
961
+ "style",
962
+ "voice"
963
+ ]
964
+ },
965
+ "vocal_gender": {
966
+ "enum": [
967
+ "male",
968
+ "female"
969
+ ]
970
+ },
971
+ "vocal_mode": {
972
+ "enum": [
973
+ "auto_lyrics",
974
+ "exact_lyrics",
975
+ "instrumental"
976
+ ],
977
+ "required": true
978
+ }
979
+ },
980
+ "suno-v5.5": {
981
+ "duration_seconds": {
982
+ "type": "integer"
983
+ },
984
+ "model": {
985
+ "required": true
986
+ },
987
+ "persona_type": {
988
+ "enum": [
989
+ "style",
990
+ "voice"
991
+ ]
992
+ },
993
+ "vocal_gender": {
994
+ "enum": [
995
+ "male",
996
+ "female"
997
+ ]
998
+ },
999
+ "vocal_mode": {
1000
+ "enum": [
1001
+ "auto_lyrics",
1002
+ "exact_lyrics",
1003
+ "instrumental"
1004
+ ],
1005
+ "required": true
1006
+ }
1007
+ }
1008
+ },
1009
+ "rules": [
1010
+ {
1011
+ "when": {
1012
+ "vocal_mode": "auto_lyrics"
1013
+ },
1014
+ "required": [
1015
+ "prompt"
1016
+ ],
1017
+ "forbidden": [
1018
+ "lyrics",
1019
+ "style",
1020
+ "title"
1021
+ ]
1022
+ },
1023
+ {
1024
+ "when": {
1025
+ "vocal_mode": "exact_lyrics"
1026
+ },
1027
+ "required": [
1028
+ "lyrics",
1029
+ "style",
1030
+ "title"
1031
+ ],
1032
+ "forbidden": [
1033
+ "prompt"
1034
+ ]
1035
+ },
1036
+ {
1037
+ "when": {
1038
+ "vocal_mode": "instrumental"
1039
+ },
1040
+ "required": [
1041
+ "style",
1042
+ "title"
1043
+ ],
1044
+ "forbidden": [
1045
+ "prompt",
1046
+ "lyrics"
1047
+ ]
1048
+ }
1049
+ ]
1050
+ },
1051
+ "text-to-sound": {
1052
+ "models": [
1053
+ "suno-v5",
1054
+ "suno-v5.5"
1055
+ ],
1056
+ "fields_by_model": {
1057
+ "suno-v5": {
1058
+ "model": {
1059
+ "required": true
1060
+ },
1061
+ "prompt": {
1062
+ "required": true
1063
+ },
1064
+ "sound_key": {
1065
+ "enum": [
1066
+ "Cm",
1067
+ "C#m",
1068
+ "Dm",
1069
+ "D#m",
1070
+ "Em",
1071
+ "Fm",
1072
+ "F#m",
1073
+ "Gm",
1074
+ "G#m",
1075
+ "Am",
1076
+ "A#m",
1077
+ "Bm",
1078
+ "C",
1079
+ "C#",
1080
+ "D",
1081
+ "D#",
1082
+ "E",
1083
+ "F",
1084
+ "F#",
1085
+ "G",
1086
+ "G#",
1087
+ "A",
1088
+ "A#",
1089
+ "B"
1090
+ ]
1091
+ },
1092
+ "sound_tempo": {
1093
+ "type": "integer"
1094
+ }
1095
+ },
1096
+ "suno-v5.5": {
1097
+ "model": {
1098
+ "required": true
1099
+ },
1100
+ "prompt": {
1101
+ "required": true
1102
+ },
1103
+ "sound_key": {
1104
+ "enum": [
1105
+ "Cm",
1106
+ "C#m",
1107
+ "Dm",
1108
+ "D#m",
1109
+ "Em",
1110
+ "Fm",
1111
+ "F#m",
1112
+ "Gm",
1113
+ "G#m",
1114
+ "Am",
1115
+ "A#m",
1116
+ "Bm",
1117
+ "C",
1118
+ "C#",
1119
+ "D",
1120
+ "D#",
1121
+ "E",
1122
+ "F",
1123
+ "F#",
1124
+ "G",
1125
+ "G#",
1126
+ "A",
1127
+ "A#",
1128
+ "B"
1129
+ ]
1130
+ },
1131
+ "sound_tempo": {
1132
+ "type": "integer"
1133
+ }
1134
+ }
1135
+ }
1136
+ },
1137
+ "visualize-music": {
1138
+ "models": [],
1139
+ "fields_by_model": {
1140
+ "_": {}
1141
+ }
1142
+ },
1143
+ "voice-to-validation-phrase": {
1144
+ "models": [],
1145
+ "fields_by_model": {
1146
+ "_": {
1147
+ "language": {
1148
+ "enum": [
1149
+ "en",
1150
+ "zh",
1151
+ "es",
1152
+ "fr",
1153
+ "pt",
1154
+ "de",
1155
+ "ja",
1156
+ "ko",
1157
+ "hi",
1158
+ "ru"
1159
+ ]
1160
+ },
1161
+ "vocal_end_seconds": {
1162
+ "required": true,
1163
+ "type": "integer"
1164
+ },
1165
+ "vocal_start_seconds": {
1166
+ "required": true,
1167
+ "type": "integer"
1168
+ }
1169
+ }
1170
+ }
1171
+ }
1172
+ };
1173
+
1174
+ // src/resources/text-to-music.ts
7
1175
  var ENDPOINT = "/api/v1/suno/text_to_music";
8
1176
  var TextToMusic = class {
9
1177
  constructor(http) {
@@ -31,8 +1199,10 @@ var TextToMusic = class {
31
1199
  * @returns The task creation result.
32
1200
  */
33
1201
  async create(params, options) {
1202
+ const body = compactParams(params);
1203
+ validateParams(contract["text-to-music"], body);
34
1204
  return this.http.request("POST", ENDPOINT, {
35
- body: compactParams(params),
1205
+ body,
36
1206
  ...options
37
1207
  });
38
1208
  }
@@ -146,7 +1316,7 @@ var GenerateArtwork = class {
146
1316
  };
147
1317
 
148
1318
  // src/resources/cover-audio.ts
149
- import { compactParams as compactParams4 } from "@runapi.ai/core";
1319
+ import { compactParams as compactParams4, validateParams as validateParams2 } from "@runapi.ai/core";
150
1320
  import { pollUntilComplete as pollUntilComplete4 } from "@runapi.ai/core/internal";
151
1321
  var ENDPOINT4 = "/api/v1/suno/cover_audio";
152
1322
  var CoverAudio = class {
@@ -175,8 +1345,10 @@ var CoverAudio = class {
175
1345
  * @returns The task creation result.
176
1346
  */
177
1347
  async create(params, options) {
1348
+ const body = compactParams4(params);
1349
+ validateParams2(contract["cover-audio"], body);
178
1350
  return this.http.request("POST", ENDPOINT4, {
179
- body: compactParams4(params),
1351
+ body,
180
1352
  ...options
181
1353
  });
182
1354
  }
@@ -552,7 +1724,7 @@ var GetTimestampedLyrics = class {
552
1724
  };
553
1725
 
554
1726
  // src/resources/replace-section.ts
555
- import { compactParams as compactParams13 } from "@runapi.ai/core";
1727
+ import { compactParams as compactParams13, validateParams as validateParams3, ValidationError } from "@runapi.ai/core";
556
1728
  import { pollUntilComplete as pollUntilComplete12 } from "@runapi.ai/core/internal";
557
1729
  var ENDPOINT13 = "/api/v1/suno/replace_section";
558
1730
  var ReplaceSection = class {
@@ -581,8 +1753,11 @@ var ReplaceSection = class {
581
1753
  * @returns The task creation result.
582
1754
  */
583
1755
  async create(params, options) {
1756
+ const body = compactParams13(params);
1757
+ validateParams3(contract["replace-section"], body);
1758
+ validateReplaceSection(body);
584
1759
  return this.http.request("POST", ENDPOINT13, {
585
- body: compactParams13(params),
1760
+ body,
586
1761
  ...options
587
1762
  });
588
1763
  }
@@ -598,9 +1773,62 @@ var ReplaceSection = class {
598
1773
  });
599
1774
  }
600
1775
  };
1776
+ function validateReplaceSection(body) {
1777
+ validateReplaceSectionSource(body);
1778
+ const startTime = body.infill_start_time;
1779
+ const endTime = body.infill_end_time;
1780
+ if (typeof startTime !== "number" || Number.isNaN(startTime)) {
1781
+ throw new ValidationError("infill_start_time must be a number");
1782
+ }
1783
+ if (typeof endTime !== "number" || Number.isNaN(endTime)) {
1784
+ throw new ValidationError("infill_end_time must be a number");
1785
+ }
1786
+ if (endTime <= startTime) {
1787
+ throw new ValidationError("infill_end_time must be greater than infill_start_time");
1788
+ }
1789
+ const duration = endTime - startTime;
1790
+ if (duration < 6 || duration > 60) {
1791
+ throw new ValidationError("replacement duration must be between 6 and 60 seconds");
1792
+ }
1793
+ }
1794
+ function validateReplaceSectionSource(body) {
1795
+ const hasExistingSource = isPresent(body.task_id) || isPresent(body.audio_id);
1796
+ const hasUploadedSource = isPresent(body.upload_url) || isPresent(body.model);
1797
+ if (hasExistingSource && hasUploadedSource) {
1798
+ throw new ValidationError("task_id/audio_id cannot be combined with upload_url/model");
1799
+ }
1800
+ if (hasExistingSource) {
1801
+ requireField(body, "task_id");
1802
+ requireField(body, "audio_id");
1803
+ return;
1804
+ }
1805
+ if (hasUploadedSource) {
1806
+ requireField(body, "upload_url");
1807
+ requireField(body, "model");
1808
+ return;
1809
+ }
1810
+ throw new ValidationError("task_id and audio_id, or upload_url and model are required");
1811
+ }
1812
+ function requireField(body, field) {
1813
+ if (!isPresent(body[field])) {
1814
+ throw new ValidationError(`${field} is required`);
1815
+ }
1816
+ }
1817
+ function isPresent(value) {
1818
+ if (value === void 0 || value === null) {
1819
+ return false;
1820
+ }
1821
+ if (typeof value === "string") {
1822
+ return value.length > 0;
1823
+ }
1824
+ if (Array.isArray(value)) {
1825
+ return value.length > 0;
1826
+ }
1827
+ return true;
1828
+ }
601
1829
 
602
1830
  // src/resources/create-mashup.ts
603
- import { compactParams as compactParams14 } from "@runapi.ai/core";
1831
+ import { compactParams as compactParams14, validateParams as validateParams4 } from "@runapi.ai/core";
604
1832
  import { pollUntilComplete as pollUntilComplete13 } from "@runapi.ai/core/internal";
605
1833
  var ENDPOINT14 = "/api/v1/suno/create_mashup";
606
1834
  var CreateMashup = class {
@@ -629,8 +1857,10 @@ var CreateMashup = class {
629
1857
  * @returns The task creation result.
630
1858
  */
631
1859
  async create(params, options) {
1860
+ const body = compactParams14(params);
1861
+ validateParams4(contract["create-mashup"], body);
632
1862
  return this.http.request("POST", ENDPOINT14, {
633
- body: compactParams14(params),
1863
+ body,
634
1864
  ...options
635
1865
  });
636
1866
  }
@@ -981,7 +2211,7 @@ import {
981
2211
  AuthenticationError,
982
2212
  InsufficientCreditsError,
983
2213
  NotFoundError,
984
- ValidationError,
2214
+ ValidationError as ValidationError2,
985
2215
  RateLimitError,
986
2216
  ServiceUnavailableError,
987
2217
  NetworkError,
@@ -1001,6 +2231,6 @@ export {
1001
2231
  TaskFailedError,
1002
2232
  TaskTimeoutError,
1003
2233
  TimeoutError,
1004
- ValidationError
2234
+ ValidationError2 as ValidationError
1005
2235
  };
1006
2236
  //# sourceMappingURL=index.mjs.map