@shop-os/modelkit 0.2.14 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -25,10 +25,14 @@ type OutputFormat = "png" | "jpeg" | "webp";
25
25
  type MediaRef = {
26
26
  url: string;
27
27
  label?: string;
28
+ /** Measured length of a video/audio; the kit never measures it. */
29
+ durationSeconds?: number;
28
30
  } | {
29
31
  bytes: Uint8Array;
30
32
  mime: string;
31
33
  label?: string;
34
+ /** Measured length of a video/audio; the kit never measures it. */
35
+ durationSeconds?: number;
32
36
  };
33
37
  /** Caller-driven Topaz upscale controls; see the topaz row and TopazImageInput. */
34
38
  interface UpscaleOptions {
@@ -106,8 +110,14 @@ interface VideoRequest {
106
110
  watermark?: boolean;
107
111
  /** Provider-side safety checker toggle (fal MiniMax). Provider default when unset. */
108
112
  safetyChecker?: boolean;
109
- /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio. */
113
+ /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio.
114
+ * `extend` on a `videoExtension` row continues the clip by `durationSeconds` more. */
110
115
  taskType?: "reference" | "edit" | "extend";
116
+ /** Continue a provider-side session instead of re-sending the clip (Gemini Omni
117
+ * Interactions `previous_interaction_id`). The prior call's `VideoResult.providerRef`
118
+ * carries it. The provider rejects it together with an explicit video task, so the
119
+ * adapter sends the prompt alone; `taskType: "extend"` still selects the extend path. */
120
+ previousInteractionId?: string;
111
121
  mode?: "standard" | "pro";
112
122
  }
113
123
  /**
@@ -159,7 +169,19 @@ interface MediaPart {
159
169
  cleanup?: () => Promise<void>;
160
170
  }
161
171
  type RequiredInput = "firstFrame" | "sourceVideo" | "references";
162
- type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
172
+ type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental"
173
+ /** Video rows that extend a clip in fixed segments up to a cumulative cap (see `ModelConstraints.extension`). */
174
+ | "videoExtension";
175
+ interface VideoSecondsLimits {
176
+ /** Minimum length of each reference video, in seconds. */
177
+ min?: number;
178
+ /** Maximum length of each reference video, in seconds. */
179
+ max?: number;
180
+ /** Maximum combined length of the reference videos, in seconds. */
181
+ total?: number;
182
+ /** Higher per-video minimum when `taskType` is `edit` (Seedance 2.5: 4 s). */
183
+ editMin?: number;
184
+ }
163
185
  interface ReferenceLimits {
164
186
  images?: number;
165
187
  /** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
@@ -169,6 +191,8 @@ interface ReferenceLimits {
169
191
  total?: number;
170
192
  /** Provider rejects a request whose only references are audio. */
171
193
  audioOnly?: boolean;
194
+ /** Per-video length caps (min/max each) and combined total for reference videos. */
195
+ videoSeconds?: VideoSecondsLimits;
172
196
  }
173
197
  interface ModelConstraints {
174
198
  aspectRatios?: AspectRatio[];
@@ -192,6 +216,17 @@ interface ModelConstraints {
192
216
  supports?: SupportedOption[];
193
217
  /** Ratio is dropped, with a warning, when one of these inputs is present. */
194
218
  ratioIgnoredWith?: ("firstFrame" | "sourceVideo")[];
219
+ /** Length limits for the source video the row edits or extends. */
220
+ sourceVideoSeconds?: Omit<VideoSecondsLimits, "total"> & {
221
+ /** The provider sends the source as a reference video, so it counts toward `references.videoSeconds.total` (Seedance). */
222
+ inReferenceTotal?: boolean;
223
+ };
224
+ /** Video extension (rows with `supports: ["videoExtension"]`): each `taskType: "extend"`
225
+ * call adds up to `segmentSeconds` and the clip can grow to `maxTotalSeconds`. */
226
+ extension?: {
227
+ segmentSeconds: number;
228
+ maxTotalSeconds: number;
229
+ };
195
230
  }
196
231
  /** JSON-compatible value. Provider options and raw payloads carry these, never `unknown`. */
197
232
  type JsonPrimitive = string | number | boolean | null;
@@ -333,6 +368,10 @@ interface VideoResult {
333
368
  };
334
369
  usage: UsageEvent;
335
370
  raw?: unknown;
371
+ /** Provider handle for chaining a follow-up call (`VideoRequest.previousInteractionId`). */
372
+ providerRef?: {
373
+ interactionId: string;
374
+ };
336
375
  }
337
376
  interface VideoCallJob extends VideoJob {
338
377
  warnings: Warning[];
@@ -589,6 +628,12 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
589
628
  audios: z.ZodOptional<z.ZodNumber>;
590
629
  total: z.ZodOptional<z.ZodNumber>;
591
630
  audioOnly: z.ZodOptional<z.ZodBoolean>;
631
+ videoSeconds: z.ZodOptional<z.ZodObject<{
632
+ min: z.ZodOptional<z.ZodNumber>;
633
+ max: z.ZodOptional<z.ZodNumber>;
634
+ total: z.ZodOptional<z.ZodNumber>;
635
+ editMin: z.ZodOptional<z.ZodNumber>;
636
+ }, z.core.$loose>>;
592
637
  }, z.core.$loose>>;
593
638
  requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
594
639
  references: "references";
@@ -613,20 +658,33 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
613
658
  safetyChecker: "safetyChecker";
614
659
  taskType: "taskType";
615
660
  instrumental: "instrumental";
661
+ videoExtension: "videoExtension";
616
662
  }>>>;
617
663
  ratioIgnoredWith: z.ZodOptional<z.ZodArray<z.ZodEnum<{
618
664
  firstFrame: "firstFrame";
619
665
  sourceVideo: "sourceVideo";
620
666
  }>>>;
667
+ sourceVideoSeconds: z.ZodOptional<z.ZodObject<{
668
+ max: z.ZodOptional<z.ZodNumber>;
669
+ min: z.ZodOptional<z.ZodNumber>;
670
+ editMin: z.ZodOptional<z.ZodNumber>;
671
+ inReferenceTotal: z.ZodOptional<z.ZodBoolean>;
672
+ }, z.core.$loose>>;
673
+ extension: z.ZodOptional<z.ZodObject<{
674
+ segmentSeconds: z.ZodNumber;
675
+ maxTotalSeconds: z.ZodNumber;
676
+ }, z.core.$loose>>;
621
677
  }, z.core.$loose>;
622
678
  defaults: z.ZodObject<{
623
679
  references: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
624
680
  url: z.ZodString;
625
681
  label: z.ZodOptional<z.ZodString>;
682
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
626
683
  }, z.core.$loose>, z.ZodObject<{
627
684
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
628
685
  mime: z.ZodString;
629
686
  label: z.ZodOptional<z.ZodString>;
687
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
630
688
  }, z.core.$loose>]>>>;
631
689
  aspectRatio: z.ZodOptional<z.ZodEnum<{
632
690
  "1:1": "1:1";
@@ -681,50 +739,62 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
681
739
  firstFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
682
740
  url: z.ZodString;
683
741
  label: z.ZodOptional<z.ZodString>;
742
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
684
743
  }, z.core.$loose>, z.ZodObject<{
685
744
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
686
745
  mime: z.ZodString;
687
746
  label: z.ZodOptional<z.ZodString>;
747
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
688
748
  }, z.core.$loose>]>>;
689
749
  lastFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
690
750
  url: z.ZodString;
691
751
  label: z.ZodOptional<z.ZodString>;
752
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
692
753
  }, z.core.$loose>, z.ZodObject<{
693
754
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
694
755
  mime: z.ZodString;
695
756
  label: z.ZodOptional<z.ZodString>;
757
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
696
758
  }, z.core.$loose>]>>;
697
759
  sourceVideo: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
698
760
  url: z.ZodString;
699
761
  label: z.ZodOptional<z.ZodString>;
762
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
700
763
  }, z.core.$loose>, z.ZodObject<{
701
764
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
702
765
  mime: z.ZodString;
703
766
  label: z.ZodOptional<z.ZodString>;
767
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
704
768
  }, z.core.$loose>]>>;
705
769
  referenceImages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
706
770
  url: z.ZodString;
707
771
  label: z.ZodOptional<z.ZodString>;
772
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
708
773
  }, z.core.$loose>, z.ZodObject<{
709
774
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
710
775
  mime: z.ZodString;
711
776
  label: z.ZodOptional<z.ZodString>;
777
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
712
778
  }, z.core.$loose>]>>>;
713
779
  referenceVideos: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
714
780
  url: z.ZodString;
715
781
  label: z.ZodOptional<z.ZodString>;
782
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
716
783
  }, z.core.$loose>, z.ZodObject<{
717
784
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
718
785
  mime: z.ZodString;
719
786
  label: z.ZodOptional<z.ZodString>;
787
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
720
788
  }, z.core.$loose>]>>>;
721
789
  referenceAudios: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
722
790
  url: z.ZodString;
723
791
  label: z.ZodOptional<z.ZodString>;
792
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
724
793
  }, z.core.$loose>, z.ZodObject<{
725
794
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
726
795
  mime: z.ZodString;
727
796
  label: z.ZodOptional<z.ZodString>;
797
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
728
798
  }, z.core.$loose>]>>>;
729
799
  resolution: z.ZodOptional<z.ZodEnum<{
730
800
  "360p": "360p";
@@ -936,6 +1006,12 @@ interface ResolveResult<T> {
936
1006
  }
937
1007
  /** Nearest supported ratio in the same orientation bucket, else nearest overall, by log distance. */
938
1008
  declare function nearestAspectRatio(requested: AspectRatio, supported: AspectRatio[]): AspectRatio;
1009
+ /** First length violation for the videos a request sends, as a user-facing message. */
1010
+ declare function videoLengthViolation(model: CatalogModel, input: {
1011
+ referenceVideos?: (number | undefined)[];
1012
+ sourceVideo?: number;
1013
+ taskType?: VideoRequest["taskType"];
1014
+ }): string | undefined;
939
1015
  declare function resolveImageOptions(model: CatalogModel, request: ImageRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest>;
940
1016
  declare function resolveVideoOptions(model: CatalogModel, request: VideoRequest, onUnsupported?: OnUnsupported): ResolveResult<VideoRequest>;
941
1017
  declare function resolveAudioOptions(model: CatalogModel, request: AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<AudioRequest>;
@@ -1143,4 +1219,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
1143
1219
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
1144
1220
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
1145
1221
 
1146
- export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, withRetry, xaiVideoAdapter };
1222
+ export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, withRetry, xaiVideoAdapter };
package/dist/index.d.ts CHANGED
@@ -25,10 +25,14 @@ type OutputFormat = "png" | "jpeg" | "webp";
25
25
  type MediaRef = {
26
26
  url: string;
27
27
  label?: string;
28
+ /** Measured length of a video/audio; the kit never measures it. */
29
+ durationSeconds?: number;
28
30
  } | {
29
31
  bytes: Uint8Array;
30
32
  mime: string;
31
33
  label?: string;
34
+ /** Measured length of a video/audio; the kit never measures it. */
35
+ durationSeconds?: number;
32
36
  };
33
37
  /** Caller-driven Topaz upscale controls; see the topaz row and TopazImageInput. */
34
38
  interface UpscaleOptions {
@@ -106,8 +110,14 @@ interface VideoRequest {
106
110
  watermark?: boolean;
107
111
  /** Provider-side safety checker toggle (fal MiniMax). Provider default when unset. */
108
112
  safetyChecker?: boolean;
109
- /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio. */
113
+ /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio.
114
+ * `extend` on a `videoExtension` row continues the clip by `durationSeconds` more. */
110
115
  taskType?: "reference" | "edit" | "extend";
116
+ /** Continue a provider-side session instead of re-sending the clip (Gemini Omni
117
+ * Interactions `previous_interaction_id`). The prior call's `VideoResult.providerRef`
118
+ * carries it. The provider rejects it together with an explicit video task, so the
119
+ * adapter sends the prompt alone; `taskType: "extend"` still selects the extend path. */
120
+ previousInteractionId?: string;
111
121
  mode?: "standard" | "pro";
112
122
  }
113
123
  /**
@@ -159,7 +169,19 @@ interface MediaPart {
159
169
  cleanup?: () => Promise<void>;
160
170
  }
161
171
  type RequiredInput = "firstFrame" | "sourceVideo" | "references";
162
- type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
172
+ type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental"
173
+ /** Video rows that extend a clip in fixed segments up to a cumulative cap (see `ModelConstraints.extension`). */
174
+ | "videoExtension";
175
+ interface VideoSecondsLimits {
176
+ /** Minimum length of each reference video, in seconds. */
177
+ min?: number;
178
+ /** Maximum length of each reference video, in seconds. */
179
+ max?: number;
180
+ /** Maximum combined length of the reference videos, in seconds. */
181
+ total?: number;
182
+ /** Higher per-video minimum when `taskType` is `edit` (Seedance 2.5: 4 s). */
183
+ editMin?: number;
184
+ }
163
185
  interface ReferenceLimits {
164
186
  images?: number;
165
187
  /** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
@@ -169,6 +191,8 @@ interface ReferenceLimits {
169
191
  total?: number;
170
192
  /** Provider rejects a request whose only references are audio. */
171
193
  audioOnly?: boolean;
194
+ /** Per-video length caps (min/max each) and combined total for reference videos. */
195
+ videoSeconds?: VideoSecondsLimits;
172
196
  }
173
197
  interface ModelConstraints {
174
198
  aspectRatios?: AspectRatio[];
@@ -192,6 +216,17 @@ interface ModelConstraints {
192
216
  supports?: SupportedOption[];
193
217
  /** Ratio is dropped, with a warning, when one of these inputs is present. */
194
218
  ratioIgnoredWith?: ("firstFrame" | "sourceVideo")[];
219
+ /** Length limits for the source video the row edits or extends. */
220
+ sourceVideoSeconds?: Omit<VideoSecondsLimits, "total"> & {
221
+ /** The provider sends the source as a reference video, so it counts toward `references.videoSeconds.total` (Seedance). */
222
+ inReferenceTotal?: boolean;
223
+ };
224
+ /** Video extension (rows with `supports: ["videoExtension"]`): each `taskType: "extend"`
225
+ * call adds up to `segmentSeconds` and the clip can grow to `maxTotalSeconds`. */
226
+ extension?: {
227
+ segmentSeconds: number;
228
+ maxTotalSeconds: number;
229
+ };
195
230
  }
196
231
  /** JSON-compatible value. Provider options and raw payloads carry these, never `unknown`. */
197
232
  type JsonPrimitive = string | number | boolean | null;
@@ -333,6 +368,10 @@ interface VideoResult {
333
368
  };
334
369
  usage: UsageEvent;
335
370
  raw?: unknown;
371
+ /** Provider handle for chaining a follow-up call (`VideoRequest.previousInteractionId`). */
372
+ providerRef?: {
373
+ interactionId: string;
374
+ };
336
375
  }
337
376
  interface VideoCallJob extends VideoJob {
338
377
  warnings: Warning[];
@@ -589,6 +628,12 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
589
628
  audios: z.ZodOptional<z.ZodNumber>;
590
629
  total: z.ZodOptional<z.ZodNumber>;
591
630
  audioOnly: z.ZodOptional<z.ZodBoolean>;
631
+ videoSeconds: z.ZodOptional<z.ZodObject<{
632
+ min: z.ZodOptional<z.ZodNumber>;
633
+ max: z.ZodOptional<z.ZodNumber>;
634
+ total: z.ZodOptional<z.ZodNumber>;
635
+ editMin: z.ZodOptional<z.ZodNumber>;
636
+ }, z.core.$loose>>;
592
637
  }, z.core.$loose>>;
593
638
  requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
594
639
  references: "references";
@@ -613,20 +658,33 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
613
658
  safetyChecker: "safetyChecker";
614
659
  taskType: "taskType";
615
660
  instrumental: "instrumental";
661
+ videoExtension: "videoExtension";
616
662
  }>>>;
617
663
  ratioIgnoredWith: z.ZodOptional<z.ZodArray<z.ZodEnum<{
618
664
  firstFrame: "firstFrame";
619
665
  sourceVideo: "sourceVideo";
620
666
  }>>>;
667
+ sourceVideoSeconds: z.ZodOptional<z.ZodObject<{
668
+ max: z.ZodOptional<z.ZodNumber>;
669
+ min: z.ZodOptional<z.ZodNumber>;
670
+ editMin: z.ZodOptional<z.ZodNumber>;
671
+ inReferenceTotal: z.ZodOptional<z.ZodBoolean>;
672
+ }, z.core.$loose>>;
673
+ extension: z.ZodOptional<z.ZodObject<{
674
+ segmentSeconds: z.ZodNumber;
675
+ maxTotalSeconds: z.ZodNumber;
676
+ }, z.core.$loose>>;
621
677
  }, z.core.$loose>;
622
678
  defaults: z.ZodObject<{
623
679
  references: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
624
680
  url: z.ZodString;
625
681
  label: z.ZodOptional<z.ZodString>;
682
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
626
683
  }, z.core.$loose>, z.ZodObject<{
627
684
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
628
685
  mime: z.ZodString;
629
686
  label: z.ZodOptional<z.ZodString>;
687
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
630
688
  }, z.core.$loose>]>>>;
631
689
  aspectRatio: z.ZodOptional<z.ZodEnum<{
632
690
  "1:1": "1:1";
@@ -681,50 +739,62 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
681
739
  firstFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
682
740
  url: z.ZodString;
683
741
  label: z.ZodOptional<z.ZodString>;
742
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
684
743
  }, z.core.$loose>, z.ZodObject<{
685
744
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
686
745
  mime: z.ZodString;
687
746
  label: z.ZodOptional<z.ZodString>;
747
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
688
748
  }, z.core.$loose>]>>;
689
749
  lastFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
690
750
  url: z.ZodString;
691
751
  label: z.ZodOptional<z.ZodString>;
752
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
692
753
  }, z.core.$loose>, z.ZodObject<{
693
754
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
694
755
  mime: z.ZodString;
695
756
  label: z.ZodOptional<z.ZodString>;
757
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
696
758
  }, z.core.$loose>]>>;
697
759
  sourceVideo: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
698
760
  url: z.ZodString;
699
761
  label: z.ZodOptional<z.ZodString>;
762
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
700
763
  }, z.core.$loose>, z.ZodObject<{
701
764
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
702
765
  mime: z.ZodString;
703
766
  label: z.ZodOptional<z.ZodString>;
767
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
704
768
  }, z.core.$loose>]>>;
705
769
  referenceImages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
706
770
  url: z.ZodString;
707
771
  label: z.ZodOptional<z.ZodString>;
772
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
708
773
  }, z.core.$loose>, z.ZodObject<{
709
774
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
710
775
  mime: z.ZodString;
711
776
  label: z.ZodOptional<z.ZodString>;
777
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
712
778
  }, z.core.$loose>]>>>;
713
779
  referenceVideos: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
714
780
  url: z.ZodString;
715
781
  label: z.ZodOptional<z.ZodString>;
782
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
716
783
  }, z.core.$loose>, z.ZodObject<{
717
784
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
718
785
  mime: z.ZodString;
719
786
  label: z.ZodOptional<z.ZodString>;
787
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
720
788
  }, z.core.$loose>]>>>;
721
789
  referenceAudios: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
722
790
  url: z.ZodString;
723
791
  label: z.ZodOptional<z.ZodString>;
792
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
724
793
  }, z.core.$loose>, z.ZodObject<{
725
794
  bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
726
795
  mime: z.ZodString;
727
796
  label: z.ZodOptional<z.ZodString>;
797
+ durationSeconds: z.ZodOptional<z.ZodNumber>;
728
798
  }, z.core.$loose>]>>>;
729
799
  resolution: z.ZodOptional<z.ZodEnum<{
730
800
  "360p": "360p";
@@ -936,6 +1006,12 @@ interface ResolveResult<T> {
936
1006
  }
937
1007
  /** Nearest supported ratio in the same orientation bucket, else nearest overall, by log distance. */
938
1008
  declare function nearestAspectRatio(requested: AspectRatio, supported: AspectRatio[]): AspectRatio;
1009
+ /** First length violation for the videos a request sends, as a user-facing message. */
1010
+ declare function videoLengthViolation(model: CatalogModel, input: {
1011
+ referenceVideos?: (number | undefined)[];
1012
+ sourceVideo?: number;
1013
+ taskType?: VideoRequest["taskType"];
1014
+ }): string | undefined;
939
1015
  declare function resolveImageOptions(model: CatalogModel, request: ImageRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest>;
940
1016
  declare function resolveVideoOptions(model: CatalogModel, request: VideoRequest, onUnsupported?: OnUnsupported): ResolveResult<VideoRequest>;
941
1017
  declare function resolveAudioOptions(model: CatalogModel, request: AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<AudioRequest>;
@@ -1143,4 +1219,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
1143
1219
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
1144
1220
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
1145
1221
 
1146
- export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, withRetry, xaiVideoAdapter };
1222
+ export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, withRetry, xaiVideoAdapter };