@apicity/kie 0.5.4 → 0.6.1

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/src/zod.js CHANGED
@@ -25,6 +25,7 @@ export const KieMediaModelSchema = z.enum([
25
25
  "qwen2/image-edit",
26
26
  "bytedance/seedance-2-fast",
27
27
  "bytedance/seedance-2",
28
+ "bytedance/seedance-2-mini",
28
29
  "wan/2-7-image-to-video",
29
30
  "wan/2-7-text-to-video",
30
31
  "wan/2-7-r2v",
@@ -35,8 +36,12 @@ export const KieMediaModelSchema = z.enum([
35
36
  "happyhorse/image-to-video",
36
37
  "happyhorse/reference-to-video",
37
38
  "happyhorse/video-edit",
39
+ "happyhorse-1-1/text-to-video",
40
+ "happyhorse-1-1/image-to-video",
41
+ "happyhorse-1-1/reference-to-video",
38
42
  "omnihuman-1-5",
39
43
  "volcengine/video-to-video-lip-sync",
44
+ "gemini-omni-video",
40
45
  "elevenlabs/audio-isolation",
41
46
  "elevenlabs/text-to-dialogue-v3",
42
47
  "elevenlabs/text-to-speech-multilingual-v2",
@@ -50,6 +55,194 @@ export const MediaTypeSchema = z.enum([
50
55
  "audio",
51
56
  "transcription",
52
57
  ]);
58
+ export const GeminiOmniAudioVoiceIds = [
59
+ "achernar",
60
+ "achird",
61
+ "algenib",
62
+ "algieba",
63
+ "alnilam",
64
+ "aoede",
65
+ "autonoe",
66
+ "callirrhoe",
67
+ "charon",
68
+ "despina",
69
+ "enceladus",
70
+ "erinome",
71
+ "fenrir",
72
+ "gacrux",
73
+ "iapetus",
74
+ "kore",
75
+ "laomedeia",
76
+ "leda",
77
+ "orus",
78
+ "puck",
79
+ "pulcherrima",
80
+ "rasalgethi",
81
+ "sadachbia",
82
+ "sadaltager",
83
+ "schedar",
84
+ "sulafat",
85
+ "umbriel",
86
+ "vindemiatrix",
87
+ "zephyr",
88
+ "zubenelgenubi",
89
+ ];
90
+ export const GeminiOmniAudioVoiceIdSchema = z.enum(GeminiOmniAudioVoiceIds);
91
+ export const KieGeminiRoleSchema = z.enum(["user", "model"]);
92
+ export const KieGeminiThinkingLevelSchema = z.enum(["low", "high"]);
93
+ export const KieGeminiInlineDataSchema = z.object({
94
+ mime_type: z.string().min(1),
95
+ data: z.string().min(1),
96
+ });
97
+ export const KieGeminiFileDataSchema = z.object({
98
+ mime_type: z.string().min(1),
99
+ file_uri: z.string().min(1),
100
+ });
101
+ export const KieGeminiPartSchema = z
102
+ .object({
103
+ text: z.string().optional(),
104
+ inline_data: KieGeminiInlineDataSchema.optional(),
105
+ file_data: KieGeminiFileDataSchema.optional(),
106
+ })
107
+ .strict()
108
+ .refine((part) => part.text !== undefined ||
109
+ part.inline_data !== undefined ||
110
+ part.file_data !== undefined, {
111
+ message: "parts entries must include text, inline_data, or file_data",
112
+ });
113
+ export const KieGeminiContentSchema = z.object({
114
+ role: KieGeminiRoleSchema,
115
+ parts: z.array(KieGeminiPartSchema).min(1),
116
+ });
117
+ export const KieGeminiFunctionParametersSchema = z
118
+ .object({
119
+ type: z.string().optional(),
120
+ properties: z.record(z.string(), z.unknown()).optional(),
121
+ required: z.array(z.string()).optional(),
122
+ })
123
+ .passthrough();
124
+ export const KieGeminiFunctionDeclarationSchema = z
125
+ .object({
126
+ name: z.string().min(1),
127
+ description: z.string().optional(),
128
+ parameters: KieGeminiFunctionParametersSchema.optional(),
129
+ })
130
+ .passthrough();
131
+ export const KieGeminiGoogleSearchSchema = z.object({}).strict();
132
+ export const KieGeminiGoogleSearchToolSchema = z
133
+ .object({
134
+ googleSearch: KieGeminiGoogleSearchSchema,
135
+ })
136
+ .strict();
137
+ export const KieGeminiFunctionDeclarationsToolSchema = z
138
+ .object({
139
+ functionDeclarations: z.array(KieGeminiFunctionDeclarationSchema).min(1),
140
+ })
141
+ .strict();
142
+ export const KieGeminiToolSchema = z
143
+ .object({
144
+ googleSearch: KieGeminiGoogleSearchSchema.optional(),
145
+ functionDeclarations: z
146
+ .array(KieGeminiFunctionDeclarationSchema)
147
+ .min(1)
148
+ .optional(),
149
+ })
150
+ .strict()
151
+ .refine((tool) => tool.googleSearch !== undefined ||
152
+ tool.functionDeclarations !== undefined, {
153
+ message: "tools entries must include googleSearch or functionDeclarations",
154
+ });
155
+ export const KieGeminiThinkingConfigSchema = z
156
+ .object({
157
+ includeThoughts: z.boolean().optional(),
158
+ thinkingLevel: KieGeminiThinkingLevelSchema.optional(),
159
+ })
160
+ .strict();
161
+ export const KieGeminiGenerationConfigSchema = z
162
+ .object({
163
+ temperature: z.number().optional(),
164
+ topP: z.number().optional(),
165
+ topK: z.number().optional(),
166
+ candidateCount: z.number().int().positive().optional(),
167
+ maxOutputTokens: z.number().int().positive().optional(),
168
+ stopSequences: z.array(z.string()).optional(),
169
+ thinkingConfig: KieGeminiThinkingConfigSchema.optional(),
170
+ })
171
+ .passthrough();
172
+ export const KieGemini35FlashStreamGenerateContentRequestSchema = z
173
+ .object({
174
+ stream: z.boolean().default(true),
175
+ contents: z.array(KieGeminiContentSchema).min(1),
176
+ tools: z.array(KieGeminiToolSchema).optional(),
177
+ generationConfig: KieGeminiGenerationConfigSchema.optional(),
178
+ })
179
+ .passthrough();
180
+ export const KieGemini31ProMessageRoleSchema = z.enum([
181
+ "developer",
182
+ "system",
183
+ "user",
184
+ "assistant",
185
+ "tool",
186
+ ]);
187
+ export const KieGemini31ProContentItemTypeSchema = z.enum([
188
+ "text",
189
+ "image_url",
190
+ ]);
191
+ export const KieGemini31ProReasoningEffortSchema = z.enum(["low", "high"]);
192
+ export const KieGemini31ProToolTypeSchema = z.enum(["function"]);
193
+ export const KieGemini31ProToolFunctionNameSchema = z.enum(["googleSearch"]);
194
+ export const KieGemini31ProTextContentItemSchema = z
195
+ .object({
196
+ type: z.literal("text"),
197
+ text: z.string(),
198
+ })
199
+ .strict();
200
+ export const KieGemini31ProMediaContentItemSchema = z
201
+ .object({
202
+ type: z.literal("image_url"),
203
+ image_url: z.object({ url: z.string().url() }).strict(),
204
+ })
205
+ .strict();
206
+ export const KieGemini31ProContentItemSchema = z.discriminatedUnion("type", [
207
+ KieGemini31ProTextContentItemSchema,
208
+ KieGemini31ProMediaContentItemSchema,
209
+ ]);
210
+ export const KieGemini31ProMessageSchema = z
211
+ .object({
212
+ role: KieGemini31ProMessageRoleSchema,
213
+ content: z.array(KieGemini31ProContentItemSchema).min(1),
214
+ })
215
+ .passthrough();
216
+ export const KieGemini31ProToolFunctionParametersSchema = z
217
+ .object({
218
+ type: z.literal("object"),
219
+ properties: z.record(z.string(), z.unknown()).optional(),
220
+ required: z.array(z.string()).optional(),
221
+ })
222
+ .passthrough();
223
+ export const KieGemini31ProToolFunctionSchema = z
224
+ .object({
225
+ name: KieGemini31ProToolFunctionNameSchema,
226
+ description: z.string().optional(),
227
+ parameters: KieGemini31ProToolFunctionParametersSchema.optional(),
228
+ })
229
+ .passthrough();
230
+ export const KieGemini31ProToolSchema = z
231
+ .object({
232
+ type: KieGemini31ProToolTypeSchema,
233
+ function: KieGemini31ProToolFunctionSchema,
234
+ })
235
+ .strict();
236
+ export const KieGemini31ProChatCompletionsRequestSchema = z
237
+ .object({
238
+ model: z.literal("gemini-3.1-pro").optional(),
239
+ messages: z.array(KieGemini31ProMessageSchema).min(1),
240
+ stream: z.boolean().default(true),
241
+ tools: z.array(KieGemini31ProToolSchema).min(0).optional(),
242
+ include_thoughts: z.boolean().default(true),
243
+ reasoning_effort: KieGemini31ProReasoningEffortSchema.default("high"),
244
+ })
245
+ .passthrough();
53
246
  export const KlingDurationSchema = z.enum([
54
247
  "3",
55
248
  "4",
@@ -73,7 +266,25 @@ export const KlingV3TurboDurationSchema = z.union([
73
266
  z.number().int().positive(),
74
267
  z.string().regex(/^[1-9]\d*$/),
75
268
  ]);
269
+ export const GrokTextToVideoModeSchema = z.enum(["fun", "normal", "spicy"]);
270
+ export const GrokImageToVideoModeSchema = z.enum(["fun", "normal", "spicy"]);
76
271
  export const GrokImagineModeSchema = z.enum(["fun", "normal", "spicy"]);
272
+ export const GrokTextToVideoAspectRatioSchema = z.enum([
273
+ "2:3",
274
+ "3:2",
275
+ "1:1",
276
+ "16:9",
277
+ "9:16",
278
+ ]);
279
+ export const GrokImageToVideoAspectRatioSchema = z.enum([
280
+ "2:3",
281
+ "3:2",
282
+ "1:1",
283
+ "16:9",
284
+ "9:16",
285
+ ]);
286
+ export const GrokTextToVideoDurationSchema = z.number().int().min(6).max(30);
287
+ export const GrokImageToVideoDurationSchema = z.number().int().min(6).max(30);
77
288
  export const GrokImagineDurationSchema = z.enum(["6", "10"]);
78
289
  export const GrokImagineResolutionSchema = z.enum(["480p", "720p"]);
79
290
  const GROK_IMAGINE_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".webp"];
@@ -138,6 +349,18 @@ export const Wan27ImageAspectRatioSchema = z.enum([
138
349
  "8:1",
139
350
  "1:8",
140
351
  ]);
352
+ export const Wan27VideoEditDurationValues = [
353
+ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10,
354
+ ];
355
+ export const Wan27VideoEditDurationSchema = z
356
+ .number()
357
+ .int()
358
+ .min(0)
359
+ .max(10)
360
+ .refine((duration) => duration === 0 || duration >= 2, {
361
+ message: "Duration must be 0 or an integer from 2 to 10.",
362
+ })
363
+ .describe("Duration in seconds, 0 or 2-10.");
141
364
  export const HappyHorseResolutionSchema = z.enum(["720p", "1080p"]);
142
365
  export const HappyHorseAspectRatioSchema = z.enum([
143
366
  "16:9",
@@ -146,12 +369,48 @@ export const HappyHorseAspectRatioSchema = z.enum([
146
369
  "4:3",
147
370
  "3:4",
148
371
  ]);
372
+ export const HappyHorse11AspectRatioSchema = z.enum([
373
+ "16:9",
374
+ "9:16",
375
+ "3:4",
376
+ "4:3",
377
+ "4:5",
378
+ "5:4",
379
+ "1:1",
380
+ "9:21",
381
+ "21:9",
382
+ ]);
149
383
  export const HappyHorseAudioSettingSchema = z.enum(["auto", "origin"]);
384
+ export const HAPPYHORSE_DURATION_MIN_SECONDS = 3;
385
+ export const HAPPYHORSE_DURATION_MAX_SECONDS = 15;
386
+ export const HappyHorseDurationSchema = z
387
+ .number()
388
+ .int()
389
+ .min(HAPPYHORSE_DURATION_MIN_SECONDS)
390
+ .max(HAPPYHORSE_DURATION_MAX_SECONDS);
150
391
  export const Omnihuman15OutputResolutionSchema = z.enum(["720", "1080"]);
151
392
  export const VolcengineVideoToVideoLipSyncModeSchema = z.enum([
152
393
  "lite",
153
394
  "basic",
154
395
  ]);
396
+ export const GeminiOmniVideoDurationSchema = z.enum(["4", "6", "8", "10"]);
397
+ export const GeminiOmniVideoAspectRatioSchema = z.enum(["16:9", "9:16"]);
398
+ export const GeminiOmniVideoResolutionSchema = z.enum(["720p", "1080p", "4k"]);
399
+ export const Seedance2MiniResolutionSchema = z.enum(["480p", "720p"]);
400
+ export const Seedance2MiniAspectRatioSchema = z.enum([
401
+ "16:9",
402
+ "4:3",
403
+ "1:1",
404
+ "3:4",
405
+ "9:16",
406
+ "21:9",
407
+ "adaptive",
408
+ ]);
409
+ export const Seedance2MiniTaskStateSchema = z.enum([
410
+ "waiting",
411
+ "success",
412
+ "fail",
413
+ ]);
155
414
  // ---------------------------------------------------------------------------
156
415
  // Sub-schemas (composable building blocks)
157
416
  // ---------------------------------------------------------------------------
@@ -272,26 +531,19 @@ export const GrokTextToVideoRequestSchema = z.object({
272
531
  callBackUrl: z.string().optional(),
273
532
  input: z.object({
274
533
  prompt: z.string().min(1).max(5000),
275
- aspect_ratio: z.enum(["2:3", "3:2", "1:1", "16:9", "9:16"]).optional(),
276
- mode: GrokImagineModeSchema.optional(),
277
- duration: z.number().int().min(6).max(30).optional(),
534
+ aspect_ratio: GrokTextToVideoAspectRatioSchema.optional(),
535
+ mode: GrokTextToVideoModeSchema.optional(),
536
+ duration: GrokTextToVideoDurationSchema.optional(),
278
537
  resolution: GrokImagineResolutionSchema.optional(),
279
538
  nsfw_checker: z.boolean().default(false),
280
539
  }),
281
540
  });
282
- // KIE now documents numeric seconds for Grok Imagine 1.5 image-to-video, while
283
- // older recordings and callers used bare digit strings. Accept both to preserve
284
- // compatibility while making the current numeric shape valid.
285
- export const GrokImageToVideoDurationSchema = z.union([
286
- z.number().int().min(6).max(30),
287
- z.string().regex(/^([6-9]|[12][0-9]|30)$/),
288
- ]);
289
541
  export const GrokImageToVideoRequestSchema = z
290
542
  .object({
291
543
  model: z.literal("grok-imagine/image-to-video"),
292
544
  callBackUrl: z.string().url().optional(),
293
545
  input: z.object({
294
- prompt: z.string().max(5000).optional(),
546
+ prompt: z.string().max(4096).optional(),
295
547
  image_urls: z
296
548
  .array(GrokImagineImageUrlSchema)
297
549
  .min(1)
@@ -299,12 +551,10 @@ export const GrokImageToVideoRequestSchema = z
299
551
  .optional(),
300
552
  task_id: z.string().min(1).max(100).optional(),
301
553
  index: z.number().int().min(0).max(5).default(0),
302
- mode: GrokImagineModeSchema.default("normal"),
554
+ mode: GrokImageToVideoModeSchema.default("normal"),
303
555
  duration: GrokImageToVideoDurationSchema.default(6),
304
556
  resolution: GrokImagineResolutionSchema.default("480p"),
305
- aspect_ratio: z
306
- .enum(["2:3", "3:2", "1:1", "16:9", "9:16"])
307
- .default("16:9"),
557
+ aspect_ratio: GrokImageToVideoAspectRatioSchema.default("16:9"),
308
558
  nsfw_checker: z.boolean().default(false),
309
559
  }),
310
560
  })
@@ -463,6 +713,23 @@ export const Seedance2RequestSchema = Seedance2RequestObjectSchema.refine((v) =>
463
713
  message: "bytedance/seedance-2 does not accept reference_image_urls, reference_video_urls, or reference_audio_urls combined with first_frame_url or last_frame_url (these scenarios are mutually exclusive)",
464
714
  path: ["input", "reference_image_urls"],
465
715
  });
716
+ export const Seedance2MiniInputSchema = z.object({
717
+ prompt: z.string().max(20000).optional(),
718
+ reference_image_urls: z.array(z.string().url()).default([]),
719
+ reference_video_urls: z.array(z.string().url()).max(3).default([]),
720
+ reference_audio_urls: z.array(z.string().url()).max(3).default([]),
721
+ generate_audio: z.boolean().default(true),
722
+ resolution: Seedance2MiniResolutionSchema.default("720p"),
723
+ aspect_ratio: Seedance2MiniAspectRatioSchema.default("16:9"),
724
+ duration: z.number().int().min(4).max(15).default(15),
725
+ web_search: z.boolean().default(false),
726
+ nsfw_checker: z.boolean().default(true),
727
+ });
728
+ export const Seedance2MiniRequestSchema = z.object({
729
+ model: z.literal("bytedance/seedance-2-mini"),
730
+ callBackUrl: z.string().url().optional(),
731
+ input: Seedance2MiniInputSchema,
732
+ });
466
733
  export const NanoBanana2RequestSchema = z.object({
467
734
  model: z.literal("nano-banana-2"),
468
735
  callBackUrl: z.string().optional(),
@@ -601,7 +868,7 @@ export const HappyHorseTextToVideoRequestSchema = z.object({
601
868
  prompt: z.string().min(1).max(5000),
602
869
  resolution: HappyHorseResolutionSchema.optional(),
603
870
  aspect_ratio: HappyHorseAspectRatioSchema.optional(),
604
- duration: z.number().int().min(3).max(15).optional(),
871
+ duration: HappyHorseDurationSchema.optional(),
605
872
  seed: z.number().int().min(0).max(2147483647).optional(),
606
873
  }),
607
874
  });
@@ -612,7 +879,7 @@ export const HappyHorseImageToVideoRequestSchema = z.object({
612
879
  prompt: z.string().max(5000).optional(),
613
880
  image_urls: z.array(z.string()).min(1).max(1),
614
881
  resolution: HappyHorseResolutionSchema.optional(),
615
- duration: z.number().int().min(3).max(15).optional(),
882
+ duration: HappyHorseDurationSchema.optional(),
616
883
  seed: z.number().int().min(0).max(2147483647).optional(),
617
884
  }),
618
885
  });
@@ -624,7 +891,7 @@ export const HappyHorseReferenceToVideoRequestSchema = z.object({
624
891
  reference_image: z.array(z.string()).min(1).max(9),
625
892
  resolution: HappyHorseResolutionSchema.optional(),
626
893
  aspect_ratio: HappyHorseAspectRatioSchema.optional(),
627
- duration: z.number().int().min(3).max(15).optional(),
894
+ duration: HappyHorseDurationSchema.optional(),
628
895
  seed: z.number().int().min(0).max(2147483647).optional(),
629
896
  }),
630
897
  });
@@ -640,6 +907,76 @@ export const HappyHorseVideoEditRequestSchema = z.object({
640
907
  seed: z.number().int().min(0).max(2147483647).optional(),
641
908
  }),
642
909
  });
910
+ export const HappyHorse11TextToVideoRequestSchema = z.object({
911
+ model: z.literal("happyhorse-1-1/text-to-video"),
912
+ callBackUrl: z.string().optional(),
913
+ input: z.object({
914
+ prompt: z.string().min(1).max(5000),
915
+ resolution: HappyHorseResolutionSchema.default("1080p"),
916
+ aspect_ratio: HappyHorse11AspectRatioSchema.default("16:9"),
917
+ duration: HappyHorseDurationSchema.default(5),
918
+ }),
919
+ });
920
+ export const HappyHorse11ImageToVideoRequestSchema = z.object({
921
+ model: z.literal("happyhorse-1-1/image-to-video"),
922
+ callBackUrl: z.string().optional(),
923
+ input: z.object({
924
+ prompt: z.string().max(5000).default(""),
925
+ image_urls: z.array(z.string().url()).min(1).max(1),
926
+ resolution: HappyHorseResolutionSchema.default("1080p"),
927
+ duration: HappyHorseDurationSchema.default(5),
928
+ }),
929
+ });
930
+ export const HappyHorse11ReferenceToVideoRequestSchema = z.object({
931
+ model: z.literal("happyhorse-1-1/reference-to-video"),
932
+ callBackUrl: z.string().optional(),
933
+ input: z.object({
934
+ prompt: z.string().min(1).max(5000),
935
+ reference_image: z.array(z.string().url()).min(1).max(9),
936
+ resolution: HappyHorseResolutionSchema.default("1080p"),
937
+ aspect_ratio: HappyHorse11AspectRatioSchema.default("16:9"),
938
+ duration: HappyHorseDurationSchema.default(5),
939
+ }),
940
+ });
941
+ export const HappyHorse11ResponseCodeSchema = z.union([
942
+ z.literal(200),
943
+ z.literal(401),
944
+ z.literal(402),
945
+ z.literal(404),
946
+ z.literal(422),
947
+ z.literal(429),
948
+ z.literal(433),
949
+ z.literal(455),
950
+ z.literal(500),
951
+ z.literal(501),
952
+ z.literal(505),
953
+ ]);
954
+ export const HappyHorse11ErrorResponseCodeSchema = z.union([
955
+ z.literal(401),
956
+ z.literal(402),
957
+ z.literal(404),
958
+ z.literal(422),
959
+ z.literal(429),
960
+ z.literal(433),
961
+ z.literal(455),
962
+ z.literal(500),
963
+ z.literal(501),
964
+ z.literal(505),
965
+ ]);
966
+ export const HappyHorse11CreateTaskResponseSchema = z.union([
967
+ z.object({
968
+ code: z.literal(200),
969
+ msg: z.string(),
970
+ data: z.object({
971
+ taskId: z.string(),
972
+ }),
973
+ }),
974
+ z.object({
975
+ code: HappyHorse11ErrorResponseCodeSchema,
976
+ msg: z.string(),
977
+ data: z.unknown().optional(),
978
+ }),
979
+ ]);
643
980
  export const Omnihuman15RequestSchema = z.object({
644
981
  model: z.literal("omnihuman-1-5"),
645
982
  callBackUrl: z.string().url().optional(),
@@ -667,6 +1004,57 @@ export const VolcengineVideoToVideoLipSyncRequestSchema = z.object({
667
1004
  templ_start_seconds: z.number().min(0).default(0),
668
1005
  }),
669
1006
  });
1007
+ const GeminiOmniVideoListItemSchema = z
1008
+ .object({
1009
+ url: z.string().url(),
1010
+ start: z.number().min(0),
1011
+ ends: z.number().min(0),
1012
+ })
1013
+ .superRefine((value, ctx) => {
1014
+ if (value.ends <= value.start) {
1015
+ ctx.addIssue({
1016
+ code: "custom",
1017
+ message: "ends must be greater than start",
1018
+ path: ["ends"],
1019
+ });
1020
+ }
1021
+ if (value.ends - value.start >= 10) {
1022
+ ctx.addIssue({
1023
+ code: "custom",
1024
+ message: "video clip duration must be less than 10 seconds",
1025
+ path: ["ends"],
1026
+ });
1027
+ }
1028
+ });
1029
+ export const GeminiOmniVideoRequestSchema = z
1030
+ .object({
1031
+ model: z.literal("gemini-omni-video"),
1032
+ callBackUrl: z.string().url().optional(),
1033
+ input: z.object({
1034
+ prompt: z.string().min(1).max(20000),
1035
+ image_urls: z.array(z.string().url()).max(7).optional(),
1036
+ audio_ids: z.array(z.string().min(1)).max(3).optional(),
1037
+ video_list: z.array(GeminiOmniVideoListItemSchema).max(1).optional(),
1038
+ character_ids: z.array(z.string().min(1)).max(3).optional(),
1039
+ duration: GeminiOmniVideoDurationSchema,
1040
+ aspect_ratio: GeminiOmniVideoAspectRatioSchema.optional(),
1041
+ seed: z.number().int().min(0).max(2147483647).optional(),
1042
+ resolution: GeminiOmniVideoResolutionSchema.default("720p"),
1043
+ }),
1044
+ })
1045
+ .superRefine((value, ctx) => {
1046
+ const imageUnits = value.input.image_urls?.length ?? 0;
1047
+ const videoUnits = (value.input.video_list?.length ?? 0) * 2;
1048
+ const characterUnits = value.input.character_ids?.length ?? 0;
1049
+ const quotaUnits = imageUnits + videoUnits + characterUnits;
1050
+ if (quotaUnits > 7) {
1051
+ ctx.addIssue({
1052
+ code: "custom",
1053
+ message: "gemini-omni-video quota exceeded: image_urls + video_list * 2 + character_ids must be <= 7",
1054
+ path: ["input", "image_urls"],
1055
+ });
1056
+ }
1057
+ });
670
1058
  const ElevenLabsTextToSpeechInputSchema = z.object({
671
1059
  text: z.string().min(1),
672
1060
  voice: z.string().min(1),
@@ -791,8 +1179,7 @@ export const Wan27RefToVideoRequestSchema = z.object({
791
1179
  nsfw_checker: z.boolean().default(false),
792
1180
  }),
793
1181
  });
794
- export const Wan27VideoEditRequestSchema = z
795
- .object({
1182
+ export const Wan27VideoEditRequestSchema = z.object({
796
1183
  model: z.literal("wan/2-7-videoedit"),
797
1184
  callBackUrl: z.string().optional(),
798
1185
  input: z.object({
@@ -802,20 +1189,13 @@ export const Wan27VideoEditRequestSchema = z
802
1189
  reference_image: z.string().optional(),
803
1190
  resolution: Wan27ResolutionSchema.optional(),
804
1191
  aspect_ratio: Wan27AspectRatioSchema.optional(),
805
- duration: z.number().int().optional(),
1192
+ duration: Wan27VideoEditDurationSchema.optional(),
806
1193
  audio_setting: Wan27AudioSettingSchema.optional(),
807
1194
  prompt_extend: z.boolean().optional(),
808
1195
  watermark: z.boolean().optional(),
809
1196
  seed: z.number().int().min(0).max(2147483647).optional(),
810
1197
  nsfw_checker: z.boolean().default(false),
811
1198
  }),
812
- })
813
- .refine((v) => {
814
- const d = v.input.duration;
815
- return d === undefined || d === 0 || (d >= 2 && d <= 10);
816
- }, {
817
- message: "wan/2-7-videoedit duration must be 0 (full input) or between 2 and 10 seconds",
818
- path: ["input", "duration"],
819
1199
  });
820
1200
  const Wan27ImageInputShape = {
821
1201
  prompt: z.string().min(1).max(5000),
@@ -882,6 +1262,43 @@ export const Wan27TaskResultJsonSchema = z.object({
882
1262
  });
883
1263
  export const Wan27VideoResultSchema = Wan27TaskResultJsonSchema;
884
1264
  export const Wan27ImageResultSchema = Wan27TaskResultJsonSchema;
1265
+ export const Seedance2MiniTaskResultJsonSchema = z
1266
+ .object({
1267
+ resultUrls: z.array(z.string().url()).optional(),
1268
+ resultObject: z.record(z.string(), z.unknown()).optional(),
1269
+ })
1270
+ .refine((v) => v.resultUrls !== undefined || v.resultObject !== undefined, {
1271
+ message: "resultJson must include resultUrls or resultObject",
1272
+ });
1273
+ export const Seedance2MiniRecordInfoDataSchema = z.object({
1274
+ taskId: z.string().min(1),
1275
+ model: z.literal("bytedance/seedance-2-mini"),
1276
+ state: Seedance2MiniTaskStateSchema,
1277
+ param: z.string().min(1),
1278
+ resultJson: z.string().optional(),
1279
+ failCode: z.string().nullable(),
1280
+ failMsg: z.string().nullable(),
1281
+ costTime: z.number().int().nullable(),
1282
+ completeTime: z.number().int().nullable(),
1283
+ createTime: z.number().int(),
1284
+ });
1285
+ export const Seedance2MiniRecordInfoResponseSchema = z.object({
1286
+ code: z.number().int(),
1287
+ msg: z.string(),
1288
+ data: Seedance2MiniRecordInfoDataSchema.optional(),
1289
+ });
1290
+ export const RecordInfoRequestSchema = z.object({
1291
+ taskId: z.string().min(1),
1292
+ });
1293
+ export const TaskResponseSchema = z.object({
1294
+ code: z.number().int(),
1295
+ msg: z.string(),
1296
+ data: z
1297
+ .object({
1298
+ taskId: z.string().min(1),
1299
+ })
1300
+ .optional(),
1301
+ });
885
1302
  // ---------------------------------------------------------------------------
886
1303
  // Upload schemas
887
1304
  // ---------------------------------------------------------------------------
@@ -911,10 +1328,10 @@ export const DownloadUrlRequestSchema = z.object({
911
1328
  url: z.string().min(1),
912
1329
  });
913
1330
  export const GeminiOmniAudioCreateRequestSchema = z.object({
914
- audio_id: z.string().min(1),
915
- name: z.string().min(1),
916
- voice_description: z.string().min(1),
917
- example_dialogue: z.string().min(1),
1331
+ audio_id: GeminiOmniAudioVoiceIdSchema,
1332
+ name: z.string().min(1).max(210),
1333
+ voice_description: z.string().min(1).max(20000).optional(),
1334
+ example_dialogue: z.string().min(1).max(120).optional(),
918
1335
  });
919
1336
  // ---------------------------------------------------------------------------
920
1337
  // Options
@@ -1006,6 +1423,83 @@ export const KieChatRequestSchema = z.object({
1006
1423
  .optional(),
1007
1424
  });
1008
1425
  // ---------------------------------------------------------------------------
1426
+ // Sub-provider schemas: Responses (GPT-5.5 via Kie)
1427
+ // ---------------------------------------------------------------------------
1428
+ export const KieResponsesModelSchema = z.enum(["gpt-5-5"]);
1429
+ export const KieResponsesReasoningEffortSchema = z.enum([
1430
+ "low",
1431
+ "medium",
1432
+ "high",
1433
+ "xhigh",
1434
+ ]);
1435
+ export const KieResponsesMessageRoleSchema = z.enum([
1436
+ "user",
1437
+ "assistant",
1438
+ "system",
1439
+ "developer",
1440
+ "tool",
1441
+ ]);
1442
+ export const KieResponsesInputTextSchema = z.object({
1443
+ type: z.literal("input_text"),
1444
+ text: z.string().min(1),
1445
+ });
1446
+ export const KieResponsesInputImageSchema = z.object({
1447
+ type: z.literal("input_image"),
1448
+ image_url: z.string().url(),
1449
+ });
1450
+ export const KieResponsesInputFileSchema = z.object({
1451
+ type: z.literal("input_file"),
1452
+ file_url: z.string().url(),
1453
+ });
1454
+ export const KieResponsesInputContentSchema = z.discriminatedUnion("type", [
1455
+ KieResponsesInputTextSchema,
1456
+ KieResponsesInputImageSchema,
1457
+ KieResponsesInputFileSchema,
1458
+ ]);
1459
+ export const KieResponsesInputMessageSchema = z.object({
1460
+ role: KieResponsesMessageRoleSchema,
1461
+ content: z.array(KieResponsesInputContentSchema).min(1),
1462
+ });
1463
+ export const KieResponsesReasoningSchema = z.object({
1464
+ effort: KieResponsesReasoningEffortSchema.default("low").optional(),
1465
+ });
1466
+ export const KieResponsesWebSearchToolSchema = z.object({
1467
+ type: z.literal("web_search"),
1468
+ });
1469
+ export const KieResponsesFunctionToolSchema = z.object({
1470
+ type: z.literal("function"),
1471
+ name: z.string().min(1),
1472
+ description: z.string().min(1),
1473
+ parameters: z.record(z.string(), z.unknown()),
1474
+ });
1475
+ export const KieResponsesToolSchema = z.discriminatedUnion("type", [
1476
+ KieResponsesWebSearchToolSchema,
1477
+ KieResponsesFunctionToolSchema,
1478
+ ]);
1479
+ export const KieResponsesToolsSchema = z
1480
+ .array(KieResponsesToolSchema)
1481
+ .superRefine((tools, ctx) => {
1482
+ const hasWebSearch = tools.some((tool) => tool.type === "web_search");
1483
+ const hasFunction = tools.some((tool) => tool.type === "function");
1484
+ if (hasWebSearch && hasFunction) {
1485
+ ctx.addIssue({
1486
+ code: "custom",
1487
+ message: "web_search and function tools are mutually exclusive for Kie responses",
1488
+ });
1489
+ }
1490
+ });
1491
+ export const KieResponsesRequestSchema = z.object({
1492
+ model: KieResponsesModelSchema,
1493
+ stream: z.boolean().default(false).optional(),
1494
+ input: z.union([
1495
+ z.string().min(1),
1496
+ z.array(KieResponsesInputMessageSchema).min(1),
1497
+ ]),
1498
+ reasoning: KieResponsesReasoningSchema.optional(),
1499
+ tools: KieResponsesToolsSchema.optional(),
1500
+ tool_choice: z.string().optional(),
1501
+ });
1502
+ // ---------------------------------------------------------------------------
1009
1503
  // Sub-provider schemas: Claude (via Kie)
1010
1504
  // ---------------------------------------------------------------------------
1011
1505
  export const KieClaudeToolInputSchemaSchema = z.object({
@@ -1065,6 +1559,7 @@ export const MediaGenerationRequestSchema = z.union([
1065
1559
  Qwen2ImageEditRequestSchema,
1066
1560
  Seedance2FastRequestSchema,
1067
1561
  Seedance2RequestSchema,
1562
+ Seedance2MiniRequestSchema,
1068
1563
  Wan27ImageToVideoRequestSchema,
1069
1564
  Wan27TextToVideoRequestSchema,
1070
1565
  Wan27RefToVideoRequestSchema,
@@ -1075,8 +1570,12 @@ export const MediaGenerationRequestSchema = z.union([
1075
1570
  HappyHorseImageToVideoRequestSchema,
1076
1571
  HappyHorseReferenceToVideoRequestSchema,
1077
1572
  HappyHorseVideoEditRequestSchema,
1573
+ HappyHorse11TextToVideoRequestSchema,
1574
+ HappyHorse11ImageToVideoRequestSchema,
1575
+ HappyHorse11ReferenceToVideoRequestSchema,
1078
1576
  Omnihuman15RequestSchema,
1079
1577
  VolcengineVideoToVideoLipSyncRequestSchema,
1578
+ GeminiOmniVideoRequestSchema,
1080
1579
  ElevenLabsAudioIsolationRequestSchema,
1081
1580
  ElevenLabsTextToDialogueV3RequestSchema,
1082
1581
  ElevenLabsTextToSpeechMultilingualV2RequestSchema,