@mynthio/sdk 0.0.51 → 0.0.53
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 +23 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -3
- package/dist/utils.js +1 -0
- package/dist/video-generation-result.d.ts +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -640,6 +640,7 @@ Current model IDs include:
|
|
|
640
640
|
- `auto`
|
|
641
641
|
- `alibaba/qwen-image-2.0`
|
|
642
642
|
- `alibaba/qwen-image-2.0-pro`
|
|
643
|
+
- `alibaba/qwen-image-2.1-turbo`
|
|
643
644
|
- `alibaba/qwen-image-3.0`
|
|
644
645
|
- `alibaba/qwen-image-3.0-pro`
|
|
645
646
|
- `bytedance/seedream-5.0-lite`
|
|
@@ -692,7 +693,7 @@ const task = await mynth.video.generate({
|
|
|
692
693
|
model: "google/gemini-omni-flash-1.1",
|
|
693
694
|
prompt: "A drone shot over a misty forest at dawn",
|
|
694
695
|
duration: 8,
|
|
695
|
-
|
|
696
|
+
size: "9:16_1080p",
|
|
696
697
|
audio: true,
|
|
697
698
|
});
|
|
698
699
|
|
|
@@ -720,9 +721,26 @@ return { id: taskAsync.id, access: taskAsync.access };
|
|
|
720
721
|
|
|
721
722
|
`taskAsync.access.publicAccessToken` works exactly as it does for images: requested with `generate_public_access_token: true`, scoped to that one task, safe to send to the client, and usable against `GET /tasks/:id/status` and `GET /tasks/:id/result`.
|
|
722
723
|
|
|
723
|
-
###
|
|
724
|
+
### Size
|
|
724
725
|
|
|
725
|
-
`
|
|
726
|
+
`size` sets the aspect ratio and the resolution tier:
|
|
727
|
+
|
|
728
|
+
```ts
|
|
729
|
+
size: "auto"; // default: the model's default shape and tier
|
|
730
|
+
size: "portrait"; // a named shape or an aspect ratio, at the model's default tier
|
|
731
|
+
size: "9:16_1080p"; // a shape with a tier
|
|
732
|
+
size: "auto_1080p"; // the model's default shape, at a tier
|
|
733
|
+
size: { type: "aspect_ratio", aspect_ratio: "9:16", resolution: "1080p" };
|
|
734
|
+
size: { type: "auto", resolution: "1080p" };
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
Shapes are the same as for images: `square`, `portrait`, `landscape`, `portrait_tall`, `landscape_wide`, and the ratios `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`, `2:1`, `1:2`.
|
|
738
|
+
|
|
739
|
+
The aspect ratio is best effort: the model gets the closest one it supports. With image inputs, the first frame sets the shape and the aspect ratio is ignored. The tier (`"480p"`, `"720p"`, `"1080p"`, `"4k"`) is strict, because it sets the price: each model accepts a subset, and rejects a tier outside it.
|
|
740
|
+
|
|
741
|
+
### Duration and Audio
|
|
742
|
+
|
|
743
|
+
`duration` is in whole seconds. Each model accepts a range, and rejects a request outside it. Omit it to take the model default. `audio: true` enables model-native generated audio.
|
|
726
744
|
|
|
727
745
|
### Input Images
|
|
728
746
|
|
|
@@ -759,7 +777,7 @@ const { estimated_cost } = await mynth.video.estimate({
|
|
|
759
777
|
model: "google/gemini-omni-flash-1.1",
|
|
760
778
|
prompt: "A timelapse of clouds over a canyon",
|
|
761
779
|
duration: 10,
|
|
762
|
-
|
|
780
|
+
size: "16:9_4k",
|
|
763
781
|
});
|
|
764
782
|
```
|
|
765
783
|
|
|
@@ -780,7 +798,7 @@ console.log(task.metadata);
|
|
|
780
798
|
console.log(task.raw);
|
|
781
799
|
```
|
|
782
800
|
|
|
783
|
-
Each video has `id`, `url`, `mynthUrl`, `cost`, `duration`, `resolution`, and `audio`. `url` is `null` when the video could not be delivered there; `mynthUrl` is always set.
|
|
801
|
+
Each video has `id`, `url`, `mynthUrl`, `cost`, `duration`, `resolution`, `aspectRatio`, and `audio`. `aspectRatio` is `null` when the first frame set the shape. `url` is `null` when the video could not be delivered there; `mynthUrl` is always set.
|
|
784
802
|
|
|
785
803
|
### Video Models
|
|
786
804
|
|
package/dist/index.d.ts
CHANGED
|
@@ -543,7 +543,7 @@ declare class MynthImage {
|
|
|
543
543
|
* model: "google/gemini-omni-flash-1.1",
|
|
544
544
|
* prompt: "A cat surfing a wave at sunset",
|
|
545
545
|
* duration: 8,
|
|
546
|
-
*
|
|
546
|
+
* size: "9:16_1080p",
|
|
547
547
|
* });
|
|
548
548
|
*
|
|
549
549
|
* console.log(result.urls); // ["https://..."]
|
|
@@ -618,7 +618,7 @@ declare class MynthVideo {
|
|
|
618
618
|
* Price a video generation request without generating anything.
|
|
619
619
|
*
|
|
620
620
|
* The request is validated exactly as `generate()` would validate it, so an
|
|
621
|
-
* unsupported duration, resolution or input combination throws here too —
|
|
621
|
+
* unsupported duration, resolution tier or input combination throws here too —
|
|
622
622
|
* making this a cheap pre-flight check as well as a cost lookup. Because
|
|
623
623
|
* video pins a concrete model, the returned estimate is exact.
|
|
624
624
|
*
|
|
@@ -631,7 +631,7 @@ declare class MynthVideo {
|
|
|
631
631
|
* model: "google/gemini-omni-flash-1.1",
|
|
632
632
|
* prompt: "A timelapse of clouds over a canyon",
|
|
633
633
|
* duration: 10,
|
|
634
|
-
*
|
|
634
|
+
* size: "16:9_4k",
|
|
635
635
|
* });
|
|
636
636
|
* ```
|
|
637
637
|
*/
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,11 @@ const AVAILABLE_MODELS = [
|
|
|
39
39
|
label: "Qwen Image 2.0 Pro",
|
|
40
40
|
capabilities: ["inputs"]
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
id: "alibaba/qwen-image-2.1-turbo",
|
|
44
|
+
label: "Qwen Image 2.1 Turbo",
|
|
45
|
+
capabilities: ["inputs"]
|
|
46
|
+
},
|
|
42
47
|
{
|
|
43
48
|
id: "alibaba/qwen-image-3.0",
|
|
44
49
|
label: "Qwen Image 3.0",
|
|
@@ -114,6 +119,11 @@ const AVAILABLE_MODELS = [
|
|
|
114
119
|
label: "FLUX.3",
|
|
115
120
|
capabilities: ["inputs", "4k"]
|
|
116
121
|
},
|
|
122
|
+
{
|
|
123
|
+
id: "black-forest-labs/flux-3-klein",
|
|
124
|
+
label: "FLUX.3 Klein",
|
|
125
|
+
capabilities: ["inputs", "4k"]
|
|
126
|
+
},
|
|
117
127
|
{
|
|
118
128
|
id: "bria/fibo-edit-1.5",
|
|
119
129
|
label: "FIBO Edit 1.5",
|
|
@@ -1287,7 +1297,7 @@ var MynthImage = class {
|
|
|
1287
1297
|
* model: "google/gemini-omni-flash-1.1",
|
|
1288
1298
|
* prompt: "A cat surfing a wave at sunset",
|
|
1289
1299
|
* duration: 8,
|
|
1290
|
-
*
|
|
1300
|
+
* size: "9:16_1080p",
|
|
1291
1301
|
* });
|
|
1292
1302
|
*
|
|
1293
1303
|
* console.log(result.urls); // ["https://..."]
|
|
@@ -1375,7 +1385,7 @@ var MynthVideo = class {
|
|
|
1375
1385
|
* Price a video generation request without generating anything.
|
|
1376
1386
|
*
|
|
1377
1387
|
* The request is validated exactly as `generate()` would validate it, so an
|
|
1378
|
-
* unsupported duration, resolution or input combination throws here too —
|
|
1388
|
+
* unsupported duration, resolution tier or input combination throws here too —
|
|
1379
1389
|
* making this a cheap pre-flight check as well as a cost lookup. Because
|
|
1380
1390
|
* video pins a concrete model, the returned estimate is exact.
|
|
1381
1391
|
*
|
|
@@ -1388,7 +1398,7 @@ var MynthVideo = class {
|
|
|
1388
1398
|
* model: "google/gemini-omni-flash-1.1",
|
|
1389
1399
|
* prompt: "A timelapse of clouds over a canyon",
|
|
1390
1400
|
* duration: 10,
|
|
1391
|
-
*
|
|
1401
|
+
* size: "16:9_4k",
|
|
1392
1402
|
* });
|
|
1393
1403
|
* ```
|
|
1394
1404
|
*/
|
package/dist/utils.js
CHANGED
|
@@ -187,7 +187,7 @@ declare namespace MynthSDKTypes {
|
|
|
187
187
|
};
|
|
188
188
|
type Model = ImageModel | VideoModel;
|
|
189
189
|
type ModelsListResponse = ApiResponse<Model[]>;
|
|
190
|
-
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" | "bytedance/seedream-v5-flash" | "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" | "black-forest-labs/flux-3" | "bria/fibo-edit-1.5" | "bria/fibo-generate-1.5" | "circlestone-labs/anima" | "goofy-ai/prefect-pony-xl-lora" | "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" | "ideogram/ideogram-4.5" | "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.1-flash" | "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";
|
|
190
|
+
type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "alibaba/qwen-image-2.1-turbo" | "alibaba/qwen-image-3.0" | "alibaba/qwen-image-3.0-pro" | "bytedance/seedream-5.0-lite" | "bytedance/seedream-pro" | "bytedance/seedream-v5-flash" | "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" | "black-forest-labs/flux-3" | "black-forest-labs/flux-3-klein" | "bria/fibo-edit-1.5" | "bria/fibo-generate-1.5" | "circlestone-labs/anima" | "goofy-ai/prefect-pony-xl-lora" | "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" | "ideogram/ideogram-4.5" | "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.1-flash" | "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";
|
|
191
191
|
type ImageGenerationModel = ImageGenerationModelId | "auto";
|
|
192
192
|
type GenerateImageOptionsIn = {
|
|
193
193
|
prompt: string;
|
|
@@ -484,6 +484,18 @@ declare namespace MynthSDKTypes {
|
|
|
484
484
|
type VideoGenerationModelId = "bytedance/seedance-2.0-mini" | "google/gemini-omni-flash-1.1" | "prunaai/p-video" | "xai/grok-imagine-video-1.5";
|
|
485
485
|
type VideoGenerationModel = VideoGenerationModelId;
|
|
486
486
|
type VideoGenerationRequestResolution = "480p" | "720p" | "1080p" | "4k";
|
|
487
|
+
type VideoGenerationRequestSizeShape = "auto" | "square" | "portrait" | "landscape" | "portrait_tall" | "landscape_wide" | ImageGenerationRequestAspectRatio;
|
|
488
|
+
type VideoGenerationRequestSizePreset = VideoGenerationRequestSizeShape | `${VideoGenerationRequestSizeShape}_${VideoGenerationRequestResolution}`;
|
|
489
|
+
type VideoGenerationRequestSizeAspectRatio = {
|
|
490
|
+
type: "aspect_ratio";
|
|
491
|
+
aspect_ratio: ImageGenerationRequestAspectRatio;
|
|
492
|
+
resolution?: VideoGenerationRequestResolution;
|
|
493
|
+
};
|
|
494
|
+
type VideoGenerationRequestSizeAuto = {
|
|
495
|
+
type: "auto";
|
|
496
|
+
resolution?: VideoGenerationRequestResolution;
|
|
497
|
+
};
|
|
498
|
+
type VideoGenerationRequestSize = VideoGenerationRequestSizePreset | VideoGenerationRequestSizeAspectRatio | VideoGenerationRequestSizeAuto;
|
|
487
499
|
type VideoGenerationRequestWebhook = ImageGenerationRequestWebhook;
|
|
488
500
|
type VideoGenerationRequestInputSource = {
|
|
489
501
|
type: "url";
|
|
@@ -507,8 +519,8 @@ declare namespace MynthSDKTypes {
|
|
|
507
519
|
negative_prompt?: string;
|
|
508
520
|
/** Duration in whole seconds. Defaults to the model's default duration. */
|
|
509
521
|
duration?: number;
|
|
510
|
-
/**
|
|
511
|
-
|
|
522
|
+
/** Aspect ratio and resolution tier. Defaults to `"auto"` at the model's default tier. */
|
|
523
|
+
size?: VideoGenerationRequestSize;
|
|
512
524
|
/** Model-native generated audio. Only for models with the audio capability. */
|
|
513
525
|
audio?: boolean;
|
|
514
526
|
inputs?: (string | VideoGenerationRequestInput)[];
|
|
@@ -538,6 +550,8 @@ declare namespace MynthSDKTypes {
|
|
|
538
550
|
/** Duration of the generated video in seconds */
|
|
539
551
|
duration: number;
|
|
540
552
|
resolution: VideoGenerationRequestResolution;
|
|
553
|
+
/** Aspect ratio the video was generated at, e.g. `"16:9"`. `null` when the first frame set it. */
|
|
554
|
+
aspect_ratio: string | null;
|
|
541
555
|
/** Whether the video was generated with audio */
|
|
542
556
|
audio: boolean;
|
|
543
557
|
};
|
|
@@ -829,6 +843,8 @@ type MynthOutputVideo = {
|
|
|
829
843
|
duration: number;
|
|
830
844
|
/** Resolution tier the video was rendered at */
|
|
831
845
|
resolution: MynthSDKTypes.VideoGenerationRequestResolution;
|
|
846
|
+
/** Aspect ratio the video was generated at, e.g. `"16:9"`. `null` when the first frame set it. */
|
|
847
|
+
aspectRatio: string | null;
|
|
832
848
|
/** Whether the video has generated audio */
|
|
833
849
|
audio: boolean;
|
|
834
850
|
};
|