@shop-os/modelkit 0.17.0 → 0.18.0
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 +21 -0
- package/dist/catalog.cjs +271 -13
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +78 -3
- package/dist/catalog.d.ts +78 -3
- package/dist/catalog.js +271 -13
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +350 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -3
- package/dist/index.d.ts +86 -3
- package/dist/index.js +348 -62
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.d.cts
CHANGED
|
@@ -13,7 +13,38 @@ type ImageSize = "512" | "1K" | "2K" | "4K";
|
|
|
13
13
|
type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
|
|
14
14
|
/** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
|
|
15
15
|
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* "gif" (animated) and "svg" (vector) are GPT Image 2.6 formats: a row offers them only by
|
|
18
|
+
* listing them in `constraints.imageFormats`, and the resolver refuses them anywhere else.
|
|
19
|
+
*/
|
|
20
|
+
type OutputFormat = "png" | "jpeg" | "webp" | "gif" | "svg";
|
|
21
|
+
/** The image's background where the provider lets the caller choose (OpenAI `background`). */
|
|
22
|
+
type ImageBackground = "auto" | "opaque" | "transparent";
|
|
23
|
+
/** An animated (`outputFormat: "gif"`) request's frames. The frame size travels as `exactSize`. */
|
|
24
|
+
interface ImageAnimation {
|
|
25
|
+
/** Frames in the loop; the row's default when unset. */
|
|
26
|
+
frameCount?: number;
|
|
27
|
+
/** How long each frame shows, in milliseconds; the row's default when unset. */
|
|
28
|
+
frameDurationMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/** One frame size an animated row offers, with the frame counts the provider takes at it. */
|
|
31
|
+
interface AnimationFrameSize {
|
|
32
|
+
/** `WxH`, sent as the request's `exactSize`. */
|
|
33
|
+
size: string;
|
|
34
|
+
minFrames: number;
|
|
35
|
+
maxFrames: number;
|
|
36
|
+
}
|
|
37
|
+
/** What an animated output (`imageFormats` lists "gif") takes. Kits before 0.18.0 ignore it. */
|
|
38
|
+
interface AnimationLimits {
|
|
39
|
+
/** The frame sizes offered, first is the default. */
|
|
40
|
+
frameSizes: AnimationFrameSize[];
|
|
41
|
+
frameDurationMs: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
defaultFrameCount: number;
|
|
46
|
+
defaultFrameDurationMs: number;
|
|
47
|
+
}
|
|
17
48
|
/**
|
|
18
49
|
* A media input. `label` is a caption the adapter emits as a text part right
|
|
19
50
|
* before the media where the provider takes interleaved content (Gemini image,
|
|
@@ -154,6 +185,10 @@ interface ImageRequest {
|
|
|
154
185
|
seed?: number;
|
|
155
186
|
count?: number;
|
|
156
187
|
outputFormat?: OutputFormat;
|
|
188
|
+
/** Rows whose `constraints.backgrounds` lists the value. */
|
|
189
|
+
background?: ImageBackground;
|
|
190
|
+
/** `outputFormat: "gif"` on rows with `constraints.animation`. */
|
|
191
|
+
animation?: ImageAnimation;
|
|
157
192
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
158
193
|
scaleFactor?: number;
|
|
159
194
|
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
@@ -755,6 +790,18 @@ interface ModelConstraints {
|
|
|
755
790
|
languages?: LanguageOption[];
|
|
756
791
|
/** Audio-output rows whose provider lets the caller pick a file format; `defaults.outputFormat` is one. */
|
|
757
792
|
outputFormats?: string[];
|
|
793
|
+
/**
|
|
794
|
+
* Image rows: the output formats offered, first is the default; needs `supports: outputFormat`.
|
|
795
|
+
* Without it an image row takes png, jpeg and webp; "gif" and "svg" are offered only here.
|
|
796
|
+
* Kits before 0.18.0 ignore it.
|
|
797
|
+
*/
|
|
798
|
+
imageFormats?: OutputFormat[];
|
|
799
|
+
/** Image rows: the backgrounds the caller may pick (`ImageRequest.background`). Kits before 0.18.0 ignore it. */
|
|
800
|
+
backgrounds?: ImageBackground[];
|
|
801
|
+
/** Image rows that list "gif" in `imageFormats`: frame sizes, counts and durations. */
|
|
802
|
+
animation?: AnimationLimits;
|
|
803
|
+
/** Image rows that list "svg": the text model that writes the SVG from the image (OpenAI `svg.model`). */
|
|
804
|
+
svgModel?: string;
|
|
758
805
|
/** Smallest frame the source video may have (Kling 4.0 Edit: 700 px). Kits before 0.15.0 ignore it. */
|
|
759
806
|
sourceVideoPixels?: VideoPixelLimits;
|
|
760
807
|
/** Length limits for the source video the row edits or extends. */
|
|
@@ -856,7 +903,7 @@ interface CatalogCapabilities {
|
|
|
856
903
|
}
|
|
857
904
|
/** Row defaults the request types do not share. */
|
|
858
905
|
interface MediaNodeDefaults {
|
|
859
|
-
/** Image rows:
|
|
906
|
+
/** Image rows: an `OutputFormat`. Audio-output rows: one of `constraints.outputFormats`. */
|
|
860
907
|
outputFormat?: string;
|
|
861
908
|
/** One of `constraints.voices[].id`. */
|
|
862
909
|
voice?: string;
|
|
@@ -1337,6 +1384,32 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1337
1384
|
name: z.ZodString;
|
|
1338
1385
|
}, z.core.$loose>>>;
|
|
1339
1386
|
outputFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1387
|
+
imageFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1388
|
+
png: "png";
|
|
1389
|
+
jpeg: "jpeg";
|
|
1390
|
+
webp: "webp";
|
|
1391
|
+
gif: "gif";
|
|
1392
|
+
svg: "svg";
|
|
1393
|
+
}>>>;
|
|
1394
|
+
backgrounds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1395
|
+
auto: "auto";
|
|
1396
|
+
opaque: "opaque";
|
|
1397
|
+
transparent: "transparent";
|
|
1398
|
+
}>>>;
|
|
1399
|
+
animation: z.ZodOptional<z.ZodObject<{
|
|
1400
|
+
frameSizes: z.ZodArray<z.ZodObject<{
|
|
1401
|
+
size: z.ZodString;
|
|
1402
|
+
minFrames: z.ZodNumber;
|
|
1403
|
+
maxFrames: z.ZodNumber;
|
|
1404
|
+
}, z.core.$loose>>;
|
|
1405
|
+
frameDurationMs: z.ZodObject<{
|
|
1406
|
+
min: z.ZodNumber;
|
|
1407
|
+
max: z.ZodNumber;
|
|
1408
|
+
}, z.core.$loose>;
|
|
1409
|
+
defaultFrameCount: z.ZodNumber;
|
|
1410
|
+
defaultFrameDurationMs: z.ZodNumber;
|
|
1411
|
+
}, z.core.$loose>>;
|
|
1412
|
+
svgModel: z.ZodOptional<z.ZodString>;
|
|
1340
1413
|
sourceVideoPixels: z.ZodOptional<z.ZodObject<{
|
|
1341
1414
|
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
1342
1415
|
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1482,6 +1555,8 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1482
1555
|
png: "png";
|
|
1483
1556
|
jpeg: "jpeg";
|
|
1484
1557
|
webp: "webp";
|
|
1558
|
+
gif: "gif";
|
|
1559
|
+
svg: "svg";
|
|
1485
1560
|
}>, z.ZodString]>>;
|
|
1486
1561
|
scaleFactor: z.ZodOptional<z.ZodNumber>;
|
|
1487
1562
|
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1996,4 +2071,4 @@ declare function promptConventions(row: {
|
|
|
1996
2071
|
constraints: unknown;
|
|
1997
2072
|
}): PromptConventions;
|
|
1998
2073
|
|
|
1999
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, 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 DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
|
2074
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AnimationFrameSize, type AnimationLimits, type AspectRatio, type AudioOutput, 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 DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageAnimation, type ImageBackground, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -13,7 +13,38 @@ type ImageSize = "512" | "1K" | "2K" | "4K";
|
|
|
13
13
|
type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
|
|
14
14
|
/** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
|
|
15
15
|
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* "gif" (animated) and "svg" (vector) are GPT Image 2.6 formats: a row offers them only by
|
|
18
|
+
* listing them in `constraints.imageFormats`, and the resolver refuses them anywhere else.
|
|
19
|
+
*/
|
|
20
|
+
type OutputFormat = "png" | "jpeg" | "webp" | "gif" | "svg";
|
|
21
|
+
/** The image's background where the provider lets the caller choose (OpenAI `background`). */
|
|
22
|
+
type ImageBackground = "auto" | "opaque" | "transparent";
|
|
23
|
+
/** An animated (`outputFormat: "gif"`) request's frames. The frame size travels as `exactSize`. */
|
|
24
|
+
interface ImageAnimation {
|
|
25
|
+
/** Frames in the loop; the row's default when unset. */
|
|
26
|
+
frameCount?: number;
|
|
27
|
+
/** How long each frame shows, in milliseconds; the row's default when unset. */
|
|
28
|
+
frameDurationMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/** One frame size an animated row offers, with the frame counts the provider takes at it. */
|
|
31
|
+
interface AnimationFrameSize {
|
|
32
|
+
/** `WxH`, sent as the request's `exactSize`. */
|
|
33
|
+
size: string;
|
|
34
|
+
minFrames: number;
|
|
35
|
+
maxFrames: number;
|
|
36
|
+
}
|
|
37
|
+
/** What an animated output (`imageFormats` lists "gif") takes. Kits before 0.18.0 ignore it. */
|
|
38
|
+
interface AnimationLimits {
|
|
39
|
+
/** The frame sizes offered, first is the default. */
|
|
40
|
+
frameSizes: AnimationFrameSize[];
|
|
41
|
+
frameDurationMs: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
defaultFrameCount: number;
|
|
46
|
+
defaultFrameDurationMs: number;
|
|
47
|
+
}
|
|
17
48
|
/**
|
|
18
49
|
* A media input. `label` is a caption the adapter emits as a text part right
|
|
19
50
|
* before the media where the provider takes interleaved content (Gemini image,
|
|
@@ -154,6 +185,10 @@ interface ImageRequest {
|
|
|
154
185
|
seed?: number;
|
|
155
186
|
count?: number;
|
|
156
187
|
outputFormat?: OutputFormat;
|
|
188
|
+
/** Rows whose `constraints.backgrounds` lists the value. */
|
|
189
|
+
background?: ImageBackground;
|
|
190
|
+
/** `outputFormat: "gif"` on rows with `constraints.animation`. */
|
|
191
|
+
animation?: ImageAnimation;
|
|
157
192
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
158
193
|
scaleFactor?: number;
|
|
159
194
|
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
@@ -755,6 +790,18 @@ interface ModelConstraints {
|
|
|
755
790
|
languages?: LanguageOption[];
|
|
756
791
|
/** Audio-output rows whose provider lets the caller pick a file format; `defaults.outputFormat` is one. */
|
|
757
792
|
outputFormats?: string[];
|
|
793
|
+
/**
|
|
794
|
+
* Image rows: the output formats offered, first is the default; needs `supports: outputFormat`.
|
|
795
|
+
* Without it an image row takes png, jpeg and webp; "gif" and "svg" are offered only here.
|
|
796
|
+
* Kits before 0.18.0 ignore it.
|
|
797
|
+
*/
|
|
798
|
+
imageFormats?: OutputFormat[];
|
|
799
|
+
/** Image rows: the backgrounds the caller may pick (`ImageRequest.background`). Kits before 0.18.0 ignore it. */
|
|
800
|
+
backgrounds?: ImageBackground[];
|
|
801
|
+
/** Image rows that list "gif" in `imageFormats`: frame sizes, counts and durations. */
|
|
802
|
+
animation?: AnimationLimits;
|
|
803
|
+
/** Image rows that list "svg": the text model that writes the SVG from the image (OpenAI `svg.model`). */
|
|
804
|
+
svgModel?: string;
|
|
758
805
|
/** Smallest frame the source video may have (Kling 4.0 Edit: 700 px). Kits before 0.15.0 ignore it. */
|
|
759
806
|
sourceVideoPixels?: VideoPixelLimits;
|
|
760
807
|
/** Length limits for the source video the row edits or extends. */
|
|
@@ -856,7 +903,7 @@ interface CatalogCapabilities {
|
|
|
856
903
|
}
|
|
857
904
|
/** Row defaults the request types do not share. */
|
|
858
905
|
interface MediaNodeDefaults {
|
|
859
|
-
/** Image rows:
|
|
906
|
+
/** Image rows: an `OutputFormat`. Audio-output rows: one of `constraints.outputFormats`. */
|
|
860
907
|
outputFormat?: string;
|
|
861
908
|
/** One of `constraints.voices[].id`. */
|
|
862
909
|
voice?: string;
|
|
@@ -1337,6 +1384,32 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1337
1384
|
name: z.ZodString;
|
|
1338
1385
|
}, z.core.$loose>>>;
|
|
1339
1386
|
outputFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1387
|
+
imageFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1388
|
+
png: "png";
|
|
1389
|
+
jpeg: "jpeg";
|
|
1390
|
+
webp: "webp";
|
|
1391
|
+
gif: "gif";
|
|
1392
|
+
svg: "svg";
|
|
1393
|
+
}>>>;
|
|
1394
|
+
backgrounds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1395
|
+
auto: "auto";
|
|
1396
|
+
opaque: "opaque";
|
|
1397
|
+
transparent: "transparent";
|
|
1398
|
+
}>>>;
|
|
1399
|
+
animation: z.ZodOptional<z.ZodObject<{
|
|
1400
|
+
frameSizes: z.ZodArray<z.ZodObject<{
|
|
1401
|
+
size: z.ZodString;
|
|
1402
|
+
minFrames: z.ZodNumber;
|
|
1403
|
+
maxFrames: z.ZodNumber;
|
|
1404
|
+
}, z.core.$loose>>;
|
|
1405
|
+
frameDurationMs: z.ZodObject<{
|
|
1406
|
+
min: z.ZodNumber;
|
|
1407
|
+
max: z.ZodNumber;
|
|
1408
|
+
}, z.core.$loose>;
|
|
1409
|
+
defaultFrameCount: z.ZodNumber;
|
|
1410
|
+
defaultFrameDurationMs: z.ZodNumber;
|
|
1411
|
+
}, z.core.$loose>>;
|
|
1412
|
+
svgModel: z.ZodOptional<z.ZodString>;
|
|
1340
1413
|
sourceVideoPixels: z.ZodOptional<z.ZodObject<{
|
|
1341
1414
|
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
1342
1415
|
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1482,6 +1555,8 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1482
1555
|
png: "png";
|
|
1483
1556
|
jpeg: "jpeg";
|
|
1484
1557
|
webp: "webp";
|
|
1558
|
+
gif: "gif";
|
|
1559
|
+
svg: "svg";
|
|
1485
1560
|
}>, z.ZodString]>>;
|
|
1486
1561
|
scaleFactor: z.ZodOptional<z.ZodNumber>;
|
|
1487
1562
|
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1996,4 +2071,4 @@ declare function promptConventions(row: {
|
|
|
1996
2071
|
constraints: unknown;
|
|
1997
2072
|
}): PromptConventions;
|
|
1998
2073
|
|
|
1999
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, 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 DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
|
2074
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AnimationFrameSize, type AnimationLimits, type AspectRatio, type AudioOutput, 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 DubbingRequest, type DubbingResult, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageAnimation, type ImageBackground, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeySource, type KeyTier, type LanguageOption, type Lifecycle, type LipsyncRequest, type LipsyncResult, type LiveCatalogState, MEDIA_METHODS, MEDIA_NODE_MODELS, MODEL3D_IMAGE_SLOTS, MODEL3D_MODELS, MODELS, type MaskBox, type MaskPoint, type MediaMethod, type MediaNodeDefaults, type MediaOutput, type MediaPart, type MediaRef, type Model3dConstraints, type Model3dEndpoints, type Model3dFamily, type Model3dInputRefusal, type Model3dPricedInputs, type Model3dPricedOptions, type Model3dRequest, type Model3dResult, type Model3dStatus, type Model3dSubmission, type Model3dTexture, type Model3dViews, type Model3dWired, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveCall, type ResolveResult, type ResolvedCall, type Routing, SURFACES, type SpeechRequest, type SubtitleOptions, type SubtitleTextStyle, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type TranscriptWord, type TranscriptionRequest, type TranscriptionResult, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoPixelLimits, type VideoRequest, type VideoResolution, VideoResolutionSchema, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type VoiceCandidate, type VoiceChangeRequest, type VoiceCloneRequest, type VoiceCloneResult, type VoiceCloneState, type VoiceDeleteRequest, type VoiceDesignRequest, type VoiceDesignResult, type VoiceGender, type VoiceOption, type VoiceSample, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, lumaReframeTooTall, model3dConstraints, model3dInputRefusal, model3dPricingSku, model3dResolution, model3dSeedFits, model3dSkus, model3dTexture, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveDubbingOptions, resolveImageOptions, resolveLipsyncOptions, resolveOptions, resolveSpeechOptions, resolveTranscriptionOptions, resolveVideoOptions, resolveVoiceChangeOptions, resolveVoiceCloneOptions, resolveVoiceDesignOptions, sortCatalogRows, takesTargetAspectRatio, videoLengthViolation, videoSizeViolation, videoToolConstraints };
|
package/dist/catalog.js
CHANGED
|
@@ -439,6 +439,25 @@ var NANO_BANANA_2_1_RATIOS = [
|
|
|
439
439
|
"adaptive"
|
|
440
440
|
];
|
|
441
441
|
var GEMINI_PROMPT_MAX_CHARS = 5e4;
|
|
442
|
+
var GPT_IMAGE_2_6_ANIMATION = {
|
|
443
|
+
frameSizes: [
|
|
444
|
+
{ size: "288x288", minFrames: 2, maxFrames: 16 },
|
|
445
|
+
{ size: "384x384", minFrames: 2, maxFrames: 16 },
|
|
446
|
+
{ size: "512x288", minFrames: 2, maxFrames: 16 },
|
|
447
|
+
{ size: "288x512", minFrames: 2, maxFrames: 16 },
|
|
448
|
+
{ size: "512x512", minFrames: 2, maxFrames: 16 },
|
|
449
|
+
{ size: "768x768", minFrames: 2, maxFrames: 12 }
|
|
450
|
+
],
|
|
451
|
+
frameDurationMs: { min: 20, max: 2e3 },
|
|
452
|
+
defaultFrameCount: 9,
|
|
453
|
+
defaultFrameDurationMs: 200
|
|
454
|
+
};
|
|
455
|
+
var GPT_IMAGE_2_6_OUTPUT = {
|
|
456
|
+
imageFormats: ["png", "gif", "svg"],
|
|
457
|
+
backgrounds: ["auto", "opaque", "transparent"],
|
|
458
|
+
animation: GPT_IMAGE_2_6_ANIMATION,
|
|
459
|
+
svgModel: "gpt-6.1-sol"
|
|
460
|
+
};
|
|
442
461
|
var GPT_IMAGE_PROMPT = { referenceSyntax: "numbered", maxChars: 32e3 };
|
|
443
462
|
function geminiImage(id, label, aliases, sizes, display, exposure, references, promptMaxChars, aspectRatios = GEMINI_RATIOS) {
|
|
444
463
|
const prompt = { referenceSyntax: "caption" };
|
|
@@ -582,6 +601,78 @@ var IMAGE_MODELS = [
|
|
|
582
601
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/1204b494-8962-4f7f-af5e-699a8bdc98e3_compressed.png"
|
|
583
602
|
}
|
|
584
603
|
},
|
|
604
|
+
{
|
|
605
|
+
// Same Images API surface as gpt-image-2.5 (live-checked 2026-11-05; 2.6 also takes a `complexity` field the kit does not send).
|
|
606
|
+
id: "gpt-image-2.6-sunburst",
|
|
607
|
+
aliases: [],
|
|
608
|
+
label: "GPT Image 2.6 Sunburst",
|
|
609
|
+
type: "image",
|
|
610
|
+
adapter: "openai-image",
|
|
611
|
+
providerModelId: "gpt-image-2.6-sunburst",
|
|
612
|
+
lifecycle: "active",
|
|
613
|
+
exposure: ["cowork", "space_builder"],
|
|
614
|
+
constraints: {
|
|
615
|
+
exactSizes: {
|
|
616
|
+
"1:1": "1024x1024",
|
|
617
|
+
"3:2": "1536x1024",
|
|
618
|
+
"2:3": "1024x1536",
|
|
619
|
+
"16:9": "2048x1152",
|
|
620
|
+
"9:16": "1152x2048",
|
|
621
|
+
"4:5": "1024x1280",
|
|
622
|
+
"5:4": "1280x1024"
|
|
623
|
+
},
|
|
624
|
+
aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
|
|
625
|
+
sizes: ["1K", "2K", "4K"],
|
|
626
|
+
qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
627
|
+
references: { images: 16 },
|
|
628
|
+
supports: ["quality", "count", "outputFormat"],
|
|
629
|
+
prompt: GPT_IMAGE_PROMPT,
|
|
630
|
+
...GPT_IMAGE_2_6_OUTPUT
|
|
631
|
+
},
|
|
632
|
+
defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
|
|
633
|
+
usage: { ...IMAGE_USAGE3 },
|
|
634
|
+
pricingKind: "image_size",
|
|
635
|
+
display: {
|
|
636
|
+
provider: "openai",
|
|
637
|
+
description: "OpenAI's most detailed GPT Image 2.6 tier, built for intricate detail and editing precision; takes text and image input and outputs images in low, medium, high, xhigh, or max quality."
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
// Same Images API surface as gpt-image-2.5 (live-checked 2026-11-05; 2.6 also takes a `complexity` field the kit does not send).
|
|
642
|
+
id: "gpt-image-2.6-flare",
|
|
643
|
+
aliases: [],
|
|
644
|
+
label: "GPT Image 2.6 Flare",
|
|
645
|
+
type: "image",
|
|
646
|
+
adapter: "openai-image",
|
|
647
|
+
providerModelId: "gpt-image-2.6-flare",
|
|
648
|
+
lifecycle: "active",
|
|
649
|
+
exposure: ["cowork", "space_builder"],
|
|
650
|
+
constraints: {
|
|
651
|
+
exactSizes: {
|
|
652
|
+
"1:1": "1024x1024",
|
|
653
|
+
"3:2": "1536x1024",
|
|
654
|
+
"2:3": "1024x1536",
|
|
655
|
+
"16:9": "2048x1152",
|
|
656
|
+
"9:16": "1152x2048",
|
|
657
|
+
"4:5": "1024x1280",
|
|
658
|
+
"5:4": "1280x1024"
|
|
659
|
+
},
|
|
660
|
+
aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
|
|
661
|
+
sizes: ["1K", "2K", "4K"],
|
|
662
|
+
qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
663
|
+
references: { images: 16 },
|
|
664
|
+
supports: ["quality", "count", "outputFormat"],
|
|
665
|
+
prompt: GPT_IMAGE_PROMPT,
|
|
666
|
+
...GPT_IMAGE_2_6_OUTPUT
|
|
667
|
+
},
|
|
668
|
+
defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
|
|
669
|
+
usage: { ...IMAGE_USAGE3 },
|
|
670
|
+
pricingKind: "image_size",
|
|
671
|
+
display: {
|
|
672
|
+
provider: "openai",
|
|
673
|
+
description: "OpenAI's fast GPT Image 2.6 tier for everyday image generation and editing, with natural lighting, rich textures and complex layouts; takes text and image input and outputs images in low, medium, high, xhigh, or max quality."
|
|
674
|
+
}
|
|
675
|
+
},
|
|
585
676
|
{
|
|
586
677
|
// Same Images API surface as gpt-image-2 plus the "xhigh" and "max" quality tiers.
|
|
587
678
|
id: "gpt-image-2.5-sunburst",
|
|
@@ -7804,7 +7895,20 @@ var AspectRatioSchema = z3.enum([
|
|
|
7804
7895
|
var ImageSizeSchema = z3.enum(["512", "1K", "2K", "4K"]);
|
|
7805
7896
|
var VideoResolutionSchema = z3.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
|
|
7806
7897
|
var ImageQualitySchema = z3.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
|
|
7807
|
-
var OutputFormatSchema = z3.enum(["png", "jpeg", "webp"]);
|
|
7898
|
+
var OutputFormatSchema = z3.enum(["png", "jpeg", "webp", "gif", "svg"]);
|
|
7899
|
+
var ImageBackgroundSchema = z3.enum(["auto", "opaque", "transparent"]);
|
|
7900
|
+
var AnimationLimitsSchema = z3.looseObject({
|
|
7901
|
+
frameSizes: z3.array(
|
|
7902
|
+
z3.looseObject({
|
|
7903
|
+
size: z3.string().regex(/^\d+x\d+$/u),
|
|
7904
|
+
minFrames: z3.number().int().positive(),
|
|
7905
|
+
maxFrames: z3.number().int().positive()
|
|
7906
|
+
})
|
|
7907
|
+
).min(1),
|
|
7908
|
+
frameDurationMs: z3.looseObject({ min: z3.number().positive(), max: z3.number().positive() }),
|
|
7909
|
+
defaultFrameCount: z3.number().int().positive(),
|
|
7910
|
+
defaultFrameDurationMs: z3.number().positive()
|
|
7911
|
+
});
|
|
7808
7912
|
var RequiredInputSchema = z3.enum(["firstFrame", "sourceVideo", "references", "sourceAudio"]);
|
|
7809
7913
|
var SupportedOptionSchema = z3.enum([
|
|
7810
7914
|
"seed",
|
|
@@ -7958,6 +8062,10 @@ var ModelConstraintsSchema = z3.looseObject({
|
|
|
7958
8062
|
}).optional(),
|
|
7959
8063
|
languages: z3.array(LanguageOptionSchema).optional(),
|
|
7960
8064
|
outputFormats: z3.array(z3.string().min(1)).min(1).optional(),
|
|
8065
|
+
imageFormats: z3.array(OutputFormatSchema).min(1).optional(),
|
|
8066
|
+
backgrounds: z3.array(ImageBackgroundSchema).min(1).optional(),
|
|
8067
|
+
animation: AnimationLimitsSchema.optional(),
|
|
8068
|
+
svgModel: z3.string().min(1).optional(),
|
|
7961
8069
|
sourceVideoPixels: VideoPixelLimitsSchema.optional(),
|
|
7962
8070
|
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: z3.boolean().optional() }).optional(),
|
|
7963
8071
|
// segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
|
|
@@ -8717,6 +8825,155 @@ function shrinkToShortEdge(width, height, limit) {
|
|
|
8717
8825
|
return { width: Math.round(width * scale), height: Math.round(height * scale) };
|
|
8718
8826
|
}
|
|
8719
8827
|
|
|
8828
|
+
// src/resolve-image-output.ts
|
|
8829
|
+
var BASE_FORMATS = ["png", "jpeg", "webp"];
|
|
8830
|
+
var ONE_K_FRAME_PIXELS = 288 * 512;
|
|
8831
|
+
function imageOutputFormats(model) {
|
|
8832
|
+
return model.constraints.imageFormats ?? BASE_FORMATS;
|
|
8833
|
+
}
|
|
8834
|
+
function animationTier(model, frameSize) {
|
|
8835
|
+
const [w, h] = frameSize.split("x").map(Number);
|
|
8836
|
+
const tier = (w ?? 0) * (h ?? 0) <= ONE_K_FRAME_PIXELS ? "1K" : "2K";
|
|
8837
|
+
const offered = model.constraints.sizes ?? ["1K", "2K", "4K"];
|
|
8838
|
+
if (offered.includes(tier)) return tier;
|
|
8839
|
+
return offered[offered.length - 1] ?? tier;
|
|
8840
|
+
}
|
|
8841
|
+
function refuse(model, message) {
|
|
8842
|
+
throw new ModelKitError({ code: "unsupported_option", message, model: model.id });
|
|
8843
|
+
}
|
|
8844
|
+
function clamp(value, min, max) {
|
|
8845
|
+
return Math.min(Math.max(value, min), max);
|
|
8846
|
+
}
|
|
8847
|
+
function applyAnimation(model, req, onUnsupported, warnings) {
|
|
8848
|
+
const limits = model.constraints.animation;
|
|
8849
|
+
if (!limits) return;
|
|
8850
|
+
const sizes = limits.frameSizes;
|
|
8851
|
+
let frameSize = sizes.find((s) => s.size === req.exactSize);
|
|
8852
|
+
if (!frameSize) {
|
|
8853
|
+
const fallback = sizes[0];
|
|
8854
|
+
if (req.exactSize !== void 0) {
|
|
8855
|
+
if (onUnsupported === "error") {
|
|
8856
|
+
refuse(
|
|
8857
|
+
model,
|
|
8858
|
+
`${model.id} makes GIF frames at ${sizes.map((s) => s.size).join(", ")}; got ${req.exactSize}`
|
|
8859
|
+
);
|
|
8860
|
+
}
|
|
8861
|
+
warnings.push({
|
|
8862
|
+
code: "option_ignored",
|
|
8863
|
+
field: "exactSize",
|
|
8864
|
+
from: req.exactSize,
|
|
8865
|
+
to: fallback.size,
|
|
8866
|
+
message: `${model.id} has no ${req.exactSize} GIF frame; using ${fallback.size}`
|
|
8867
|
+
});
|
|
8868
|
+
}
|
|
8869
|
+
frameSize = fallback;
|
|
8870
|
+
}
|
|
8871
|
+
req.exactSize = frameSize.size;
|
|
8872
|
+
delete req.aspectRatio;
|
|
8873
|
+
const animation = { ...req.animation };
|
|
8874
|
+
const asked = animation.frameCount;
|
|
8875
|
+
const frames = asked ?? clamp(limits.defaultFrameCount, frameSize.minFrames, frameSize.maxFrames);
|
|
8876
|
+
if (frames < frameSize.minFrames || frames > frameSize.maxFrames || !Number.isInteger(frames)) {
|
|
8877
|
+
if (onUnsupported === "error") {
|
|
8878
|
+
refuse(
|
|
8879
|
+
model,
|
|
8880
|
+
`${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; got ${frames}`
|
|
8881
|
+
);
|
|
8882
|
+
}
|
|
8883
|
+
const snapped = clamp(Math.round(frames), frameSize.minFrames, frameSize.maxFrames);
|
|
8884
|
+
warnings.push({
|
|
8885
|
+
code: "option_ignored",
|
|
8886
|
+
field: "animation.frameCount",
|
|
8887
|
+
from: frames,
|
|
8888
|
+
to: snapped,
|
|
8889
|
+
message: `${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; using ${snapped}`
|
|
8890
|
+
});
|
|
8891
|
+
animation.frameCount = snapped;
|
|
8892
|
+
} else {
|
|
8893
|
+
animation.frameCount = frames;
|
|
8894
|
+
}
|
|
8895
|
+
const { min, max } = limits.frameDurationMs;
|
|
8896
|
+
const duration = animation.frameDurationMs ?? limits.defaultFrameDurationMs;
|
|
8897
|
+
if (duration < min || duration > max) {
|
|
8898
|
+
if (onUnsupported === "error") {
|
|
8899
|
+
refuse(model, `${model.id} shows each GIF frame ${min} to ${max} ms; got ${duration}`);
|
|
8900
|
+
}
|
|
8901
|
+
const snapped = clamp(duration, min, max);
|
|
8902
|
+
warnings.push({
|
|
8903
|
+
code: "option_ignored",
|
|
8904
|
+
field: "animation.frameDurationMs",
|
|
8905
|
+
from: duration,
|
|
8906
|
+
to: snapped,
|
|
8907
|
+
message: `${model.id} shows each GIF frame ${min} to ${max} ms; using ${snapped}`
|
|
8908
|
+
});
|
|
8909
|
+
animation.frameDurationMs = snapped;
|
|
8910
|
+
} else {
|
|
8911
|
+
animation.frameDurationMs = duration;
|
|
8912
|
+
}
|
|
8913
|
+
req.animation = animation;
|
|
8914
|
+
req.size = animationTier(model, frameSize.size);
|
|
8915
|
+
}
|
|
8916
|
+
function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
8917
|
+
const c = model.constraints;
|
|
8918
|
+
const format = req.outputFormat;
|
|
8919
|
+
if (format !== void 0 && !imageOutputFormats(model).includes(format)) {
|
|
8920
|
+
if (onUnsupported === "error") {
|
|
8921
|
+
refuse(
|
|
8922
|
+
model,
|
|
8923
|
+
`${model.id} does not offer outputFormat ${format}. Supported: ${imageOutputFormats(model).join(", ")}.`
|
|
8924
|
+
);
|
|
8925
|
+
}
|
|
8926
|
+
warnings.push({
|
|
8927
|
+
code: "option_ignored",
|
|
8928
|
+
field: "outputFormat",
|
|
8929
|
+
from: format,
|
|
8930
|
+
message: `${model.id} does not offer ${format}; ignored`
|
|
8931
|
+
});
|
|
8932
|
+
delete req.outputFormat;
|
|
8933
|
+
}
|
|
8934
|
+
if (req.background !== void 0 && !(c.backgrounds ?? []).includes(req.background)) {
|
|
8935
|
+
if (onUnsupported === "error") {
|
|
8936
|
+
refuse(model, `${model.id} does not offer background ${req.background}`);
|
|
8937
|
+
}
|
|
8938
|
+
warnings.push({
|
|
8939
|
+
code: "option_ignored",
|
|
8940
|
+
field: "background",
|
|
8941
|
+
from: req.background,
|
|
8942
|
+
message: `${model.id} does not offer background ${req.background}; ignored`
|
|
8943
|
+
});
|
|
8944
|
+
delete req.background;
|
|
8945
|
+
}
|
|
8946
|
+
if (req.outputFormat === "gif") {
|
|
8947
|
+
applyAnimation(model, req, onUnsupported, warnings);
|
|
8948
|
+
} else if (req.animation !== void 0) {
|
|
8949
|
+
warnings.push({
|
|
8950
|
+
code: "option_ignored",
|
|
8951
|
+
field: "animation",
|
|
8952
|
+
message: `animation applies to GIF output only; ignored`
|
|
8953
|
+
});
|
|
8954
|
+
delete req.animation;
|
|
8955
|
+
}
|
|
8956
|
+
if (req.outputFormat === "svg") {
|
|
8957
|
+
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
8958
|
+
if ((req.references ?? []).length > 0) {
|
|
8959
|
+
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
8960
|
+
}
|
|
8961
|
+
if ((req.count ?? 1) > 1) {
|
|
8962
|
+
if (onUnsupported === "error") {
|
|
8963
|
+
refuse(model, `${model.label} makes one SVG per call`);
|
|
8964
|
+
}
|
|
8965
|
+
warnings.push({
|
|
8966
|
+
code: "option_ignored",
|
|
8967
|
+
field: "count",
|
|
8968
|
+
from: req.count,
|
|
8969
|
+
to: 1,
|
|
8970
|
+
message: `${model.id} makes one SVG per call; using 1`
|
|
8971
|
+
});
|
|
8972
|
+
req.count = 1;
|
|
8973
|
+
}
|
|
8974
|
+
}
|
|
8975
|
+
}
|
|
8976
|
+
|
|
8720
8977
|
// src/resolve-lists.ts
|
|
8721
8978
|
function preview(listed2) {
|
|
8722
8979
|
const shown = listed2.slice(0, 12).join(", ");
|
|
@@ -9574,6 +9831,7 @@ function resolveImageOptions(model, request, onUnsupported = "error") {
|
|
|
9574
9831
|
"points",
|
|
9575
9832
|
"boxes"
|
|
9576
9833
|
]);
|
|
9834
|
+
applyImageOutputRules(model, merged, onUnsupported, warnings);
|
|
9577
9835
|
const factor = merged.scaleFactor;
|
|
9578
9836
|
if (factor !== void 0 && c.scaleFactors && !c.scaleFactors.includes(factor)) {
|
|
9579
9837
|
if (onUnsupported === "error") {
|
|
@@ -9910,7 +10168,7 @@ function setOrDelete(req, field, refs) {
|
|
|
9910
10168
|
else delete req[field];
|
|
9911
10169
|
}
|
|
9912
10170
|
function isImageFormat(format) {
|
|
9913
|
-
return format === "png" || format === "jpeg" || format === "webp";
|
|
10171
|
+
return format === "png" || format === "jpeg" || format === "webp" || format === "gif" || format === "svg";
|
|
9914
10172
|
}
|
|
9915
10173
|
function stripUndefined(obj) {
|
|
9916
10174
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
@@ -10117,7 +10375,7 @@ function resolveTranscriptionOptions(model, request, onUnsupported = "error") {
|
|
|
10117
10375
|
}
|
|
10118
10376
|
|
|
10119
10377
|
// src/resolve-voice.ts
|
|
10120
|
-
function
|
|
10378
|
+
function refuse2(model, code, message) {
|
|
10121
10379
|
return new ModelKitError({ code, message: `${model.label} ${message}`, model: model.id });
|
|
10122
10380
|
}
|
|
10123
10381
|
function checkSample(model, sample, index) {
|
|
@@ -10126,7 +10384,7 @@ function checkSample(model, sample, index) {
|
|
|
10126
10384
|
if (limits === void 0 || length === void 0) return;
|
|
10127
10385
|
if (limits.min !== void 0 && length < limits.min || limits.max !== void 0 && length > limits.max) {
|
|
10128
10386
|
const range2 = `${limits.min ?? 0}-${limits.max ?? "any"} s`;
|
|
10129
|
-
throw
|
|
10387
|
+
throw refuse2(
|
|
10130
10388
|
model,
|
|
10131
10389
|
"unsupported_option",
|
|
10132
10390
|
`takes samples of ${range2}; sample ${index + 1} is ${length} s`
|
|
@@ -10135,11 +10393,11 @@ function checkSample(model, sample, index) {
|
|
|
10135
10393
|
}
|
|
10136
10394
|
function resolveVoiceCloneOptions(model, request) {
|
|
10137
10395
|
const title = request.title.trim();
|
|
10138
|
-
if (!title) throw
|
|
10139
|
-
if (request.samples.length === 0) throw
|
|
10396
|
+
if (!title) throw refuse2(model, "missing_input", "needs a title");
|
|
10397
|
+
if (request.samples.length === 0) throw refuse2(model, "missing_input", "needs a voice sample");
|
|
10140
10398
|
const max = model.constraints.references?.audios;
|
|
10141
10399
|
if (max !== void 0 && request.samples.length > max) {
|
|
10142
|
-
throw
|
|
10400
|
+
throw refuse2(
|
|
10143
10401
|
model,
|
|
10144
10402
|
"unsupported_option",
|
|
10145
10403
|
`takes up to ${max} samples; got ${request.samples.length}`
|
|
@@ -10149,7 +10407,7 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10149
10407
|
const total = model.constraints.references?.audioSeconds?.total;
|
|
10150
10408
|
const seconds3 = request.samples.reduce((sum, s) => sum + (s.audio.durationSeconds ?? 0), 0);
|
|
10151
10409
|
if (total !== void 0 && seconds3 > total) {
|
|
10152
|
-
throw
|
|
10410
|
+
throw refuse2(
|
|
10153
10411
|
model,
|
|
10154
10412
|
"unsupported_option",
|
|
10155
10413
|
`takes up to ${total} s of samples; got ${seconds3} s`
|
|
@@ -10158,7 +10416,7 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10158
10416
|
for (const field of ["transcript", "designSignature"]) {
|
|
10159
10417
|
const set = request.samples.filter((s) => s[field]?.trim()).length;
|
|
10160
10418
|
if (set !== 0 && set !== request.samples.length) {
|
|
10161
|
-
throw
|
|
10419
|
+
throw refuse2(model, "missing_input", `needs ${field} on every sample or on none`);
|
|
10162
10420
|
}
|
|
10163
10421
|
}
|
|
10164
10422
|
return { request: { ...request, model: model.id, title }, warnings: [] };
|
|
@@ -10166,10 +10424,10 @@ function resolveVoiceCloneOptions(model, request) {
|
|
|
10166
10424
|
function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
10167
10425
|
const warnings = [];
|
|
10168
10426
|
const prompt = request.prompt.trim();
|
|
10169
|
-
if (!prompt) throw
|
|
10427
|
+
if (!prompt) throw refuse2(model, "missing_input", "needs a voice description");
|
|
10170
10428
|
const maxChars = promptConventions(model).maxChars;
|
|
10171
10429
|
if (maxChars !== void 0 && prompt.length > maxChars) {
|
|
10172
|
-
throw
|
|
10430
|
+
throw refuse2(
|
|
10173
10431
|
model,
|
|
10174
10432
|
"unsupported_option",
|
|
10175
10433
|
`takes up to ${maxChars} characters; got ${prompt.length}`
|
|
@@ -10180,7 +10438,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
10180
10438
|
const preview2 = request.previewText?.trim();
|
|
10181
10439
|
if (preview2) {
|
|
10182
10440
|
if (limits !== void 0 && preview2.length > limits.previewMaxChars) {
|
|
10183
|
-
throw
|
|
10441
|
+
throw refuse2(
|
|
10184
10442
|
model,
|
|
10185
10443
|
"unsupported_option",
|
|
10186
10444
|
`takes a preview line of up to ${limits.previewMaxChars} characters; got ${preview2.length}`
|
|
@@ -10196,7 +10454,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
10196
10454
|
const cap = limits?.maxCandidates ?? count2;
|
|
10197
10455
|
if (!Number.isInteger(count2) || count2 < 1 || count2 > cap) {
|
|
10198
10456
|
if (onUnsupported === "error" || !Number.isInteger(count2)) {
|
|
10199
|
-
throw
|
|
10457
|
+
throw refuse2(
|
|
10200
10458
|
model,
|
|
10201
10459
|
"unsupported_option",
|
|
10202
10460
|
`returns 1-${cap} candidates; got ${count2}`
|