@shop-os/modelkit 0.3.1 → 0.3.3

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
@@ -11,7 +11,7 @@ import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
11
11
 
12
12
  /** The AI SDK video model spelling: a catalog id or a provider video model instance. */
13
13
  type VideoModel = Parameters<typeof experimental_generateVideo>[0]["model"];
14
- type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "5:4" | "21:9" | "9:21" | "97:30" | "adaptive";
14
+ type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "5:4" | "21:9" | "9:21" | "97:30" | "1:4" | "4:1" | "1:8" | "8:1" | "adaptive";
15
15
  type ImageSize = "512" | "1K" | "2K" | "4K";
16
16
  type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
17
17
  /** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
@@ -396,6 +396,8 @@ interface CatalogCapabilities {
396
396
  videoEdit?: boolean;
397
397
  /** Video rows: first/last frames and reference images are mutually exclusive inputs. */
398
398
  framesExcludeReferences?: boolean;
399
+ /** Video rows: a source video is never sent with first/last frames or reference images. */
400
+ sourceVideoExcludesFrames?: boolean;
399
401
  /** Video rows: a last frame is accepted only together with a first frame. */
400
402
  lastFrameRequiresFirstFrame?: boolean;
401
403
  /** Text rows. `reasoning`: the model streams reasoning the UI should surface. */
@@ -716,6 +718,10 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
716
718
  "21:9": "21:9";
717
719
  "9:21": "9:21";
718
720
  "97:30": "97:30";
721
+ "1:4": "1:4";
722
+ "4:1": "4:1";
723
+ "1:8": "1:8";
724
+ "8:1": "8:1";
719
725
  adaptive: "adaptive";
720
726
  }>>>;
721
727
  sizes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -851,6 +857,10 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
851
857
  "21:9": "21:9";
852
858
  "9:21": "9:21";
853
859
  "97:30": "97:30";
860
+ "1:4": "1:4";
861
+ "4:1": "4:1";
862
+ "1:8": "1:8";
863
+ "8:1": "8:1";
854
864
  adaptive: "adaptive";
855
865
  }>>;
856
866
  size: z.ZodOptional<z.ZodEnum<{
@@ -1013,6 +1023,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1013
1023
  acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
1014
1024
  videoEdit: z.ZodOptional<z.ZodBoolean>;
1015
1025
  framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
1026
+ sourceVideoExcludesFrames: z.ZodOptional<z.ZodBoolean>;
1016
1027
  lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
1017
1028
  reasoning: z.ZodOptional<z.ZodBoolean>;
1018
1029
  vision: z.ZodOptional<z.ZodBoolean>;
@@ -1022,15 +1033,19 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1022
1033
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
1023
1034
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
1024
1035
 
1025
- declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages"];
1036
+ declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages", "sourceVideo"];
1026
1037
  declare const IMAGE_INPUT_SPEC_KEYS: readonly ["prompt", "references", "aspectRatio", "size", "outputFormat", "seed"];
1027
1038
  declare const AUDIO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "seed", "negativePrompt", "references", "sourceVideo", "instrumental"];
1039
+ /** Image inputs that `inputSpec.arrays` can join into one provider array field. */
1040
+ declare const ARRAY_INPUT_SPEC_KEYS: readonly ["firstFrame", "referenceImages", "lastFrame", "references"];
1041
+ type ArrayInputSpecKey = (typeof ARRAY_INPUT_SPEC_KEYS)[number];
1028
1042
  type InputSpecKey = (typeof VIDEO_INPUT_SPEC_KEYS)[number] | (typeof IMAGE_INPUT_SPEC_KEYS)[number] | (typeof AUDIO_INPUT_SPEC_KEYS)[number];
1029
1043
  declare const INPUT_SPEC_SUPPORTS_KEYS: readonly SupportedOption[];
1030
1044
  declare const InputSpecSchema: z.ZodObject<{
1031
1045
  fields: z.ZodRecord<z.ZodString, z.ZodString>;
1032
1046
  values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
1033
1047
  static: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1048
+ arrays: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
1034
1049
  editEndpoint: z.ZodOptional<z.ZodString>;
1035
1050
  }, z.core.$strict>;
1036
1051
  type InputSpec = z.infer<typeof InputSpecSchema>;
@@ -1046,6 +1061,7 @@ interface ValidateRow {
1046
1061
  };
1047
1062
  }
1048
1063
  declare function isInputSpecKey(key: string): key is InputSpecKey;
1064
+ declare function isArrayInputSpecKey(key: string): key is ArrayInputSpecKey;
1049
1065
  declare function validateInputSpec(raw: ProviderOptionValue, row: ValidateRow): {
1050
1066
  ok: true;
1051
1067
  spec: InputSpec;
@@ -1437,4 +1453,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
1437
1453
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
1438
1454
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
1439
1455
 
1440
- export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, 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, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
1456
+ export { ADAPTER_IDS, ADAPTER_KEYS, ARRAY_INPUT_SPEC_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type ArrayInputSpecKey, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, 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, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isArrayInputSpecKey, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
11
11
 
12
12
  /** The AI SDK video model spelling: a catalog id or a provider video model instance. */
13
13
  type VideoModel = Parameters<typeof experimental_generateVideo>[0]["model"];
14
- type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "5:4" | "21:9" | "9:21" | "97:30" | "adaptive";
14
+ type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "5:4" | "21:9" | "9:21" | "97:30" | "1:4" | "4:1" | "1:8" | "8:1" | "adaptive";
15
15
  type ImageSize = "512" | "1K" | "2K" | "4K";
16
16
  type VideoResolution = "360p" | "480p" | "720p" | "768p" | "1080p" | "2k" | "4k";
17
17
  /** "xhigh" and "max" exist only on gpt-image-2.5; gpt-image-2 rejects them at the provider. */
@@ -396,6 +396,8 @@ interface CatalogCapabilities {
396
396
  videoEdit?: boolean;
397
397
  /** Video rows: first/last frames and reference images are mutually exclusive inputs. */
398
398
  framesExcludeReferences?: boolean;
399
+ /** Video rows: a source video is never sent with first/last frames or reference images. */
400
+ sourceVideoExcludesFrames?: boolean;
399
401
  /** Video rows: a last frame is accepted only together with a first frame. */
400
402
  lastFrameRequiresFirstFrame?: boolean;
401
403
  /** Text rows. `reasoning`: the model streams reasoning the UI should surface. */
@@ -716,6 +718,10 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
716
718
  "21:9": "21:9";
717
719
  "9:21": "9:21";
718
720
  "97:30": "97:30";
721
+ "1:4": "1:4";
722
+ "4:1": "4:1";
723
+ "1:8": "1:8";
724
+ "8:1": "8:1";
719
725
  adaptive: "adaptive";
720
726
  }>>>;
721
727
  sizes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -851,6 +857,10 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
851
857
  "21:9": "21:9";
852
858
  "9:21": "9:21";
853
859
  "97:30": "97:30";
860
+ "1:4": "1:4";
861
+ "4:1": "4:1";
862
+ "1:8": "1:8";
863
+ "8:1": "8:1";
854
864
  adaptive: "adaptive";
855
865
  }>>;
856
866
  size: z.ZodOptional<z.ZodEnum<{
@@ -1013,6 +1023,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1013
1023
  acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
1014
1024
  videoEdit: z.ZodOptional<z.ZodBoolean>;
1015
1025
  framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
1026
+ sourceVideoExcludesFrames: z.ZodOptional<z.ZodBoolean>;
1016
1027
  lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
1017
1028
  reasoning: z.ZodOptional<z.ZodBoolean>;
1018
1029
  vision: z.ZodOptional<z.ZodBoolean>;
@@ -1022,15 +1033,19 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1022
1033
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
1023
1034
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
1024
1035
 
1025
- declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages"];
1036
+ declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages", "sourceVideo"];
1026
1037
  declare const IMAGE_INPUT_SPEC_KEYS: readonly ["prompt", "references", "aspectRatio", "size", "outputFormat", "seed"];
1027
1038
  declare const AUDIO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "seed", "negativePrompt", "references", "sourceVideo", "instrumental"];
1039
+ /** Image inputs that `inputSpec.arrays` can join into one provider array field. */
1040
+ declare const ARRAY_INPUT_SPEC_KEYS: readonly ["firstFrame", "referenceImages", "lastFrame", "references"];
1041
+ type ArrayInputSpecKey = (typeof ARRAY_INPUT_SPEC_KEYS)[number];
1028
1042
  type InputSpecKey = (typeof VIDEO_INPUT_SPEC_KEYS)[number] | (typeof IMAGE_INPUT_SPEC_KEYS)[number] | (typeof AUDIO_INPUT_SPEC_KEYS)[number];
1029
1043
  declare const INPUT_SPEC_SUPPORTS_KEYS: readonly SupportedOption[];
1030
1044
  declare const InputSpecSchema: z.ZodObject<{
1031
1045
  fields: z.ZodRecord<z.ZodString, z.ZodString>;
1032
1046
  values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
1033
1047
  static: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1048
+ arrays: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
1034
1049
  editEndpoint: z.ZodOptional<z.ZodString>;
1035
1050
  }, z.core.$strict>;
1036
1051
  type InputSpec = z.infer<typeof InputSpecSchema>;
@@ -1046,6 +1061,7 @@ interface ValidateRow {
1046
1061
  };
1047
1062
  }
1048
1063
  declare function isInputSpecKey(key: string): key is InputSpecKey;
1064
+ declare function isArrayInputSpecKey(key: string): key is ArrayInputSpecKey;
1049
1065
  declare function validateInputSpec(raw: ProviderOptionValue, row: ValidateRow): {
1050
1066
  ok: true;
1051
1067
  spec: InputSpec;
@@ -1437,4 +1453,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
1437
1453
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
1438
1454
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
1439
1455
 
1440
- export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, 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, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
1456
+ export { ADAPTER_IDS, ADAPTER_KEYS, ARRAY_INPUT_SPEC_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type ArrayInputSpecKey, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type FalWebhookBody, type GeneratedImage, IMAGE_INPUT_SPEC_KEYS, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type ReferenceSyntax, 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, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, 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 Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, falWebhookBodySchema, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isArrayInputSpecKey, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, missingTierKeys, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, planVideoTool, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, videoLengthViolation, videoToolConstraints, withRetry, xaiVideoAdapter };
package/dist/index.js CHANGED
@@ -169,13 +169,21 @@ var GEMINI_RATIOS = [
169
169
  "5:4",
170
170
  "adaptive"
171
171
  ];
172
+ var NANO_BANANA_2_1_RATIOS = [
173
+ ...GEMINI_RATIOS.filter((r) => r !== "adaptive"),
174
+ "1:4",
175
+ "4:1",
176
+ "1:8",
177
+ "8:1",
178
+ "adaptive"
179
+ ];
172
180
  var GEMINI_PROMPT_MAX_CHARS = 5e4;
173
181
  var GPT_IMAGE_PROMPT = { referenceSyntax: "numbered", maxChars: 32e3 };
174
- function geminiImage(id, label, aliases, sizes, display, exposure, references, promptMaxChars) {
182
+ function geminiImage(id, label, aliases, sizes, display, exposure, references, promptMaxChars, aspectRatios = GEMINI_RATIOS) {
175
183
  const prompt = { referenceSyntax: "caption" };
176
184
  if (promptMaxChars !== void 0) prompt.maxChars = promptMaxChars;
177
185
  const constraints = {
178
- aspectRatios: [...GEMINI_RATIOS],
186
+ aspectRatios: [...aspectRatios],
179
187
  sizes,
180
188
  supports: ["safetySettings", "temperature"],
181
189
  prompt
@@ -199,6 +207,21 @@ function geminiImage(id, label, aliases, sizes, display, exposure, references, p
199
207
  return model;
200
208
  }
201
209
  var IMAGE_MODELS = [
210
+ geminiImage(
211
+ "gemini-nano-banana-2.1",
212
+ "Nano Banana 2.1",
213
+ ["nb-2.1"],
214
+ ["1K", "2K", "4K"],
215
+ {
216
+ provider: "google",
217
+ description: "Latest high-efficiency Nano Banana. Better realism, prompt adherence, text rendering and character consistency at Flash speed. Great for campaigns, infographics, and iterative edits.",
218
+ logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png"
219
+ },
220
+ ["cowork", "space_builder"],
221
+ { images: 14 },
222
+ GEMINI_PROMPT_MAX_CHARS,
223
+ NANO_BANANA_2_1_RATIOS
224
+ ),
202
225
  geminiImage(
203
226
  "gemini-3-pro-image-preview",
204
227
  "Nano Banana Pro",
@@ -2215,7 +2238,8 @@ var VIDEO_INPUT_SPEC_KEYS = [
2215
2238
  "generateAudio",
2216
2239
  "cfgScale",
2217
2240
  "promptExpansion",
2218
- "referenceImages"
2241
+ "referenceImages",
2242
+ "sourceVideo"
2219
2243
  ];
2220
2244
  var IMAGE_INPUT_SPEC_KEYS = [
2221
2245
  "prompt",
@@ -2234,6 +2258,12 @@ var AUDIO_INPUT_SPEC_KEYS = [
2234
2258
  "sourceVideo",
2235
2259
  "instrumental"
2236
2260
  ];
2261
+ var ARRAY_INPUT_SPEC_KEYS = [
2262
+ "firstFrame",
2263
+ "referenceImages",
2264
+ "lastFrame",
2265
+ "references"
2266
+ ];
2237
2267
  var INPUT_SPEC_SUPPORTS_KEYS = [
2238
2268
  "lastFrame",
2239
2269
  "seed",
@@ -2247,6 +2277,7 @@ var INPUT_SPEC_SUPPORTS_KEYS = [
2247
2277
  var VIDEO_KEY_SET = new Set(VIDEO_INPUT_SPEC_KEYS);
2248
2278
  var IMAGE_KEY_SET = new Set(IMAGE_INPUT_SPEC_KEYS);
2249
2279
  var AUDIO_KEY_SET = new Set(AUDIO_INPUT_SPEC_KEYS);
2280
+ var ARRAY_KEY_SET = new Set(ARRAY_INPUT_SPEC_KEYS);
2250
2281
  var ALL_KEY_SET = /* @__PURE__ */ new Set([
2251
2282
  ...VIDEO_INPUT_SPEC_KEYS,
2252
2283
  ...IMAGE_INPUT_SPEC_KEYS,
@@ -2291,13 +2322,30 @@ var ValuesSchema = z2.record(z2.string(), z2.record(z2.string(), ProviderScalarS
2291
2322
  }
2292
2323
  });
2293
2324
  var StaticSchema = z2.record(z2.string(), ProviderScalarSchema);
2325
+ var ArraysSchema = z2.record(z2.string().min(1), z2.array(z2.string()).min(1)).superRefine((arrays, ctx) => {
2326
+ for (const [name, keys] of Object.entries(arrays)) {
2327
+ for (const key of keys) {
2328
+ if (!ARRAY_KEY_SET.has(key)) {
2329
+ ctx.addIssue({
2330
+ code: "custom",
2331
+ path: [name],
2332
+ message: `inputSpec.arrays "${name}" has unknown image key "${key}"`
2333
+ });
2334
+ }
2335
+ }
2336
+ }
2337
+ });
2294
2338
  var InputSpecSchema = z2.strictObject({
2295
2339
  fields: FieldsSchema,
2296
2340
  values: ValuesSchema.optional(),
2297
2341
  static: StaticSchema.optional(),
2342
+ arrays: ArraysSchema.optional(),
2298
2343
  editEndpoint: z2.string().min(1).optional()
2299
2344
  }).superRefine((spec, ctx) => {
2300
- const mappedNames = new Set(Object.values(spec.fields));
2345
+ const mappedNames = /* @__PURE__ */ new Set([
2346
+ ...Object.values(spec.fields),
2347
+ ...Object.keys(spec.arrays ?? {})
2348
+ ]);
2301
2349
  for (const key of Object.keys(spec.static ?? {})) {
2302
2350
  if (mappedNames.has(key)) {
2303
2351
  ctx.addIssue({
@@ -2311,6 +2359,9 @@ var InputSpecSchema = z2.strictObject({
2311
2359
  function isInputSpecKey(key) {
2312
2360
  return ALL_KEY_SET.has(key);
2313
2361
  }
2362
+ function isArrayInputSpecKey(key) {
2363
+ return ARRAY_KEY_SET.has(key);
2364
+ }
2314
2365
  function validateInputSpec(raw, row) {
2315
2366
  const parsed = InputSpecSchema.safeParse(raw);
2316
2367
  if (!parsed.success) {
@@ -2389,14 +2440,54 @@ function validateInputSpec(raw, row) {
2389
2440
  });
2390
2441
  }
2391
2442
  }
2443
+ const arrayOwner = /* @__PURE__ */ new Map();
2444
+ for (const [name, keys] of Object.entries(spec.arrays ?? {})) {
2445
+ const fieldKey = seenNames.get(name);
2446
+ if (fieldKey !== void 0) {
2447
+ issues.push({
2448
+ path: ["arrays", name],
2449
+ message: `inputSpec.arrays "${name}" is also the provider field of inputSpec.fields "${fieldKey}"`
2450
+ });
2451
+ }
2452
+ for (const key of keys) {
2453
+ if (allowed !== void 0 && !allowed.has(key)) {
2454
+ issues.push({
2455
+ path: ["arrays", name],
2456
+ message: `inputSpec.arrays "${key}" is not supported for ${row.type} rows`
2457
+ });
2458
+ }
2459
+ if (key in spec.fields) {
2460
+ issues.push({
2461
+ path: ["arrays", name],
2462
+ message: `inputSpec.arrays "${key}" is already mapped in inputSpec.fields`
2463
+ });
2464
+ }
2465
+ const owner = arrayOwner.get(key);
2466
+ if (owner === void 0) arrayOwner.set(key, name);
2467
+ else {
2468
+ issues.push({
2469
+ path: ["arrays", name],
2470
+ message: owner === name ? `inputSpec.arrays "${name}" lists "${key}" twice` : `inputSpec.arrays "${owner}" and "${name}" both take "${key}"`
2471
+ });
2472
+ }
2473
+ }
2474
+ }
2392
2475
  const supports = row.constraints.supports ?? [];
2393
2476
  for (const key of INPUT_SPEC_SUPPORTS_KEYS) {
2394
- if (key in spec.fields && !supports.includes(key)) {
2477
+ if (supports.includes(key)) continue;
2478
+ if (key in spec.fields) {
2395
2479
  issues.push({
2396
2480
  path: ["fields", key],
2397
2481
  message: `inputSpec.fields "${key}" needs "${key}" in constraints.supports`
2398
2482
  });
2399
2483
  }
2484
+ const arrayName = arrayOwner.get(key);
2485
+ if (arrayName !== void 0) {
2486
+ issues.push({
2487
+ path: ["arrays", arrayName],
2488
+ message: `inputSpec.arrays "${key}" needs "${key}" in constraints.supports`
2489
+ });
2490
+ }
2400
2491
  }
2401
2492
  if (issues.length > 0) return { ok: false, issues };
2402
2493
  return { ok: true, spec };
@@ -2445,6 +2536,10 @@ var AspectRatioSchema = z3.enum([
2445
2536
  "21:9",
2446
2537
  "9:21",
2447
2538
  "97:30",
2539
+ "1:4",
2540
+ "4:1",
2541
+ "1:8",
2542
+ "8:1",
2448
2543
  "adaptive"
2449
2544
  ]);
2450
2545
  var ImageSizeSchema = z3.enum(["512", "1K", "2K", "4K"]);
@@ -2614,6 +2709,7 @@ var CatalogCapabilitiesSchema = z3.looseObject({
2614
2709
  acceptsSourceVideo: z3.boolean().optional(),
2615
2710
  videoEdit: z3.boolean().optional(),
2616
2711
  framesExcludeReferences: z3.boolean().optional(),
2712
+ sourceVideoExcludesFrames: z3.boolean().optional(),
2617
2713
  lastFrameRequiresFirstFrame: z3.boolean().optional(),
2618
2714
  reasoning: z3.boolean().optional(),
2619
2715
  vision: z3.boolean().optional(),
@@ -4141,6 +4237,17 @@ function applyInputSpec(spec, req, refToUrl2, opts) {
4141
4237
  const mapped = spec.values?.[canonical]?.[String(value)];
4142
4238
  out[providerField] = mapped ?? serialised;
4143
4239
  }
4240
+ for (const [providerField, keys] of Object.entries(spec.arrays ?? {})) {
4241
+ const urls = [];
4242
+ for (const key of keys) {
4243
+ if (!isArrayInputSpecKey(key)) continue;
4244
+ const value = canonicalValue(req, key);
4245
+ if (value === void 0) continue;
4246
+ if (Array.isArray(value)) urls.push(...value.map(refToUrl2));
4247
+ else if (isMediaRef(value)) urls.push(refToUrl2(value));
4248
+ }
4249
+ if (urls.length > 0) out[providerField] = urls;
4250
+ }
4144
4251
  for (const [key, value] of Object.entries(spec.static ?? {})) {
4145
4252
  out[key] = value;
4146
4253
  }
@@ -8262,6 +8369,26 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
8262
8369
  });
8263
8370
  delete merged.sourceVideo;
8264
8371
  }
8372
+ const imageInputs = ["firstFrame", "lastFrame", "referenceImages"].filter(
8373
+ (field) => field === "referenceImages" ? compact(merged.referenceImages).length > 0 : merged[field] !== void 0
8374
+ );
8375
+ if (merged.sourceVideo !== void 0 && imageInputs.length > 0 && model.capabilities?.sourceVideoExcludesFrames) {
8376
+ if (onUnsupported === "error") {
8377
+ throw new ModelKitError({
8378
+ code: "unsupported_option",
8379
+ message: `${model.id} takes a source video or images, not both`,
8380
+ model: model.id
8381
+ });
8382
+ }
8383
+ for (const field of imageInputs) {
8384
+ warnings.push({
8385
+ code: "option_ignored",
8386
+ field,
8387
+ message: `${model.id} takes a source video or images, not both; ${field} dropped`
8388
+ });
8389
+ delete merged[field];
8390
+ }
8391
+ }
8265
8392
  if (merged.lastFrame !== void 0 && merged.firstFrame === void 0 && model.capabilities?.lastFrameRequiresFirstFrame) {
8266
8393
  if (onUnsupported === "error") {
8267
8394
  throw new ModelKitError({
@@ -9378,6 +9505,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
9378
9505
  export {
9379
9506
  ADAPTER_IDS,
9380
9507
  ADAPTER_KEYS,
9508
+ ARRAY_INPUT_SPEC_KEYS,
9381
9509
  AUDIO_INPUT_SPEC_KEYS,
9382
9510
  Catalog,
9383
9511
  CatalogModelSchema,
@@ -9420,6 +9548,7 @@ export {
9420
9548
  googleImageAdapter,
9421
9549
  hasAwsCredentials,
9422
9550
  higgsfieldAdapter,
9551
+ isArrayInputSpecKey,
9423
9552
  isInputSpecKey,
9424
9553
  isListed,
9425
9554
  isListedOn,