@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.
Files changed (44) hide show
  1. package/README.md +20 -4
  2. package/dist/convex/index.d.ts +39 -100
  3. package/dist/convex/index.js +41 -2
  4. package/dist/handler.d.ts +28 -0
  5. package/dist/handler.js +121 -0
  6. package/dist/index.d.ts +701 -360
  7. package/dist/index.js +1514 -2
  8. package/dist/next/index.d.ts +14 -24
  9. package/dist/next/index.js +25 -2
  10. package/dist/tanstack-start/index.d.ts +18 -23
  11. package/dist/tanstack-start/index.js +11 -2
  12. package/dist/types.d.ts +609 -660
  13. package/package.json +16 -21
  14. package/dist/client.d.ts +0 -41
  15. package/dist/client.d.ts.map +0 -1
  16. package/dist/constants.d.ts +0 -95
  17. package/dist/constants.d.ts.map +0 -1
  18. package/dist/convex/index.d.ts.map +0 -1
  19. package/dist/convex/utils.d.ts +0 -2
  20. package/dist/convex/utils.d.ts.map +0 -1
  21. package/dist/image-alt-result.d.ts +0 -19
  22. package/dist/image-alt-result.d.ts.map +0 -1
  23. package/dist/image-generation-result.d.ts +0 -58
  24. package/dist/image-generation-result.d.ts.map +0 -1
  25. package/dist/image-rate-result.d.ts +0 -21
  26. package/dist/image-rate-result.d.ts.map +0 -1
  27. package/dist/image-remove-background-result.d.ts +0 -24
  28. package/dist/image-remove-background-result.d.ts.map +0 -1
  29. package/dist/image-review-result.d.ts +0 -28
  30. package/dist/image-review-result.d.ts.map +0 -1
  31. package/dist/index-apss16tr.js +0 -3
  32. package/dist/index-ty295921.js +0 -3
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/next/index.d.ts.map +0 -1
  35. package/dist/tanstack-start/index.d.ts.map +0 -1
  36. package/dist/task-async.d.ts +0 -95
  37. package/dist/task-async.d.ts.map +0 -1
  38. package/dist/types.d.ts.map +0 -1
  39. package/dist/uploads.d.ts +0 -31
  40. package/dist/uploads.d.ts.map +0 -1
  41. package/dist/video-generation-result.d.ts +0 -46
  42. package/dist/video-generation-result.d.ts.map +0 -1
  43. package/dist/webhooks/utils.d.ts +0 -5
  44. package/dist/webhooks/utils.d.ts.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,665 +1,614 @@
1
- import type { VideoResolutionTier } from "./constants";
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
- export declare namespace MynthSDKTypes {
7
- type ApiResponse<DataT> = {
8
- data: DataT;
9
- };
10
- type TaskStatus = "pending" | "completed" | "failed";
11
- type TaskType = "image.generate" | "image.rate" | "image.alt" | "image.review" | "image.remove_background" | "video.generate";
12
- type TaskBase = {
13
- id: string;
14
- status: TaskStatus;
15
- apiKeyId: string | null;
16
- userId: string;
17
- cost: string | null;
18
- createdAt: string;
19
- updatedAt: string;
20
- errors?: TaskError[];
21
- };
22
- /**
23
- * Task-level error entry.
24
- * `code` is a stable SCREAMING_SNAKE_CASE identifier; `message` is optional
25
- * human-readable prose and must not be parsed.
26
- */
27
- type TaskError = {
28
- code: string;
29
- message?: string;
30
- };
31
- type TaskData = (TaskBase & {
32
- type: "image.generate";
33
- request: ImageGenerationRequest;
34
- result: ImageResult | null;
35
- }) | (TaskBase & {
36
- type: "image.rate";
37
- request: ImageRateRequest;
38
- result: ImageRateTaskResult | null;
39
- }) | (TaskBase & {
40
- type: "image.alt";
41
- request: ImageAltRequest;
42
- result: ImageAltTaskResult | null;
43
- }) | (TaskBase & {
44
- type: "image.review";
45
- request: ImageReviewRequest;
46
- result: ImageReviewTaskResult | null;
47
- }) | (TaskBase & {
48
- type: "image.remove_background";
49
- request: ImageRemoveBackgroundRequest;
50
- result: ImageRemoveBackgroundTaskResult | null;
51
- }) | (TaskBase & {
52
- type: "video.generate";
53
- request: VideoGenerationRequest;
54
- result: VideoResult | null;
55
- });
56
- type ImageGenerationTaskData = Extract<TaskData, {
57
- type: "image.generate";
58
- }>;
59
- type ImageRateTaskData = Extract<TaskData, {
60
- type: "image.rate";
61
- }>;
62
- type ImageAltTaskData = Extract<TaskData, {
63
- type: "image.alt";
64
- }>;
65
- type ImageReviewTaskData = Extract<TaskData, {
66
- type: "image.review";
67
- }>;
68
- type ImageRemoveBackgroundTaskData = Extract<TaskData, {
69
- type: "image.remove_background";
70
- }>;
71
- type VideoGenerationTaskData = Extract<TaskData, {
72
- type: "video.generate";
73
- }>;
74
- type ModelInputRule = {
75
- type: "image";
76
- /** Role the input plays. Absent means the rule accepts any image. */
77
- kind?: string;
78
- min?: number;
79
- max: number;
80
- };
81
- type ModelMode = {
82
- inputs?: {
83
- rules: ModelInputRule[];
84
- maxTotal?: number;
85
- };
86
- };
87
- type ImageModelPricing = {
88
- perImage: {
89
- base: string;
90
- "4k"?: string;
91
- };
92
- perInput?: string;
93
- };
94
- type VideoModelPricing = {
95
- /** USD per second, keyed by resolution tier. Tiers the model cannot produce are absent. */
96
- perSecond: Partial<Record<VideoResolutionTier, string>>;
97
- /** Present only when audio is billed on top of the per-second video rate. */
98
- audio?: {
99
- perSecond: string;
100
- };
101
- };
102
- type ModelPricing = ImageModelPricing | VideoModelPricing;
103
- type ImageModel = {
104
- id: string;
105
- displayName: string | null;
106
- type: "image";
107
- modes: Partial<Record<"txt->img" | "img->img", ModelMode>>;
108
- pricing: ImageModelPricing | null;
109
- };
110
- type VideoModel = {
111
- id: string;
112
- displayName: string | null;
113
- type: "video";
114
- modes: Partial<Record<"txt->vid" | "img->vid", ModelMode>>;
115
- pricing: VideoModelPricing | null;
116
- };
117
- /** Narrow on `type` to reach the media-specific modes and pricing. */
118
- type Model = ImageModel | VideoModel;
119
- type ModelsListResponse = ApiResponse<Model[]>;
120
- 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";
121
- type ImageGenerationModel = ImageGenerationModelId | "auto";
122
- type GenerateImageOptionsIn = {
123
- prompt: string;
124
- };
125
- type GenerateImageOptions = {
126
- prompt: string;
127
- };
128
- type ImageGenerationRequestPrompt = GenerateImageOptionsIn["prompt"];
129
- type ImageGenerationRequestOutputFormat = "png" | "jpg" | "webp";
130
- type ImageGenerationRequestOutput = {
131
- format: ImageGenerationRequestOutputFormat;
132
- /** Output quality 1-100. Defaults to 80 when output is omitted. */
133
- quality: number;
134
- };
135
- type ImageGenerationRequestCustomWebhook = {
136
- url: string;
137
- }[];
138
- type ImageGenerationRequestAccessPat = {
139
- enabled?: boolean;
140
- };
141
- type ImageGenerationRequestAccess = {
142
- pat: ImageGenerationRequestAccessPat;
143
- };
144
- type ImageGenerationRequestWebhook = {
145
- dashboard?: boolean;
146
- custom?: ImageGenerationRequestCustomWebhook;
147
- };
148
- type ImageGenerationRequestRatingLevel<T extends string = string> = {
149
- value: T;
150
- description: string;
151
- };
152
- type ImageGenerationRequestRating = true | ImageRateRequestRatingDefault | {
153
- mode: "custom";
154
- levels: readonly ImageGenerationRequestRatingLevel[];
155
- };
156
- /** Available shorthand size presets */
157
- 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";
158
- type ImageGenerationRequestSizeScale = "base" | "4k";
159
- /** Supported aspect ratio strings */
160
- 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";
161
- /** Structured aspect ratio size configuration */
162
- type ImageGenerationRequestSizeAspectRatio = {
163
- type: "aspect_ratio";
164
- aspectRatio: ImageGenerationRequestAspectRatio;
165
- scale?: ImageGenerationRequestSizeScale;
166
- };
167
- /** Structured auto size configuration */
168
- type ImageGenerationRequestSizeAuto = {
169
- type: "auto";
170
- };
171
- type ImageUploadInput = Blob | File;
172
- type ImageUploadResponse = {
173
- urls: string[];
174
- };
175
- /** Image input source (API wire format) */
176
- type ImageGenerationRequestInputSource = {
177
- type: "url";
178
- url: string;
179
- };
180
- type ImageGenerationRequestInputAs = "auto" | "source" | "reference";
181
- /** Structured image input (API wire format) */
182
- type ImageGenerationRequestInput = {
183
- type: "image";
184
- as?: ImageGenerationRequestInputAs;
185
- source: ImageGenerationRequestInputSource;
186
- };
187
- /** Structured image input for the SDK client (may include local files) */
188
- type ImageGenerationClientInput = Omit<ImageGenerationRequestInput, "source"> & {
189
- source: ImageGenerationRequestInputSource | {
190
- type: "file";
191
- file: ImageUploadInput;
192
- };
193
- };
194
- /**
195
- * Image size specification.
196
- * Can be a preset name, auto, or structured aspect-ratio size object with optional 4k scale.
197
- */
198
- type ImageGenerationRequestSize = ImageGenerationRequestSizePreset | ImageGenerationRequestSizeAspectRatio | ImageGenerationRequestSizeAuto | "auto";
199
- /**
200
- * Image generation request parameters (API wire format).
201
- */
202
- type ImageGenerationRequest = {
203
- prompt: ImageGenerationRequestPrompt;
204
- negative_prompt?: string;
205
- magic_prompt?: boolean;
206
- model?: ImageGenerationModel;
207
- size?: ImageGenerationRequestSize;
208
- count?: number;
209
- output?: ImageGenerationRequestOutput;
210
- webhook?: ImageGenerationRequestWebhook;
211
- rating?: ImageGenerationRequestRating;
212
- access?: ImageGenerationRequestAccess;
213
- inputs?: (string | ImageGenerationRequestInput)[];
214
- metadata?: Record<string, unknown>;
215
- destination?: string;
216
- };
217
- /**
218
- * Image generation request parameters for the SDK client.
219
- * Accepts local files in `inputs`; they are uploaded before the API call.
220
- */
221
- type ImageGenerationClientRequest = Omit<ImageGenerationRequest, "inputs"> & {
222
- inputs?: (string | ImageUploadInput | ImageGenerationClientInput)[];
223
- };
224
- type ImageResultRatingDefaultLevel = "sfw" | "nsfw";
225
- type ImageResultRatingFailure = {
226
- status: "failed";
227
- error: {
228
- code: string;
229
- };
230
- };
231
- type ImageResultRating = {
232
- status: "success";
233
- level: ImageResultRatingDefaultLevel;
234
- } | {
235
- status: "success";
236
- level: string;
237
- } | ImageResultRatingFailure;
238
- type ImageResultDestination = {
239
- status: "success";
240
- name: string;
241
- } | {
242
- status: "failed";
243
- name: string;
244
- error: {
245
- code: string;
246
- message?: string;
247
- provider_response?: string;
248
- };
249
- };
250
- type ImageResultImageSuccess = {
251
- status: "success";
252
- id: string;
253
- url: string | null;
254
- mynth_url: string;
255
- size: string;
256
- cost: string;
257
- destination?: ImageResultDestination;
258
- rating?: ImageResultRating;
259
- };
260
- type ImageResultImageFailure = {
261
- status: "failed";
262
- error: {
263
- code: string;
264
- message?: string;
265
- };
266
- };
267
- type ImageResultImage = ImageResultImageSuccess | ImageResultImageFailure;
268
- type ImageResultMagicPrompt = {
269
- positive: string;
270
- negative?: string;
271
- };
272
- type ImageResult = {
273
- model: ImageGenerationModelId;
274
- images: ImageResultImage[];
275
- magic_prompt?: ImageResultMagicPrompt;
276
- };
277
- /** Custom rating level definition */
278
- type ImageRateRequestLevel<T extends string = string> = {
279
- /** Level value returned in the result */
280
- value: T;
281
- /** Human-readable description for the rating model */
282
- description: string;
283
- };
284
- /** Request body for the image rate endpoint (API wire format) */
285
- type ImageRateRequestBase = {
286
- /** Image URL to rate */
287
- url: string;
288
- };
289
- type ImageRateRequestRatingDefault = {
290
- /** Default sfw/nsfw classifier. When omitted, the API defaults to nsfw_sfw. */
291
- mode?: "nsfw_sfw";
292
- };
293
- type ImageRateRequestRatingCustom = {
294
- /** Custom classifier levels */
295
- mode: "custom";
296
- levels: readonly ImageRateRequestLevel[];
297
- };
298
- type ImageRateRequest = ImageRateRequestBase & (ImageRateRequestRatingDefault | ImageRateRequestRatingCustom);
299
- /** Image source for rate/alt SDK methods: a remote URL or a local file */
300
- type ImageClientUrlOrFile = {
301
- url: string;
302
- file?: never;
303
- } | {
304
- file: ImageUploadInput;
305
- url?: never;
306
- };
307
- /**
308
- * Image rate request for the SDK client.
309
- * Pass either `url` or `file` (files are uploaded before the API call).
310
- * Mode defaults to `nsfw_sfw` when omitted.
311
- */
312
- type ImageRateClientRequest = ImageClientUrlOrFile & (ImageRateRequestRatingDefault | ImageRateRequestRatingCustom);
313
- /** Create-task response from the image rate endpoint */
314
- type ImageRateCreatedResponse = {
315
- taskId: string;
316
- estimatedCost: string;
317
- };
318
- type ImageRateTaskResult<LevelT extends string = string> = {
319
- level: LevelT;
320
- };
321
- /** Request body for the image alt endpoint (API wire format) */
322
- type ImageAltRequest = {
323
- /** Image URL to generate alt text for */
324
- url: string;
325
- };
326
- /**
327
- * Image alt request for the SDK client.
328
- * Pass either `url` or `file` (files are uploaded before the API call).
329
- */
330
- type ImageAltClientRequest = ImageClientUrlOrFile;
331
- /** Create-task response from the image alt endpoint */
332
- type ImageAltCreatedResponse = {
333
- taskId: string;
334
- estimatedCost: string;
335
- };
336
- type ImageAltTaskResult = {
337
- alt: string;
338
- };
339
- /** Reviewer panel used for image quality analysis. */
340
- type ImageReviewEffort = "low" | "high";
341
- type ImageReviewSeverity = "critical" | "major" | "minor";
342
- type ImageReviewConfidence = "low" | "medium" | "high";
343
- /** Request body for the image review endpoint (API wire format). */
344
- type ImageReviewRequest = {
345
- /** Image URL to review. */
346
- url: string;
347
- /** Reviewer panel to run. Defaults to `high`. */
348
- effort?: ImageReviewEffort;
349
- };
350
- /**
351
- * Image review request for the SDK client.
352
- * Pass either `url` or `file` (files are uploaded before the API call).
353
- */
354
- type ImageReviewClientRequest = ImageClientUrlOrFile & {
355
- /** Reviewer panel to run. Defaults to `high`. */
356
- effort?: ImageReviewEffort;
357
- };
358
- /** Create-task response from the image review endpoint. */
359
- type ImageReviewCreatedResponse = {
360
- taskId: string;
361
- estimatedCost: string;
362
- };
363
- type ImageReviewFinding = {
364
- /** What is wrong, in plain language. */
365
- finding: string;
366
- /** Defect category. */
367
- category: string;
368
- severity: ImageReviewSeverity;
369
- /** Where the defect appears in the image, in plain language. */
370
- where: string;
371
- confidence: ImageReviewConfidence;
372
- };
373
- type ImageReviewStrength = {
374
- strength: string;
375
- confidence: ImageReviewConfidence;
376
- };
377
- type ImageReviewTaskResult = {
378
- /** Median reviewer score from 1 to 4. Higher is better. */
379
- score: number;
380
- summary: string;
381
- findings: ImageReviewFinding[];
382
- strengths: ImageReviewStrength[];
383
- };
384
- /** Formats that keep the transparent background. */
385
- type ImageRemoveBackgroundOutputFormat = "png" | "webp";
386
- type ImageRemoveBackgroundRequestOutput = {
387
- /** Converts the result to this format. When omitted, the provider's format is kept. */
388
- format?: ImageRemoveBackgroundOutputFormat;
389
- };
390
- /** Request body for the image remove background endpoint (API wire format). */
391
- type ImageRemoveBackgroundRequest = {
392
- /** Image URL to remove the background from. */
393
- url: string;
394
- output?: ImageRemoveBackgroundRequestOutput;
395
- webhook?: ImageGenerationRequestWebhook;
396
- access?: ImageGenerationRequestAccess;
397
- metadata?: Record<string, unknown>;
398
- destination?: string;
399
- };
400
- /**
401
- * Image remove background request for the SDK client.
402
- * Pass either `url` or `file` (files are uploaded before the API call).
403
- */
404
- type ImageRemoveBackgroundClientRequest = ImageClientUrlOrFile & Omit<ImageRemoveBackgroundRequest, "url">;
405
- /** Create-task response from the image remove background endpoint. */
406
- type ImageRemoveBackgroundCreatedResponse = {
407
- taskId: string;
408
- estimatedCost: string;
409
- access?: {
410
- publicAccessToken: string;
411
- };
412
- };
413
- type ImageRemoveBackgroundResultImage = {
414
- id: string;
415
- /** Destination URL, or the Mynth URL without a destination. `null` when delivery failed. */
416
- url: string | null;
417
- mynth_url: string;
418
- /** `{width}x{height}` */
419
- size: string;
420
- format: ImageRemoveBackgroundOutputFormat;
421
- destination?: ImageResultDestination;
422
- };
423
- type ImageRemoveBackgroundTaskResult = {
424
- image: ImageRemoveBackgroundResultImage;
425
- };
426
- /**
427
- * Video generation always runs on a pinned model; there is no `auto`.
428
- */
429
- type VideoGenerationModelId = "bytedance/seedance-2.0-mini" | "google/gemini-omni-flash-1.1" | "prunaai/p-video";
430
- type VideoGenerationModel = VideoGenerationModelId;
431
- /** Resolution tier. Each model supports a subset; see `AVAILABLE_VIDEO_MODELS`. */
432
- type VideoGenerationRequestResolution = "480p" | "720p" | "1080p" | "4k";
433
- /** Video webhook configuration (same shape as image generation). */
434
- type VideoGenerationRequestWebhook = ImageGenerationRequestWebhook;
435
- /** Video access configuration (same shape as image generation). */
436
- type VideoGenerationRequestAccess = ImageGenerationRequestAccess;
437
- /** Video input source (API wire format) */
438
- type VideoGenerationRequestInputSource = {
439
- type: "url";
440
- url: string;
441
- };
442
- /**
443
- * Role of an input image.
444
- * `first_frame` and `last_frame` bracket the generated clip; `reference` is
445
- * guidance only. Defaults to `auto`, which assigns the first image as the
446
- * first frame.
447
- */
448
- type VideoGenerationRequestInputAs = "auto" | "first_frame" | "last_frame" | "reference";
449
- /** Structured video input (API wire format) */
450
- type VideoGenerationRequestInput = {
451
- type: "image";
452
- as?: VideoGenerationRequestInputAs;
453
- source: VideoGenerationRequestInputSource;
454
- };
455
- /** Structured video input for the SDK client (may include local files) */
456
- type VideoGenerationClientInput = Omit<VideoGenerationRequestInput, "source"> & {
457
- source: VideoGenerationRequestInputSource | {
458
- type: "file";
459
- file: ImageUploadInput;
460
- };
461
- };
462
- /**
463
- * Video generation request parameters (API wire format).
464
- */
465
- type VideoGenerationRequest = {
466
- model: VideoGenerationModel;
467
- prompt: string;
468
- negative_prompt?: string;
469
- /** Duration in whole seconds. Defaults to the model's default duration. */
470
- duration?: number;
471
- /** Resolution tier. Defaults to the model's default tier. */
472
- resolution?: VideoGenerationRequestResolution;
473
- /** Model-native generated audio. Only for models with the audio capability. */
474
- audio?: boolean;
475
- inputs?: (string | VideoGenerationRequestInput)[];
476
- webhook?: VideoGenerationRequestWebhook;
477
- access?: VideoGenerationRequestAccess;
478
- metadata?: Record<string, unknown>;
479
- };
480
- /**
481
- * Video generation request parameters for the SDK client.
482
- * Accepts local files in `inputs`; they are uploaded before the API call.
483
- */
484
- type VideoGenerationClientRequest = Omit<VideoGenerationRequest, "inputs"> & {
485
- inputs?: (string | ImageUploadInput | VideoGenerationClientInput)[];
486
- };
487
- /** Create-task response from the video generate endpoint */
488
- type VideoGenerationCreatedResponse = {
489
- taskId: string;
490
- /** Cost reserved for the task. Failed videos are refunded. */
491
- estimatedCost: string;
492
- access?: {
493
- publicAccessToken: string;
494
- };
495
- };
496
- /** Response from the video generation cost estimate endpoint */
497
- type VideoGenerationEstimate = {
498
- /** Estimated cost in USD. Nothing is generated or charged. */
499
- estimatedCost: string;
500
- currency: "usd";
501
- /** Video generation always pins a model, so the estimate is exact. */
502
- estimateKind: "exact";
503
- };
504
- type VideoResultVideoSuccess = {
505
- status: "success";
506
- id: string;
507
- url: string;
508
- mynth_url: string;
509
- cost: string;
510
- /** Duration of the generated video in seconds */
511
- duration: number;
512
- resolution: VideoGenerationRequestResolution;
513
- /** Whether the video was generated with audio */
514
- audio: boolean;
515
- };
516
- type VideoResultVideoFailure = {
517
- status: "failed";
518
- error: {
519
- code: string;
520
- message?: string;
521
- };
522
- };
523
- type VideoResultVideo = VideoResultVideoSuccess | VideoResultVideoFailure;
524
- type VideoResult = {
525
- model: VideoGenerationModelId;
526
- videos: VideoResultVideo[];
527
- };
528
- /**
529
- * Webhook payload for image generation task completion.
530
- */
531
- type WebhookTaskImageCompletedPayload = {
532
- task: {
533
- id: string;
534
- };
535
- event: "task.image.generate.completed";
536
- result: ImageResult;
537
- request: ImageGenerationRequest;
538
- };
539
- /**
540
- * Webhook payload for image generation task failure.
541
- */
542
- type WebhookTaskImageFailedPayload = {
543
- task: {
544
- id: string;
545
- };
546
- event: "task.image.generate.failed";
547
- request: ImageGenerationRequest;
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
- //# sourceMappingURL=types.d.ts.map
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 };