@mynthio/sdk 0.0.51 → 0.0.52

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 CHANGED
@@ -692,7 +692,7 @@ const task = await mynth.video.generate({
692
692
  model: "google/gemini-omni-flash-1.1",
693
693
  prompt: "A drone shot over a misty forest at dawn",
694
694
  duration: 8,
695
- resolution: "1080p",
695
+ size: "9:16_1080p",
696
696
  audio: true,
697
697
  });
698
698
 
@@ -720,9 +720,26 @@ return { id: taskAsync.id, access: taskAsync.access };
720
720
 
721
721
  `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
722
 
723
- ### Duration, Resolution and Audio
723
+ ### Size
724
724
 
725
- `duration` is in whole seconds and `resolution` is a tier (`"480p"`, `"720p"`, `"1080p"`, `"4k"`). Each model accepts a subset of both, and rejects a request outside it. Omit either to take the model default. `audio: true` enables model-native generated audio.
725
+ `size` sets the aspect ratio and the resolution tier:
726
+
727
+ ```ts
728
+ size: "auto"; // default: the model's default shape and tier
729
+ size: "portrait"; // a named shape or an aspect ratio, at the model's default tier
730
+ size: "9:16_1080p"; // a shape with a tier
731
+ size: "auto_1080p"; // the model's default shape, at a tier
732
+ size: { type: "aspect_ratio", aspect_ratio: "9:16", resolution: "1080p" };
733
+ size: { type: "auto", resolution: "1080p" };
734
+ ```
735
+
736
+ 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`.
737
+
738
+ 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.
739
+
740
+ ### Duration and Audio
741
+
742
+ `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
743
 
727
744
  ### Input Images
728
745
 
@@ -759,7 +776,7 @@ const { estimated_cost } = await mynth.video.estimate({
759
776
  model: "google/gemini-omni-flash-1.1",
760
777
  prompt: "A timelapse of clouds over a canyon",
761
778
  duration: 10,
762
- resolution: "4k",
779
+ size: "16:9_4k",
763
780
  });
764
781
  ```
765
782
 
@@ -780,7 +797,7 @@ console.log(task.metadata);
780
797
  console.log(task.raw);
781
798
  ```
782
799
 
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.
800
+ 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
801
 
785
802
  ### Video Models
786
803
 
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
- * resolution: "1080p",
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
- * resolution: "4k",
634
+ * size: "16:9_4k",
635
635
  * });
636
636
  * ```
637
637
  */
package/dist/index.js CHANGED
@@ -1287,7 +1287,7 @@ var MynthImage = class {
1287
1287
  * model: "google/gemini-omni-flash-1.1",
1288
1288
  * prompt: "A cat surfing a wave at sunset",
1289
1289
  * duration: 8,
1290
- * resolution: "1080p",
1290
+ * size: "9:16_1080p",
1291
1291
  * });
1292
1292
  *
1293
1293
  * console.log(result.urls); // ["https://..."]
@@ -1375,7 +1375,7 @@ var MynthVideo = class {
1375
1375
  * Price a video generation request without generating anything.
1376
1376
  *
1377
1377
  * The request is validated exactly as `generate()` would validate it, so an
1378
- * unsupported duration, resolution or input combination throws here too —
1378
+ * unsupported duration, resolution tier or input combination throws here too —
1379
1379
  * making this a cheap pre-flight check as well as a cost lookup. Because
1380
1380
  * video pins a concrete model, the returned estimate is exact.
1381
1381
  *
@@ -1388,7 +1388,7 @@ var MynthVideo = class {
1388
1388
  * model: "google/gemini-omni-flash-1.1",
1389
1389
  * prompt: "A timelapse of clouds over a canyon",
1390
1390
  * duration: 10,
1391
- * resolution: "4k",
1391
+ * size: "16:9_4k",
1392
1392
  * });
1393
1393
  * ```
1394
1394
  */
package/dist/utils.js CHANGED
@@ -182,6 +182,7 @@ function toOutputVideo(video) {
182
182
  cost: video.cost,
183
183
  duration: video.duration,
184
184
  resolution: video.resolution,
185
+ aspectRatio: video.aspect_ratio,
185
186
  audio: video.audio
186
187
  };
187
188
  }
@@ -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
- /** Resolution tier. Defaults to the model's default tier. */
511
- resolution?: VideoGenerationRequestResolution;
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mynthio/sdk",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "Official Mynth SDK for image generation and analysis",
5
5
  "keywords": [
6
6
  "ai",