@shop-os/modelkit 0.2.13 → 0.2.15
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/CHANGELOG.md +16 -0
- package/README.md +31 -2
- package/dist/catalog.cjs +124 -13
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +59 -1
- package/dist/catalog.d.ts +59 -1
- package/dist/catalog.js +124 -13
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +497 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +496 -176
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 {
|
|
@@ -160,6 +164,16 @@ interface MediaPart {
|
|
|
160
164
|
}
|
|
161
165
|
type RequiredInput = "firstFrame" | "sourceVideo" | "references";
|
|
162
166
|
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
|
|
167
|
+
interface VideoSecondsLimits {
|
|
168
|
+
/** Minimum length of each reference video, in seconds. */
|
|
169
|
+
min?: number;
|
|
170
|
+
/** Maximum length of each reference video, in seconds. */
|
|
171
|
+
max?: number;
|
|
172
|
+
/** Maximum combined length of the reference videos, in seconds. */
|
|
173
|
+
total?: number;
|
|
174
|
+
/** Higher per-video minimum when `taskType` is `edit` (Seedance 2.5: 4 s). */
|
|
175
|
+
editMin?: number;
|
|
176
|
+
}
|
|
163
177
|
interface ReferenceLimits {
|
|
164
178
|
images?: number;
|
|
165
179
|
/** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
|
|
@@ -169,6 +183,8 @@ interface ReferenceLimits {
|
|
|
169
183
|
total?: number;
|
|
170
184
|
/** Provider rejects a request whose only references are audio. */
|
|
171
185
|
audioOnly?: boolean;
|
|
186
|
+
/** Per-video length caps (min/max each) and combined total for reference videos. */
|
|
187
|
+
videoSeconds?: VideoSecondsLimits;
|
|
172
188
|
}
|
|
173
189
|
interface ModelConstraints {
|
|
174
190
|
aspectRatios?: AspectRatio[];
|
|
@@ -192,6 +208,11 @@ interface ModelConstraints {
|
|
|
192
208
|
supports?: SupportedOption[];
|
|
193
209
|
/** Ratio is dropped, with a warning, when one of these inputs is present. */
|
|
194
210
|
ratioIgnoredWith?: ("firstFrame" | "sourceVideo")[];
|
|
211
|
+
/** Length limits for the source video the row edits or extends. */
|
|
212
|
+
sourceVideoSeconds?: Omit<VideoSecondsLimits, "total"> & {
|
|
213
|
+
/** The provider sends the source as a reference video, so it counts toward `references.videoSeconds.total` (Seedance). */
|
|
214
|
+
inReferenceTotal?: boolean;
|
|
215
|
+
};
|
|
195
216
|
}
|
|
196
217
|
/** JSON-compatible value. Provider options and raw payloads carry these, never `unknown`. */
|
|
197
218
|
type JsonPrimitive = string | number | boolean | null;
|
|
@@ -432,6 +453,11 @@ interface CallContext {
|
|
|
432
453
|
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. */
|
|
433
454
|
tier?: "pro" | "enterprise";
|
|
434
455
|
signal?: AbortSignal;
|
|
456
|
+
/** Media retries after the initial request. Set 0 when a durable host owns recovery.
|
|
457
|
+
* Unset preserves adapter defaults. Successful pending-job polls are not retries.
|
|
458
|
+
* Text methods use the AI SDK options.maxRetries instead.
|
|
459
|
+
*/
|
|
460
|
+
maxRetries?: number;
|
|
435
461
|
onUnsupported?: "error" | "coerce";
|
|
436
462
|
}
|
|
437
463
|
|
|
@@ -584,6 +610,12 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
584
610
|
audios: z.ZodOptional<z.ZodNumber>;
|
|
585
611
|
total: z.ZodOptional<z.ZodNumber>;
|
|
586
612
|
audioOnly: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
+
videoSeconds: z.ZodOptional<z.ZodObject<{
|
|
614
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
615
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
616
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
617
|
+
editMin: z.ZodOptional<z.ZodNumber>;
|
|
618
|
+
}, z.core.$loose>>;
|
|
587
619
|
}, z.core.$loose>>;
|
|
588
620
|
requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
589
621
|
references: "references";
|
|
@@ -613,15 +645,23 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
613
645
|
firstFrame: "firstFrame";
|
|
614
646
|
sourceVideo: "sourceVideo";
|
|
615
647
|
}>>>;
|
|
648
|
+
sourceVideoSeconds: z.ZodOptional<z.ZodObject<{
|
|
649
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
650
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
editMin: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
inReferenceTotal: z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
}, z.core.$loose>>;
|
|
616
654
|
}, z.core.$loose>;
|
|
617
655
|
defaults: z.ZodObject<{
|
|
618
656
|
references: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
619
657
|
url: z.ZodString;
|
|
620
658
|
label: z.ZodOptional<z.ZodString>;
|
|
659
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
621
660
|
}, z.core.$loose>, z.ZodObject<{
|
|
622
661
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
623
662
|
mime: z.ZodString;
|
|
624
663
|
label: z.ZodOptional<z.ZodString>;
|
|
664
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
625
665
|
}, z.core.$loose>]>>>;
|
|
626
666
|
aspectRatio: z.ZodOptional<z.ZodEnum<{
|
|
627
667
|
"1:1": "1:1";
|
|
@@ -676,50 +716,62 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
676
716
|
firstFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
677
717
|
url: z.ZodString;
|
|
678
718
|
label: z.ZodOptional<z.ZodString>;
|
|
719
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
679
720
|
}, z.core.$loose>, z.ZodObject<{
|
|
680
721
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
681
722
|
mime: z.ZodString;
|
|
682
723
|
label: z.ZodOptional<z.ZodString>;
|
|
724
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
683
725
|
}, z.core.$loose>]>>;
|
|
684
726
|
lastFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
685
727
|
url: z.ZodString;
|
|
686
728
|
label: z.ZodOptional<z.ZodString>;
|
|
729
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
687
730
|
}, z.core.$loose>, z.ZodObject<{
|
|
688
731
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
689
732
|
mime: z.ZodString;
|
|
690
733
|
label: z.ZodOptional<z.ZodString>;
|
|
734
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
691
735
|
}, z.core.$loose>]>>;
|
|
692
736
|
sourceVideo: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
693
737
|
url: z.ZodString;
|
|
694
738
|
label: z.ZodOptional<z.ZodString>;
|
|
739
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
695
740
|
}, z.core.$loose>, z.ZodObject<{
|
|
696
741
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
697
742
|
mime: z.ZodString;
|
|
698
743
|
label: z.ZodOptional<z.ZodString>;
|
|
744
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
699
745
|
}, z.core.$loose>]>>;
|
|
700
746
|
referenceImages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
701
747
|
url: z.ZodString;
|
|
702
748
|
label: z.ZodOptional<z.ZodString>;
|
|
749
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
703
750
|
}, z.core.$loose>, z.ZodObject<{
|
|
704
751
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
705
752
|
mime: z.ZodString;
|
|
706
753
|
label: z.ZodOptional<z.ZodString>;
|
|
754
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
707
755
|
}, z.core.$loose>]>>>;
|
|
708
756
|
referenceVideos: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
709
757
|
url: z.ZodString;
|
|
710
758
|
label: z.ZodOptional<z.ZodString>;
|
|
759
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
711
760
|
}, z.core.$loose>, z.ZodObject<{
|
|
712
761
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
713
762
|
mime: z.ZodString;
|
|
714
763
|
label: z.ZodOptional<z.ZodString>;
|
|
764
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
715
765
|
}, z.core.$loose>]>>>;
|
|
716
766
|
referenceAudios: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
717
767
|
url: z.ZodString;
|
|
718
768
|
label: z.ZodOptional<z.ZodString>;
|
|
769
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
719
770
|
}, z.core.$loose>, z.ZodObject<{
|
|
720
771
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
721
772
|
mime: z.ZodString;
|
|
722
773
|
label: z.ZodOptional<z.ZodString>;
|
|
774
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
723
775
|
}, z.core.$loose>]>>>;
|
|
724
776
|
resolution: z.ZodOptional<z.ZodEnum<{
|
|
725
777
|
"360p": "360p";
|
|
@@ -931,6 +983,12 @@ interface ResolveResult<T> {
|
|
|
931
983
|
}
|
|
932
984
|
/** Nearest supported ratio in the same orientation bucket, else nearest overall, by log distance. */
|
|
933
985
|
declare function nearestAspectRatio(requested: AspectRatio, supported: AspectRatio[]): AspectRatio;
|
|
986
|
+
/** First length violation for the videos a request sends, as a user-facing message. */
|
|
987
|
+
declare function videoLengthViolation(model: CatalogModel, input: {
|
|
988
|
+
referenceVideos?: (number | undefined)[];
|
|
989
|
+
sourceVideo?: number;
|
|
990
|
+
taskType?: VideoRequest["taskType"];
|
|
991
|
+
}): string | undefined;
|
|
934
992
|
declare function resolveImageOptions(model: CatalogModel, request: ImageRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest>;
|
|
935
993
|
declare function resolveVideoOptions(model: CatalogModel, request: VideoRequest, onUnsupported?: OnUnsupported): ResolveResult<VideoRequest>;
|
|
936
994
|
declare function resolveAudioOptions(model: CatalogModel, request: AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<AudioRequest>;
|
|
@@ -1138,4 +1196,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
1138
1196
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
1139
1197
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
1140
1198
|
|
|
1141
|
-
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 };
|
|
1199
|
+
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 {
|
|
@@ -160,6 +164,16 @@ interface MediaPart {
|
|
|
160
164
|
}
|
|
161
165
|
type RequiredInput = "firstFrame" | "sourceVideo" | "references";
|
|
162
166
|
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
|
|
167
|
+
interface VideoSecondsLimits {
|
|
168
|
+
/** Minimum length of each reference video, in seconds. */
|
|
169
|
+
min?: number;
|
|
170
|
+
/** Maximum length of each reference video, in seconds. */
|
|
171
|
+
max?: number;
|
|
172
|
+
/** Maximum combined length of the reference videos, in seconds. */
|
|
173
|
+
total?: number;
|
|
174
|
+
/** Higher per-video minimum when `taskType` is `edit` (Seedance 2.5: 4 s). */
|
|
175
|
+
editMin?: number;
|
|
176
|
+
}
|
|
163
177
|
interface ReferenceLimits {
|
|
164
178
|
images?: number;
|
|
165
179
|
/** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
|
|
@@ -169,6 +183,8 @@ interface ReferenceLimits {
|
|
|
169
183
|
total?: number;
|
|
170
184
|
/** Provider rejects a request whose only references are audio. */
|
|
171
185
|
audioOnly?: boolean;
|
|
186
|
+
/** Per-video length caps (min/max each) and combined total for reference videos. */
|
|
187
|
+
videoSeconds?: VideoSecondsLimits;
|
|
172
188
|
}
|
|
173
189
|
interface ModelConstraints {
|
|
174
190
|
aspectRatios?: AspectRatio[];
|
|
@@ -192,6 +208,11 @@ interface ModelConstraints {
|
|
|
192
208
|
supports?: SupportedOption[];
|
|
193
209
|
/** Ratio is dropped, with a warning, when one of these inputs is present. */
|
|
194
210
|
ratioIgnoredWith?: ("firstFrame" | "sourceVideo")[];
|
|
211
|
+
/** Length limits for the source video the row edits or extends. */
|
|
212
|
+
sourceVideoSeconds?: Omit<VideoSecondsLimits, "total"> & {
|
|
213
|
+
/** The provider sends the source as a reference video, so it counts toward `references.videoSeconds.total` (Seedance). */
|
|
214
|
+
inReferenceTotal?: boolean;
|
|
215
|
+
};
|
|
195
216
|
}
|
|
196
217
|
/** JSON-compatible value. Provider options and raw payloads carry these, never `unknown`. */
|
|
197
218
|
type JsonPrimitive = string | number | boolean | null;
|
|
@@ -432,6 +453,11 @@ interface CallContext {
|
|
|
432
453
|
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. */
|
|
433
454
|
tier?: "pro" | "enterprise";
|
|
434
455
|
signal?: AbortSignal;
|
|
456
|
+
/** Media retries after the initial request. Set 0 when a durable host owns recovery.
|
|
457
|
+
* Unset preserves adapter defaults. Successful pending-job polls are not retries.
|
|
458
|
+
* Text methods use the AI SDK options.maxRetries instead.
|
|
459
|
+
*/
|
|
460
|
+
maxRetries?: number;
|
|
435
461
|
onUnsupported?: "error" | "coerce";
|
|
436
462
|
}
|
|
437
463
|
|
|
@@ -584,6 +610,12 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
584
610
|
audios: z.ZodOptional<z.ZodNumber>;
|
|
585
611
|
total: z.ZodOptional<z.ZodNumber>;
|
|
586
612
|
audioOnly: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
+
videoSeconds: z.ZodOptional<z.ZodObject<{
|
|
614
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
615
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
616
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
617
|
+
editMin: z.ZodOptional<z.ZodNumber>;
|
|
618
|
+
}, z.core.$loose>>;
|
|
587
619
|
}, z.core.$loose>>;
|
|
588
620
|
requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
589
621
|
references: "references";
|
|
@@ -613,15 +645,23 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
613
645
|
firstFrame: "firstFrame";
|
|
614
646
|
sourceVideo: "sourceVideo";
|
|
615
647
|
}>>>;
|
|
648
|
+
sourceVideoSeconds: z.ZodOptional<z.ZodObject<{
|
|
649
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
650
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
editMin: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
inReferenceTotal: z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
}, z.core.$loose>>;
|
|
616
654
|
}, z.core.$loose>;
|
|
617
655
|
defaults: z.ZodObject<{
|
|
618
656
|
references: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
619
657
|
url: z.ZodString;
|
|
620
658
|
label: z.ZodOptional<z.ZodString>;
|
|
659
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
621
660
|
}, z.core.$loose>, z.ZodObject<{
|
|
622
661
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
623
662
|
mime: z.ZodString;
|
|
624
663
|
label: z.ZodOptional<z.ZodString>;
|
|
664
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
625
665
|
}, z.core.$loose>]>>>;
|
|
626
666
|
aspectRatio: z.ZodOptional<z.ZodEnum<{
|
|
627
667
|
"1:1": "1:1";
|
|
@@ -676,50 +716,62 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
676
716
|
firstFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
677
717
|
url: z.ZodString;
|
|
678
718
|
label: z.ZodOptional<z.ZodString>;
|
|
719
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
679
720
|
}, z.core.$loose>, z.ZodObject<{
|
|
680
721
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
681
722
|
mime: z.ZodString;
|
|
682
723
|
label: z.ZodOptional<z.ZodString>;
|
|
724
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
683
725
|
}, z.core.$loose>]>>;
|
|
684
726
|
lastFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
685
727
|
url: z.ZodString;
|
|
686
728
|
label: z.ZodOptional<z.ZodString>;
|
|
729
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
687
730
|
}, z.core.$loose>, z.ZodObject<{
|
|
688
731
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
689
732
|
mime: z.ZodString;
|
|
690
733
|
label: z.ZodOptional<z.ZodString>;
|
|
734
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
691
735
|
}, z.core.$loose>]>>;
|
|
692
736
|
sourceVideo: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
693
737
|
url: z.ZodString;
|
|
694
738
|
label: z.ZodOptional<z.ZodString>;
|
|
739
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
695
740
|
}, z.core.$loose>, z.ZodObject<{
|
|
696
741
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
697
742
|
mime: z.ZodString;
|
|
698
743
|
label: z.ZodOptional<z.ZodString>;
|
|
744
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
699
745
|
}, z.core.$loose>]>>;
|
|
700
746
|
referenceImages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
701
747
|
url: z.ZodString;
|
|
702
748
|
label: z.ZodOptional<z.ZodString>;
|
|
749
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
703
750
|
}, z.core.$loose>, z.ZodObject<{
|
|
704
751
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
705
752
|
mime: z.ZodString;
|
|
706
753
|
label: z.ZodOptional<z.ZodString>;
|
|
754
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
707
755
|
}, z.core.$loose>]>>>;
|
|
708
756
|
referenceVideos: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
709
757
|
url: z.ZodString;
|
|
710
758
|
label: z.ZodOptional<z.ZodString>;
|
|
759
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
711
760
|
}, z.core.$loose>, z.ZodObject<{
|
|
712
761
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
713
762
|
mime: z.ZodString;
|
|
714
763
|
label: z.ZodOptional<z.ZodString>;
|
|
764
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
715
765
|
}, z.core.$loose>]>>>;
|
|
716
766
|
referenceAudios: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
717
767
|
url: z.ZodString;
|
|
718
768
|
label: z.ZodOptional<z.ZodString>;
|
|
769
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
719
770
|
}, z.core.$loose>, z.ZodObject<{
|
|
720
771
|
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
721
772
|
mime: z.ZodString;
|
|
722
773
|
label: z.ZodOptional<z.ZodString>;
|
|
774
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
723
775
|
}, z.core.$loose>]>>>;
|
|
724
776
|
resolution: z.ZodOptional<z.ZodEnum<{
|
|
725
777
|
"360p": "360p";
|
|
@@ -931,6 +983,12 @@ interface ResolveResult<T> {
|
|
|
931
983
|
}
|
|
932
984
|
/** Nearest supported ratio in the same orientation bucket, else nearest overall, by log distance. */
|
|
933
985
|
declare function nearestAspectRatio(requested: AspectRatio, supported: AspectRatio[]): AspectRatio;
|
|
986
|
+
/** First length violation for the videos a request sends, as a user-facing message. */
|
|
987
|
+
declare function videoLengthViolation(model: CatalogModel, input: {
|
|
988
|
+
referenceVideos?: (number | undefined)[];
|
|
989
|
+
sourceVideo?: number;
|
|
990
|
+
taskType?: VideoRequest["taskType"];
|
|
991
|
+
}): string | undefined;
|
|
934
992
|
declare function resolveImageOptions(model: CatalogModel, request: ImageRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest>;
|
|
935
993
|
declare function resolveVideoOptions(model: CatalogModel, request: VideoRequest, onUnsupported?: OnUnsupported): ResolveResult<VideoRequest>;
|
|
936
994
|
declare function resolveAudioOptions(model: CatalogModel, request: AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<AudioRequest>;
|
|
@@ -1138,4 +1196,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
1138
1196
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
1139
1197
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
1140
1198
|
|
|
1141
|
-
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 };
|
|
1199
|
+
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 };
|