@shop-os/modelkit 0.1.6 → 0.1.8

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
@@ -171,6 +171,10 @@ interface ModelConstraints {
171
171
  min: number;
172
172
  max: number;
173
173
  } | number[];
174
+ /** Curated UI choices when `durations` is a range; `resolveOptions` ignores it. */
175
+ durationPresets?: number[];
176
+ /** Curated quality choices for rows whose `supports` includes "quality". */
177
+ qualityOptions?: string[];
174
178
  references?: ReferenceLimits;
175
179
  requires?: RequiredInput[];
176
180
  supports?: SupportedOption[];
@@ -200,6 +204,35 @@ type ProviderOptions = {
200
204
  type UsageUnit = "tokens" | "images" | "seconds" | "reported_cost_usd" | "compute_seconds";
201
205
  type UsageModality = "TEXT" | "IMAGE" | "VIDEO" | "AUDIO";
202
206
  type PricingKind = "token" | "image_size" | "video_per_second" | "flat";
207
+ /** What a model picker shows for a row. Free of any surface-specific ids. */
208
+ interface CatalogDisplay {
209
+ /** Vendor as the UI names it: "google", "openai", "meta", "bytedance", "xai", "kuaishou", ... */
210
+ provider: string;
211
+ /** One or two sentences for the picker card. */
212
+ description: string;
213
+ /** CDN URL of the vendor or model logo. */
214
+ logo?: string;
215
+ /** Chat picker cost bucket: 1 = cheapest tier (Haiku/Flash/mini), 2 = Sonnet class, 3 = Opus/Pro/frontier. */
216
+ costTier?: 1 | 2 | 3;
217
+ /** Chat picker highlight flag. */
218
+ recommended?: boolean;
219
+ }
220
+ /** Capability flags a UI keys off. Absent means false / unknown. */
221
+ interface CatalogCapabilities {
222
+ /** Image rows: generates from a prompt alone. */
223
+ imageGenerate?: boolean;
224
+ /** Image rows: edits or conditions on reference images. */
225
+ imageEdit?: boolean;
226
+ /** Video rows: takes an existing video as the thing to edit or extend. */
227
+ acceptsSourceVideo?: boolean;
228
+ /** Video rows: first/last frames and reference images are mutually exclusive inputs. */
229
+ framesExcludeReferences?: boolean;
230
+ /** Text rows. */
231
+ vision?: boolean;
232
+ tools?: boolean;
233
+ structuredOutput?: boolean;
234
+ contextWindow?: number;
235
+ }
203
236
  interface CatalogModel {
204
237
  /** Canonical id. Equals the pricing key in pro-backend credit_pricing_* tables. */
205
238
  id: string;
@@ -211,6 +244,11 @@ interface CatalogModel {
211
244
  providerModelId: string;
212
245
  lifecycle: Lifecycle;
213
246
  replacedBy?: string;
247
+ /**
248
+ * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
249
+ * "internal" = callable by id only.
250
+ */
251
+ exposure: "catalog" | "internal";
214
252
  constraints: ModelConstraints;
215
253
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
216
254
  providerOptions?: ProviderOptions;
@@ -219,6 +257,9 @@ interface CatalogModel {
219
257
  modality: UsageModality;
220
258
  };
221
259
  pricingKind: PricingKind;
260
+ /** Required on every `active` row so a picker can render it without a hand-written catalog. */
261
+ display?: CatalogDisplay;
262
+ capabilities?: CatalogCapabilities;
222
263
  }
223
264
  interface Warning {
224
265
  code: "ratio_coerced" | "ratio_dropped" | "size_coerced" | "resolution_coerced" | "duration_coerced" | "references_trimmed" | "option_ignored";
@@ -629,4 +670,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
629
670
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
630
671
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
631
672
 
632
- export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, 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 ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
673
+ export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, 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 ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
package/dist/index.d.ts CHANGED
@@ -171,6 +171,10 @@ interface ModelConstraints {
171
171
  min: number;
172
172
  max: number;
173
173
  } | number[];
174
+ /** Curated UI choices when `durations` is a range; `resolveOptions` ignores it. */
175
+ durationPresets?: number[];
176
+ /** Curated quality choices for rows whose `supports` includes "quality". */
177
+ qualityOptions?: string[];
174
178
  references?: ReferenceLimits;
175
179
  requires?: RequiredInput[];
176
180
  supports?: SupportedOption[];
@@ -200,6 +204,35 @@ type ProviderOptions = {
200
204
  type UsageUnit = "tokens" | "images" | "seconds" | "reported_cost_usd" | "compute_seconds";
201
205
  type UsageModality = "TEXT" | "IMAGE" | "VIDEO" | "AUDIO";
202
206
  type PricingKind = "token" | "image_size" | "video_per_second" | "flat";
207
+ /** What a model picker shows for a row. Free of any surface-specific ids. */
208
+ interface CatalogDisplay {
209
+ /** Vendor as the UI names it: "google", "openai", "meta", "bytedance", "xai", "kuaishou", ... */
210
+ provider: string;
211
+ /** One or two sentences for the picker card. */
212
+ description: string;
213
+ /** CDN URL of the vendor or model logo. */
214
+ logo?: string;
215
+ /** Chat picker cost bucket: 1 = cheapest tier (Haiku/Flash/mini), 2 = Sonnet class, 3 = Opus/Pro/frontier. */
216
+ costTier?: 1 | 2 | 3;
217
+ /** Chat picker highlight flag. */
218
+ recommended?: boolean;
219
+ }
220
+ /** Capability flags a UI keys off. Absent means false / unknown. */
221
+ interface CatalogCapabilities {
222
+ /** Image rows: generates from a prompt alone. */
223
+ imageGenerate?: boolean;
224
+ /** Image rows: edits or conditions on reference images. */
225
+ imageEdit?: boolean;
226
+ /** Video rows: takes an existing video as the thing to edit or extend. */
227
+ acceptsSourceVideo?: boolean;
228
+ /** Video rows: first/last frames and reference images are mutually exclusive inputs. */
229
+ framesExcludeReferences?: boolean;
230
+ /** Text rows. */
231
+ vision?: boolean;
232
+ tools?: boolean;
233
+ structuredOutput?: boolean;
234
+ contextWindow?: number;
235
+ }
203
236
  interface CatalogModel {
204
237
  /** Canonical id. Equals the pricing key in pro-backend credit_pricing_* tables. */
205
238
  id: string;
@@ -211,6 +244,11 @@ interface CatalogModel {
211
244
  providerModelId: string;
212
245
  lifecycle: Lifecycle;
213
246
  replacedBy?: string;
247
+ /**
248
+ * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
249
+ * "internal" = callable by id only.
250
+ */
251
+ exposure: "catalog" | "internal";
214
252
  constraints: ModelConstraints;
215
253
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
216
254
  providerOptions?: ProviderOptions;
@@ -219,6 +257,9 @@ interface CatalogModel {
219
257
  modality: UsageModality;
220
258
  };
221
259
  pricingKind: PricingKind;
260
+ /** Required on every `active` row so a picker can render it without a hand-written catalog. */
261
+ display?: CatalogDisplay;
262
+ capabilities?: CatalogCapabilities;
222
263
  }
223
264
  interface Warning {
224
265
  code: "ratio_coerced" | "ratio_dropped" | "size_coerced" | "resolution_coerced" | "duration_coerced" | "references_trimmed" | "option_ignored";
@@ -629,4 +670,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
629
670
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
630
671
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
631
672
 
632
- export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, 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 ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
673
+ export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, 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 ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };