@mynthio/sdk 0.0.40 → 0.0.42
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/README.md +20 -4
- package/dist/convex/index.d.ts +39 -100
- package/dist/convex/index.js +41 -2
- package/dist/handler.d.ts +28 -0
- package/dist/handler.js +121 -0
- package/dist/index.d.ts +701 -360
- package/dist/index.js +1514 -2
- package/dist/next/index.d.ts +14 -24
- package/dist/next/index.js +25 -2
- package/dist/tanstack-start/index.d.ts +18 -23
- package/dist/tanstack-start/index.js +11 -2
- package/dist/types.d.ts +609 -660
- package/package.json +16 -21
- package/dist/client.d.ts +0 -41
- package/dist/client.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -95
- package/dist/constants.d.ts.map +0 -1
- package/dist/convex/index.d.ts.map +0 -1
- package/dist/convex/utils.d.ts +0 -2
- package/dist/convex/utils.d.ts.map +0 -1
- package/dist/image-alt-result.d.ts +0 -19
- package/dist/image-alt-result.d.ts.map +0 -1
- package/dist/image-generation-result.d.ts +0 -58
- package/dist/image-generation-result.d.ts.map +0 -1
- package/dist/image-rate-result.d.ts +0 -21
- package/dist/image-rate-result.d.ts.map +0 -1
- package/dist/image-remove-background-result.d.ts +0 -24
- package/dist/image-remove-background-result.d.ts.map +0 -1
- package/dist/image-review-result.d.ts +0 -28
- package/dist/image-review-result.d.ts.map +0 -1
- package/dist/index-apss16tr.js +0 -3
- package/dist/index-ty295921.js +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/next/index.d.ts.map +0 -1
- package/dist/tanstack-start/index.d.ts.map +0 -1
- package/dist/task-async.d.ts +0 -95
- package/dist/task-async.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/uploads.d.ts +0 -31
- package/dist/uploads.d.ts.map +0 -1
- package/dist/video-generation-result.d.ts +0 -46
- package/dist/video-generation-result.d.ts.map +0 -1
- package/dist/webhooks/utils.d.ts +0 -5
- package/dist/webhooks/utils.d.ts.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,665 +1,614 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Model capabilities that affect available generation options.
|
|
4
|
+
* - `negative_prompt`: Supports structured negative prompts
|
|
5
|
+
* - `inputs`: Supports input images
|
|
6
|
+
* - `4k`: Supports 4k resolution output
|
|
7
|
+
*/
|
|
8
|
+
type ModelCapability = "inputs" | "negative_prompt" | "4k";
|
|
9
|
+
/**
|
|
10
|
+
* Information about an available image generation model.
|
|
11
|
+
*/
|
|
12
|
+
type AvailableModel = {
|
|
13
|
+
/** Unique model identifier used in API requests */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Human-readable display name */
|
|
16
|
+
label: string;
|
|
17
|
+
/** List of supported capabilities */
|
|
18
|
+
capabilities: readonly ModelCapability[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* List of all available image generation models with their capabilities.
|
|
22
|
+
* Use this to build model selectors or validate model IDs.
|
|
23
|
+
*/
|
|
24
|
+
declare const AVAILABLE_MODELS: readonly AvailableModel[];
|
|
25
|
+
/**
|
|
26
|
+
* Information about an available video generation model.
|
|
27
|
+
*
|
|
28
|
+
* Video models reject requests outside their declared resolution, duration and
|
|
29
|
+
* audio support, so this metadata is what you validate a request against (or
|
|
30
|
+
* build a model picker from) before spending a round trip.
|
|
31
|
+
*/
|
|
32
|
+
type AvailableVideoModel = {
|
|
33
|
+
/** Unique model identifier used in API requests */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Human-readable display name */
|
|
36
|
+
label: string;
|
|
37
|
+
/** Resolution tiers the model accepts */
|
|
38
|
+
resolutions: readonly VideoResolutionTier[];
|
|
39
|
+
/** Tier used when the request omits `resolution` */
|
|
40
|
+
defaultResolution: VideoResolutionTier;
|
|
41
|
+
/** Accepted duration range in whole seconds, and the default */
|
|
42
|
+
duration: {
|
|
43
|
+
default: number;
|
|
44
|
+
min: number;
|
|
45
|
+
max: number;
|
|
46
|
+
};
|
|
47
|
+
/** Whether the model can generate native audio */
|
|
48
|
+
audio: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Input roles accepted for image-to-video.
|
|
51
|
+
* Empty when the model is text-to-video only.
|
|
52
|
+
*/
|
|
53
|
+
inputs: readonly VideoInputRole[];
|
|
54
|
+
/** Maximum number of input images */
|
|
55
|
+
maxInputs: number;
|
|
56
|
+
};
|
|
57
|
+
type VideoResolutionTier = "480p" | "720p" | "1080p" | "4k";
|
|
58
|
+
type VideoInputRole = "first_frame" | "last_frame" | "reference";
|
|
59
|
+
/**
|
|
60
|
+
* List of all available video generation models with their capabilities.
|
|
61
|
+
* Unlike images, video generation has no `auto` model: pick one explicitly.
|
|
62
|
+
*/
|
|
63
|
+
declare const AVAILABLE_VIDEO_MODELS: readonly AvailableVideoModel[];
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/types.d.ts
|
|
2
66
|
/**
|
|
3
67
|
* Type definitions for the Mynth SDK.
|
|
4
68
|
* Import as `import type { MynthSDKTypes } from "@mynthio/sdk"`.
|
|
5
69
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type
|
|
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
|
-
type
|
|
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
|
-
errors: TaskError[];
|
|
549
|
-
};
|
|
550
|
-
/**
|
|
551
|
-
* Webhook payload for image rating task completion.
|
|
552
|
-
*/
|
|
553
|
-
type WebhookTaskImageRateCompletedPayload<LevelT extends string = string> = {
|
|
554
|
-
task: {
|
|
555
|
-
id: string;
|
|
556
|
-
};
|
|
557
|
-
event: "task.image.rate.completed";
|
|
558
|
-
result: ImageRateTaskResult<LevelT>;
|
|
559
|
-
request: ImageRateRequest;
|
|
560
|
-
};
|
|
561
|
-
/**
|
|
562
|
-
* Webhook payload for image rating task failure.
|
|
563
|
-
*/
|
|
564
|
-
type WebhookTaskImageRateFailedPayload = {
|
|
565
|
-
task: {
|
|
566
|
-
id: string;
|
|
567
|
-
};
|
|
568
|
-
event: "task.image.rate.failed";
|
|
569
|
-
request: ImageRateRequest;
|
|
570
|
-
errors: TaskError[];
|
|
571
|
-
};
|
|
572
|
-
/**
|
|
573
|
-
* Webhook payload for image alt text task completion.
|
|
574
|
-
*/
|
|
575
|
-
type WebhookTaskImageAltCompletedPayload = {
|
|
576
|
-
task: {
|
|
577
|
-
id: string;
|
|
578
|
-
};
|
|
579
|
-
event: "task.image.alt.completed";
|
|
580
|
-
result: ImageAltTaskResult;
|
|
581
|
-
request: ImageAltRequest;
|
|
582
|
-
};
|
|
583
|
-
/**
|
|
584
|
-
* Webhook payload for image alt text task failure.
|
|
585
|
-
*/
|
|
586
|
-
type WebhookTaskImageAltFailedPayload = {
|
|
587
|
-
task: {
|
|
588
|
-
id: string;
|
|
589
|
-
};
|
|
590
|
-
event: "task.image.alt.failed";
|
|
591
|
-
request: ImageAltRequest;
|
|
592
|
-
errors: TaskError[];
|
|
593
|
-
};
|
|
594
|
-
/**
|
|
595
|
-
* Webhook payload for image review task completion.
|
|
596
|
-
*/
|
|
597
|
-
type WebhookTaskImageReviewCompletedPayload = {
|
|
598
|
-
task: {
|
|
599
|
-
id: string;
|
|
600
|
-
};
|
|
601
|
-
event: "task.image.review.completed";
|
|
602
|
-
result: ImageReviewTaskResult;
|
|
603
|
-
request: ImageReviewRequest;
|
|
604
|
-
};
|
|
605
|
-
/**
|
|
606
|
-
* Webhook payload for image review task failure.
|
|
607
|
-
*/
|
|
608
|
-
type WebhookTaskImageReviewFailedPayload = {
|
|
609
|
-
task: {
|
|
610
|
-
id: string;
|
|
611
|
-
};
|
|
612
|
-
event: "task.image.review.failed";
|
|
613
|
-
request: ImageReviewRequest;
|
|
614
|
-
errors: TaskError[];
|
|
615
|
-
};
|
|
616
|
-
/**
|
|
617
|
-
* Webhook payload for image remove background task completion.
|
|
618
|
-
*/
|
|
619
|
-
type WebhookTaskImageRemoveBackgroundCompletedPayload = {
|
|
620
|
-
task: {
|
|
621
|
-
id: string;
|
|
622
|
-
};
|
|
623
|
-
event: "task.image.remove_background.completed";
|
|
624
|
-
result: ImageRemoveBackgroundTaskResult;
|
|
625
|
-
request: ImageRemoveBackgroundRequest;
|
|
626
|
-
};
|
|
627
|
-
/**
|
|
628
|
-
* Webhook payload for image remove background task failure.
|
|
629
|
-
*/
|
|
630
|
-
type WebhookTaskImageRemoveBackgroundFailedPayload = {
|
|
631
|
-
task: {
|
|
632
|
-
id: string;
|
|
633
|
-
};
|
|
634
|
-
event: "task.image.remove_background.failed";
|
|
635
|
-
request: ImageRemoveBackgroundRequest;
|
|
636
|
-
errors: TaskError[];
|
|
637
|
-
};
|
|
638
|
-
/**
|
|
639
|
-
* Webhook payload for video generation task completion.
|
|
640
|
-
*/
|
|
641
|
-
type WebhookTaskVideoCompletedPayload = {
|
|
642
|
-
task: {
|
|
643
|
-
id: string;
|
|
644
|
-
};
|
|
645
|
-
event: "task.video.generate.completed";
|
|
646
|
-
result: VideoResult;
|
|
647
|
-
request: VideoGenerationRequest;
|
|
648
|
-
};
|
|
649
|
-
/**
|
|
650
|
-
* Webhook payload for video generation task failure.
|
|
651
|
-
*/
|
|
652
|
-
type WebhookTaskVideoFailedPayload = {
|
|
653
|
-
task: {
|
|
654
|
-
id: string;
|
|
655
|
-
};
|
|
656
|
-
event: "task.video.generate.failed";
|
|
657
|
-
request: VideoGenerationRequest;
|
|
658
|
-
errors: TaskError[];
|
|
659
|
-
};
|
|
660
|
-
/**
|
|
661
|
-
* Webhook payload union.
|
|
662
|
-
*/
|
|
663
|
-
type WebhookPayload = WebhookTaskImageCompletedPayload | WebhookTaskImageFailedPayload | WebhookTaskImageRateCompletedPayload | WebhookTaskImageRateFailedPayload | WebhookTaskImageAltCompletedPayload | WebhookTaskImageAltFailedPayload | WebhookTaskImageReviewCompletedPayload | WebhookTaskImageReviewFailedPayload | WebhookTaskImageRemoveBackgroundCompletedPayload | WebhookTaskImageRemoveBackgroundFailedPayload | WebhookTaskVideoCompletedPayload | WebhookTaskVideoFailedPayload;
|
|
70
|
+
declare namespace MynthSDKTypes {
|
|
71
|
+
type ApiResponse<DataT> = {
|
|
72
|
+
data: DataT;
|
|
73
|
+
};
|
|
74
|
+
type TaskStatus = "pending" | "completed" | "failed";
|
|
75
|
+
type TaskType = "image.generate" | "image.rate" | "image.alt" | "image.review" | "image.remove_background" | "video.generate";
|
|
76
|
+
type TaskBase = {
|
|
77
|
+
id: string;
|
|
78
|
+
status: TaskStatus;
|
|
79
|
+
apiKeyId: string | null;
|
|
80
|
+
userId: string;
|
|
81
|
+
cost: string | null;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
errors?: TaskError[];
|
|
85
|
+
};
|
|
86
|
+
type TaskError = {
|
|
87
|
+
code: string;
|
|
88
|
+
message?: string;
|
|
89
|
+
};
|
|
90
|
+
type TaskData = (TaskBase & {
|
|
91
|
+
type: "image.generate";
|
|
92
|
+
request: ImageGenerationRequest;
|
|
93
|
+
result: ImageResult | null;
|
|
94
|
+
}) | (TaskBase & {
|
|
95
|
+
type: "image.rate";
|
|
96
|
+
request: ImageRateRequest;
|
|
97
|
+
result: ImageRateTaskResult | null;
|
|
98
|
+
}) | (TaskBase & {
|
|
99
|
+
type: "image.alt";
|
|
100
|
+
request: ImageAltRequest;
|
|
101
|
+
result: ImageAltTaskResult | null;
|
|
102
|
+
}) | (TaskBase & {
|
|
103
|
+
type: "image.review";
|
|
104
|
+
request: ImageReviewRequest;
|
|
105
|
+
result: ImageReviewTaskResult | null;
|
|
106
|
+
}) | (TaskBase & {
|
|
107
|
+
type: "image.remove_background";
|
|
108
|
+
request: ImageRemoveBackgroundRequest;
|
|
109
|
+
result: ImageRemoveBackgroundTaskResult | null;
|
|
110
|
+
}) | (TaskBase & {
|
|
111
|
+
type: "video.generate";
|
|
112
|
+
request: VideoGenerationRequest;
|
|
113
|
+
result: VideoResult | null;
|
|
114
|
+
});
|
|
115
|
+
type ImageGenerationTaskData = Extract<TaskData, {
|
|
116
|
+
type: "image.generate";
|
|
117
|
+
}>;
|
|
118
|
+
type ImageRateTaskData = Extract<TaskData, {
|
|
119
|
+
type: "image.rate";
|
|
120
|
+
}>;
|
|
121
|
+
type ImageAltTaskData = Extract<TaskData, {
|
|
122
|
+
type: "image.alt";
|
|
123
|
+
}>;
|
|
124
|
+
type ImageReviewTaskData = Extract<TaskData, {
|
|
125
|
+
type: "image.review";
|
|
126
|
+
}>;
|
|
127
|
+
type ImageRemoveBackgroundTaskData = Extract<TaskData, {
|
|
128
|
+
type: "image.remove_background";
|
|
129
|
+
}>;
|
|
130
|
+
type VideoGenerationTaskData = Extract<TaskData, {
|
|
131
|
+
type: "video.generate";
|
|
132
|
+
}>;
|
|
133
|
+
type ModelInputRule = {
|
|
134
|
+
type: "image";
|
|
135
|
+
/** Role the input plays. Absent means the rule accepts any image. */
|
|
136
|
+
kind?: string;
|
|
137
|
+
min?: number;
|
|
138
|
+
max: number;
|
|
139
|
+
};
|
|
140
|
+
type ModelMode = {
|
|
141
|
+
inputs?: {
|
|
142
|
+
rules: ModelInputRule[];
|
|
143
|
+
maxTotal?: number;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
type ImageModelPricing = {
|
|
147
|
+
perImage: {
|
|
148
|
+
base: string;
|
|
149
|
+
"4k"?: string;
|
|
150
|
+
};
|
|
151
|
+
perInput?: string;
|
|
152
|
+
};
|
|
153
|
+
type VideoModelPricing = {
|
|
154
|
+
/** USD per second, keyed by resolution tier. Tiers the model cannot produce are absent. */
|
|
155
|
+
perSecond: Partial<Record<VideoResolutionTier, string>>;
|
|
156
|
+
/** Present only when audio is billed on top of the per-second video rate. */
|
|
157
|
+
audio?: {
|
|
158
|
+
perSecond: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
type ModelPricing = ImageModelPricing | VideoModelPricing;
|
|
162
|
+
type ImageModel = {
|
|
163
|
+
id: string;
|
|
164
|
+
displayName: string | null;
|
|
165
|
+
type: "image";
|
|
166
|
+
modes: Partial<Record<"txt->img" | "img->img", ModelMode>>;
|
|
167
|
+
pricing: ImageModelPricing | null;
|
|
168
|
+
};
|
|
169
|
+
type VideoModel = {
|
|
170
|
+
id: string;
|
|
171
|
+
displayName: string | null;
|
|
172
|
+
type: "video";
|
|
173
|
+
modes: Partial<Record<"txt->vid" | "img->vid", ModelMode>>;
|
|
174
|
+
pricing: VideoModelPricing | null;
|
|
175
|
+
};
|
|
176
|
+
type Model = ImageModel | VideoModel;
|
|
177
|
+
type ModelsListResponse = ApiResponse<Model[]>;
|
|
178
|
+
type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "alibaba/qwen-image-3.0" | "alibaba/qwen-image-3.0-pro" | "bytedance/seedream-5.0-lite" | "bytedance/seedream-pro" | "black-forest-labs/flux.1-dev" | "black-forest-labs/flux-1-schnell" | "black-forest-labs/flux.2-dev" | "black-forest-labs/flux.2-pro" | "black-forest-labs/flux.2-flex" | "black-forest-labs/flux.2-max" | "black-forest-labs/flux.2-klein-4b" | "bria/fibo-edit-1.5" | "bria/fibo-generate-1.5" | "circlestone-labs/anima" | "google/gemini-3.1-flash-lite-image" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "imagineart/imagineart-1.5-pro" | "imagineart/imagineart-2.0" | "klingai/kling-image-3.0" | "klingai/kling-image-o3" | "krea/krea-2-turbo" | "krea/krea-2-medium" | "krea/krea-2-large" | "luma/uni-1" | "luma/uni-1-max" | "meta/muse-image" | "microsoft/mai-image-2.6" | "microsoft/mai-image-2.6-flash" | "minimax/h3" | "openai/gpt-image-2" | "openai/gpt-image-2.5-flare" | "openai/gpt-image-2.5-sunburst" | "tongyi-mai/z-image" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "maxfeifei8/one-obsession" | "purplesmartai/pony-diffusion-v6-xl" | "recraft/recraft-v4" | "recraft/recraft-v4-pro" | "reve/reve" | "reve/reve-remix" | "sourceful/riverflow-2.0-pro" | "wan/wan2.6-image" | "wan/wan2.7-image" | "wan/wan2.7-image-pro" | "xai/grok-imagine-image" | "xai/grok-imagine-image-2.0" | "xai/grok-imagine-image-quality";
|
|
179
|
+
type ImageGenerationModel = ImageGenerationModelId | "auto";
|
|
180
|
+
type GenerateImageOptionsIn = {
|
|
181
|
+
prompt: string;
|
|
182
|
+
};
|
|
183
|
+
type GenerateImageOptions = {
|
|
184
|
+
prompt: string;
|
|
185
|
+
};
|
|
186
|
+
type ImageGenerationRequestPrompt = GenerateImageOptionsIn["prompt"];
|
|
187
|
+
type ImageGenerationRequestOutputFormat = "png" | "jpg" | "webp";
|
|
188
|
+
type ImageGenerationRequestOutput = {
|
|
189
|
+
format: ImageGenerationRequestOutputFormat;
|
|
190
|
+
/** Output quality 1-100. Defaults to 80 when output is omitted. */
|
|
191
|
+
quality: number;
|
|
192
|
+
};
|
|
193
|
+
type ImageGenerationRequestCustomWebhook = {
|
|
194
|
+
url: string;
|
|
195
|
+
}[];
|
|
196
|
+
type ImageGenerationRequestAccessPat = {
|
|
197
|
+
enabled?: boolean;
|
|
198
|
+
};
|
|
199
|
+
type ImageGenerationRequestAccess = {
|
|
200
|
+
pat: ImageGenerationRequestAccessPat;
|
|
201
|
+
};
|
|
202
|
+
type ImageGenerationRequestWebhook = {
|
|
203
|
+
dashboard?: boolean;
|
|
204
|
+
custom?: ImageGenerationRequestCustomWebhook;
|
|
205
|
+
};
|
|
206
|
+
type ImageGenerationRequestRatingLevel<T extends string = string> = {
|
|
207
|
+
value: T;
|
|
208
|
+
description: string;
|
|
209
|
+
};
|
|
210
|
+
type ImageGenerationRequestRating = true | ImageRateRequestRatingDefault | {
|
|
211
|
+
mode: "custom";
|
|
212
|
+
levels: readonly ImageGenerationRequestRatingLevel[];
|
|
213
|
+
};
|
|
214
|
+
type ImageGenerationRequestSizePreset = "square" | "portrait" | "landscape" | "portrait_tall" | "landscape_wide" | "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "2:1" | "1:2" | "1:1_4k" | "2:3_4k" | "3:2_4k" | "3:4_4k" | "4:3_4k" | "4:5_4k" | "5:4_4k" | "9:16_4k" | "16:9_4k" | "21:9_4k" | "2:1_4k" | "1:2_4k";
|
|
215
|
+
type ImageGenerationRequestSizeScale = "base" | "4k";
|
|
216
|
+
type ImageGenerationRequestAspectRatio = "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "2:1" | "1:2";
|
|
217
|
+
type ImageGenerationRequestSizeAspectRatio = {
|
|
218
|
+
type: "aspect_ratio";
|
|
219
|
+
aspectRatio: ImageGenerationRequestAspectRatio;
|
|
220
|
+
scale?: ImageGenerationRequestSizeScale;
|
|
221
|
+
};
|
|
222
|
+
type ImageGenerationRequestSizeAuto = {
|
|
223
|
+
type: "auto";
|
|
224
|
+
};
|
|
225
|
+
type ImageUploadInput = Blob | File;
|
|
226
|
+
type ImageUploadResponse = {
|
|
227
|
+
urls: string[];
|
|
228
|
+
};
|
|
229
|
+
type ImageGenerationRequestInputSource = {
|
|
230
|
+
type: "url";
|
|
231
|
+
url: string;
|
|
232
|
+
};
|
|
233
|
+
type ImageGenerationRequestInputAs = "auto" | "source" | "reference";
|
|
234
|
+
type ImageGenerationRequestInput = {
|
|
235
|
+
type: "image";
|
|
236
|
+
as?: ImageGenerationRequestInputAs;
|
|
237
|
+
source: ImageGenerationRequestInputSource;
|
|
238
|
+
};
|
|
239
|
+
type ImageGenerationClientInput = Omit<ImageGenerationRequestInput, "source"> & {
|
|
240
|
+
source: ImageGenerationRequestInputSource | {
|
|
241
|
+
type: "file";
|
|
242
|
+
file: ImageUploadInput;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
type ImageGenerationRequestSize = ImageGenerationRequestSizePreset | ImageGenerationRequestSizeAspectRatio | ImageGenerationRequestSizeAuto | "auto";
|
|
246
|
+
type ImageGenerationRequest = {
|
|
247
|
+
prompt: ImageGenerationRequestPrompt;
|
|
248
|
+
negative_prompt?: string;
|
|
249
|
+
magic_prompt?: boolean;
|
|
250
|
+
model?: ImageGenerationModel;
|
|
251
|
+
size?: ImageGenerationRequestSize;
|
|
252
|
+
count?: number;
|
|
253
|
+
output?: ImageGenerationRequestOutput;
|
|
254
|
+
webhook?: ImageGenerationRequestWebhook;
|
|
255
|
+
rating?: ImageGenerationRequestRating;
|
|
256
|
+
access?: ImageGenerationRequestAccess;
|
|
257
|
+
inputs?: (string | ImageGenerationRequestInput)[];
|
|
258
|
+
metadata?: Record<string, unknown>;
|
|
259
|
+
destination?: string;
|
|
260
|
+
};
|
|
261
|
+
type ImageGenerationClientRequest = Omit<ImageGenerationRequest, "inputs"> & {
|
|
262
|
+
inputs?: (string | ImageUploadInput | ImageGenerationClientInput)[];
|
|
263
|
+
};
|
|
264
|
+
type ImageResultRatingDefaultLevel = "sfw" | "nsfw";
|
|
265
|
+
type ImageResultRatingFailure = {
|
|
266
|
+
status: "failed";
|
|
267
|
+
error: {
|
|
268
|
+
code: string;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
type ImageResultRating = {
|
|
272
|
+
status: "success";
|
|
273
|
+
level: ImageResultRatingDefaultLevel;
|
|
274
|
+
} | {
|
|
275
|
+
status: "success";
|
|
276
|
+
level: string;
|
|
277
|
+
} | ImageResultRatingFailure;
|
|
278
|
+
type ImageResultDestination = {
|
|
279
|
+
status: "success";
|
|
280
|
+
name: string;
|
|
281
|
+
} | {
|
|
282
|
+
status: "failed";
|
|
283
|
+
name: string;
|
|
284
|
+
error: {
|
|
285
|
+
code: string;
|
|
286
|
+
message?: string;
|
|
287
|
+
provider_response?: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
type ImageResultImageSuccess = {
|
|
291
|
+
status: "success";
|
|
292
|
+
id: string;
|
|
293
|
+
url: string | null;
|
|
294
|
+
mynth_url: string;
|
|
295
|
+
size: string;
|
|
296
|
+
cost: string;
|
|
297
|
+
destination?: ImageResultDestination;
|
|
298
|
+
rating?: ImageResultRating;
|
|
299
|
+
};
|
|
300
|
+
type ImageResultImageFailure = {
|
|
301
|
+
status: "failed";
|
|
302
|
+
error: {
|
|
303
|
+
code: string;
|
|
304
|
+
message?: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
type ImageResultImage = ImageResultImageSuccess | ImageResultImageFailure;
|
|
308
|
+
type ImageResultMagicPrompt = {
|
|
309
|
+
positive: string;
|
|
310
|
+
negative?: string;
|
|
311
|
+
};
|
|
312
|
+
type ImageResult = {
|
|
313
|
+
model: ImageGenerationModelId;
|
|
314
|
+
images: ImageResultImage[];
|
|
315
|
+
magic_prompt?: ImageResultMagicPrompt;
|
|
316
|
+
};
|
|
317
|
+
type ImageRateRequestLevel<T extends string = string> = {
|
|
318
|
+
/** Level value returned in the result */
|
|
319
|
+
value: T;
|
|
320
|
+
/** Human-readable description for the rating model */
|
|
321
|
+
description: string;
|
|
322
|
+
};
|
|
323
|
+
type ImageRateRequestBase = {
|
|
324
|
+
/** Image URL to rate */
|
|
325
|
+
url: string;
|
|
326
|
+
};
|
|
327
|
+
type ImageRateRequestRatingDefault = {
|
|
328
|
+
/** Default sfw/nsfw classifier. When omitted, the API defaults to nsfw_sfw. */
|
|
329
|
+
mode?: "nsfw_sfw";
|
|
330
|
+
};
|
|
331
|
+
type ImageRateRequestRatingCustom = {
|
|
332
|
+
/** Custom classifier levels */
|
|
333
|
+
mode: "custom";
|
|
334
|
+
levels: readonly ImageRateRequestLevel[];
|
|
335
|
+
};
|
|
336
|
+
type ImageRateRequest = ImageRateRequestBase & (ImageRateRequestRatingDefault | ImageRateRequestRatingCustom);
|
|
337
|
+
type ImageClientUrlOrFile = {
|
|
338
|
+
url: string;
|
|
339
|
+
file?: never;
|
|
340
|
+
} | {
|
|
341
|
+
file: ImageUploadInput;
|
|
342
|
+
url?: never;
|
|
343
|
+
};
|
|
344
|
+
type ImageRateClientRequest = ImageClientUrlOrFile & (ImageRateRequestRatingDefault | ImageRateRequestRatingCustom);
|
|
345
|
+
type ImageRateCreatedResponse = {
|
|
346
|
+
taskId: string;
|
|
347
|
+
estimatedCost: string;
|
|
348
|
+
};
|
|
349
|
+
type ImageRateTaskResult<LevelT extends string = string> = {
|
|
350
|
+
level: LevelT;
|
|
351
|
+
};
|
|
352
|
+
type ImageAltRequest = {
|
|
353
|
+
/** Image URL to generate alt text for */
|
|
354
|
+
url: string;
|
|
355
|
+
};
|
|
356
|
+
type ImageAltClientRequest = ImageClientUrlOrFile;
|
|
357
|
+
type ImageAltCreatedResponse = {
|
|
358
|
+
taskId: string;
|
|
359
|
+
estimatedCost: string;
|
|
360
|
+
};
|
|
361
|
+
type ImageAltTaskResult = {
|
|
362
|
+
alt: string;
|
|
363
|
+
};
|
|
364
|
+
type ImageReviewEffort = "low" | "high";
|
|
365
|
+
type ImageReviewSeverity = "critical" | "major" | "minor";
|
|
366
|
+
type ImageReviewConfidence = "low" | "medium" | "high";
|
|
367
|
+
type ImageReviewRequest = {
|
|
368
|
+
/** Image URL to review. */
|
|
369
|
+
url: string;
|
|
370
|
+
/** Reviewer panel to run. Defaults to `high`. */
|
|
371
|
+
effort?: ImageReviewEffort;
|
|
372
|
+
};
|
|
373
|
+
type ImageReviewClientRequest = ImageClientUrlOrFile & {
|
|
374
|
+
/** Reviewer panel to run. Defaults to `high`. */
|
|
375
|
+
effort?: ImageReviewEffort;
|
|
376
|
+
};
|
|
377
|
+
type ImageReviewCreatedResponse = {
|
|
378
|
+
taskId: string;
|
|
379
|
+
estimatedCost: string;
|
|
380
|
+
};
|
|
381
|
+
type ImageReviewFinding = {
|
|
382
|
+
/** What is wrong, in plain language. */
|
|
383
|
+
finding: string;
|
|
384
|
+
/** Defect category. */
|
|
385
|
+
category: string;
|
|
386
|
+
severity: ImageReviewSeverity;
|
|
387
|
+
/** Where the defect appears in the image, in plain language. */
|
|
388
|
+
where: string;
|
|
389
|
+
confidence: ImageReviewConfidence;
|
|
390
|
+
};
|
|
391
|
+
type ImageReviewStrength = {
|
|
392
|
+
strength: string;
|
|
393
|
+
confidence: ImageReviewConfidence;
|
|
394
|
+
};
|
|
395
|
+
type ImageReviewTaskResult = {
|
|
396
|
+
/** Median reviewer score from 1 to 4. Higher is better. */
|
|
397
|
+
score: number;
|
|
398
|
+
summary: string;
|
|
399
|
+
findings: ImageReviewFinding[];
|
|
400
|
+
strengths: ImageReviewStrength[];
|
|
401
|
+
};
|
|
402
|
+
type ImageRemoveBackgroundOutputFormat = "png" | "webp";
|
|
403
|
+
type ImageRemoveBackgroundRequestOutput = {
|
|
404
|
+
/** Converts the result to this format. When omitted, the provider's format is kept. */
|
|
405
|
+
format?: ImageRemoveBackgroundOutputFormat;
|
|
406
|
+
};
|
|
407
|
+
type ImageRemoveBackgroundRequest = {
|
|
408
|
+
/** Image URL to remove the background from. */
|
|
409
|
+
url: string;
|
|
410
|
+
output?: ImageRemoveBackgroundRequestOutput;
|
|
411
|
+
webhook?: ImageGenerationRequestWebhook;
|
|
412
|
+
access?: ImageGenerationRequestAccess;
|
|
413
|
+
metadata?: Record<string, unknown>;
|
|
414
|
+
destination?: string;
|
|
415
|
+
};
|
|
416
|
+
type ImageRemoveBackgroundClientRequest = ImageClientUrlOrFile & Omit<ImageRemoveBackgroundRequest, "url">;
|
|
417
|
+
type ImageRemoveBackgroundCreatedResponse = {
|
|
418
|
+
taskId: string;
|
|
419
|
+
estimatedCost: string;
|
|
420
|
+
access?: {
|
|
421
|
+
publicAccessToken: string;
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
type ImageRemoveBackgroundResultImage = {
|
|
425
|
+
id: string;
|
|
426
|
+
/** Destination URL, or the Mynth URL without a destination. `null` when delivery failed. */
|
|
427
|
+
url: string | null;
|
|
428
|
+
mynth_url: string;
|
|
429
|
+
/** `{width}x{height}` */
|
|
430
|
+
size: string;
|
|
431
|
+
format: ImageRemoveBackgroundOutputFormat;
|
|
432
|
+
destination?: ImageResultDestination;
|
|
433
|
+
};
|
|
434
|
+
type ImageRemoveBackgroundTaskResult = {
|
|
435
|
+
image: ImageRemoveBackgroundResultImage;
|
|
436
|
+
};
|
|
437
|
+
type VideoGenerationModelId = "bytedance/seedance-2.0-mini" | "google/gemini-omni-flash-1.1" | "prunaai/p-video";
|
|
438
|
+
type VideoGenerationModel = VideoGenerationModelId;
|
|
439
|
+
type VideoGenerationRequestResolution = "480p" | "720p" | "1080p" | "4k";
|
|
440
|
+
type VideoGenerationRequestWebhook = ImageGenerationRequestWebhook;
|
|
441
|
+
type VideoGenerationRequestAccess = ImageGenerationRequestAccess;
|
|
442
|
+
type VideoGenerationRequestInputSource = {
|
|
443
|
+
type: "url";
|
|
444
|
+
url: string;
|
|
445
|
+
};
|
|
446
|
+
type VideoGenerationRequestInputAs = "auto" | "first_frame" | "last_frame" | "reference";
|
|
447
|
+
type VideoGenerationRequestInput = {
|
|
448
|
+
type: "image";
|
|
449
|
+
as?: VideoGenerationRequestInputAs;
|
|
450
|
+
source: VideoGenerationRequestInputSource;
|
|
451
|
+
};
|
|
452
|
+
type VideoGenerationClientInput = Omit<VideoGenerationRequestInput, "source"> & {
|
|
453
|
+
source: VideoGenerationRequestInputSource | {
|
|
454
|
+
type: "file";
|
|
455
|
+
file: ImageUploadInput;
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
type VideoGenerationRequest = {
|
|
459
|
+
model: VideoGenerationModel;
|
|
460
|
+
prompt: string;
|
|
461
|
+
negative_prompt?: string;
|
|
462
|
+
/** Duration in whole seconds. Defaults to the model's default duration. */
|
|
463
|
+
duration?: number;
|
|
464
|
+
/** Resolution tier. Defaults to the model's default tier. */
|
|
465
|
+
resolution?: VideoGenerationRequestResolution;
|
|
466
|
+
/** Model-native generated audio. Only for models with the audio capability. */
|
|
467
|
+
audio?: boolean;
|
|
468
|
+
inputs?: (string | VideoGenerationRequestInput)[];
|
|
469
|
+
webhook?: VideoGenerationRequestWebhook;
|
|
470
|
+
access?: VideoGenerationRequestAccess;
|
|
471
|
+
metadata?: Record<string, unknown>;
|
|
472
|
+
};
|
|
473
|
+
type VideoGenerationClientRequest = Omit<VideoGenerationRequest, "inputs"> & {
|
|
474
|
+
inputs?: (string | ImageUploadInput | VideoGenerationClientInput)[];
|
|
475
|
+
};
|
|
476
|
+
type VideoGenerationCreatedResponse = {
|
|
477
|
+
taskId: string;
|
|
478
|
+
/** Cost reserved for the task. Failed videos are refunded. */
|
|
479
|
+
estimatedCost: string;
|
|
480
|
+
access?: {
|
|
481
|
+
publicAccessToken: string;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
type VideoGenerationEstimate = {
|
|
485
|
+
/** Estimated cost in USD. Nothing is generated or charged. */
|
|
486
|
+
estimatedCost: string;
|
|
487
|
+
currency: "usd";
|
|
488
|
+
/** Video generation always pins a model, so the estimate is exact. */
|
|
489
|
+
estimateKind: "exact";
|
|
490
|
+
};
|
|
491
|
+
type VideoResultVideoSuccess = {
|
|
492
|
+
status: "success";
|
|
493
|
+
id: string;
|
|
494
|
+
url: string;
|
|
495
|
+
mynth_url: string;
|
|
496
|
+
cost: string;
|
|
497
|
+
/** Duration of the generated video in seconds */
|
|
498
|
+
duration: number;
|
|
499
|
+
resolution: VideoGenerationRequestResolution;
|
|
500
|
+
/** Whether the video was generated with audio */
|
|
501
|
+
audio: boolean;
|
|
502
|
+
};
|
|
503
|
+
type VideoResultVideoFailure = {
|
|
504
|
+
status: "failed";
|
|
505
|
+
error: {
|
|
506
|
+
code: string;
|
|
507
|
+
message?: string;
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
type VideoResultVideo = VideoResultVideoSuccess | VideoResultVideoFailure;
|
|
511
|
+
type VideoResult = {
|
|
512
|
+
model: VideoGenerationModelId;
|
|
513
|
+
videos: VideoResultVideo[];
|
|
514
|
+
};
|
|
515
|
+
type WebhookTaskImageCompletedPayload = {
|
|
516
|
+
task: {
|
|
517
|
+
id: string;
|
|
518
|
+
};
|
|
519
|
+
event: "task.image.generate.completed";
|
|
520
|
+
result: ImageResult;
|
|
521
|
+
request: ImageGenerationRequest;
|
|
522
|
+
};
|
|
523
|
+
type WebhookTaskImageFailedPayload = {
|
|
524
|
+
task: {
|
|
525
|
+
id: string;
|
|
526
|
+
};
|
|
527
|
+
event: "task.image.generate.failed";
|
|
528
|
+
request: ImageGenerationRequest;
|
|
529
|
+
errors: TaskError[];
|
|
530
|
+
};
|
|
531
|
+
type WebhookTaskImageRateCompletedPayload<LevelT extends string = string> = {
|
|
532
|
+
task: {
|
|
533
|
+
id: string;
|
|
534
|
+
};
|
|
535
|
+
event: "task.image.rate.completed";
|
|
536
|
+
result: ImageRateTaskResult<LevelT>;
|
|
537
|
+
request: ImageRateRequest;
|
|
538
|
+
};
|
|
539
|
+
type WebhookTaskImageRateFailedPayload = {
|
|
540
|
+
task: {
|
|
541
|
+
id: string;
|
|
542
|
+
};
|
|
543
|
+
event: "task.image.rate.failed";
|
|
544
|
+
request: ImageRateRequest;
|
|
545
|
+
errors: TaskError[];
|
|
546
|
+
};
|
|
547
|
+
type WebhookTaskImageAltCompletedPayload = {
|
|
548
|
+
task: {
|
|
549
|
+
id: string;
|
|
550
|
+
};
|
|
551
|
+
event: "task.image.alt.completed";
|
|
552
|
+
result: ImageAltTaskResult;
|
|
553
|
+
request: ImageAltRequest;
|
|
554
|
+
};
|
|
555
|
+
type WebhookTaskImageAltFailedPayload = {
|
|
556
|
+
task: {
|
|
557
|
+
id: string;
|
|
558
|
+
};
|
|
559
|
+
event: "task.image.alt.failed";
|
|
560
|
+
request: ImageAltRequest;
|
|
561
|
+
errors: TaskError[];
|
|
562
|
+
};
|
|
563
|
+
type WebhookTaskImageReviewCompletedPayload = {
|
|
564
|
+
task: {
|
|
565
|
+
id: string;
|
|
566
|
+
};
|
|
567
|
+
event: "task.image.review.completed";
|
|
568
|
+
result: ImageReviewTaskResult;
|
|
569
|
+
request: ImageReviewRequest;
|
|
570
|
+
};
|
|
571
|
+
type WebhookTaskImageReviewFailedPayload = {
|
|
572
|
+
task: {
|
|
573
|
+
id: string;
|
|
574
|
+
};
|
|
575
|
+
event: "task.image.review.failed";
|
|
576
|
+
request: ImageReviewRequest;
|
|
577
|
+
errors: TaskError[];
|
|
578
|
+
};
|
|
579
|
+
type WebhookTaskImageRemoveBackgroundCompletedPayload = {
|
|
580
|
+
task: {
|
|
581
|
+
id: string;
|
|
582
|
+
};
|
|
583
|
+
event: "task.image.remove_background.completed";
|
|
584
|
+
result: ImageRemoveBackgroundTaskResult;
|
|
585
|
+
request: ImageRemoveBackgroundRequest;
|
|
586
|
+
};
|
|
587
|
+
type WebhookTaskImageRemoveBackgroundFailedPayload = {
|
|
588
|
+
task: {
|
|
589
|
+
id: string;
|
|
590
|
+
};
|
|
591
|
+
event: "task.image.remove_background.failed";
|
|
592
|
+
request: ImageRemoveBackgroundRequest;
|
|
593
|
+
errors: TaskError[];
|
|
594
|
+
};
|
|
595
|
+
type WebhookTaskVideoCompletedPayload = {
|
|
596
|
+
task: {
|
|
597
|
+
id: string;
|
|
598
|
+
};
|
|
599
|
+
event: "task.video.generate.completed";
|
|
600
|
+
result: VideoResult;
|
|
601
|
+
request: VideoGenerationRequest;
|
|
602
|
+
};
|
|
603
|
+
type WebhookTaskVideoFailedPayload = {
|
|
604
|
+
task: {
|
|
605
|
+
id: string;
|
|
606
|
+
};
|
|
607
|
+
event: "task.video.generate.failed";
|
|
608
|
+
request: VideoGenerationRequest;
|
|
609
|
+
errors: TaskError[];
|
|
610
|
+
};
|
|
611
|
+
type WebhookPayload = WebhookTaskImageCompletedPayload | WebhookTaskImageFailedPayload | WebhookTaskImageRateCompletedPayload | WebhookTaskImageRateFailedPayload | WebhookTaskImageAltCompletedPayload | WebhookTaskImageAltFailedPayload | WebhookTaskImageReviewCompletedPayload | WebhookTaskImageReviewFailedPayload | WebhookTaskImageRemoveBackgroundCompletedPayload | WebhookTaskImageRemoveBackgroundFailedPayload | WebhookTaskVideoCompletedPayload | WebhookTaskVideoFailedPayload;
|
|
664
612
|
}
|
|
665
|
-
//#
|
|
613
|
+
//#endregion
|
|
614
|
+
export { AvailableVideoModel as a, VideoResolutionTier as c, AvailableModel as i, AVAILABLE_MODELS as n, ModelCapability as o, AVAILABLE_VIDEO_MODELS as r, VideoInputRole as s, MynthSDKTypes as t };
|