@shop-os/modelkit 0.19.1 → 0.20.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.
@@ -168,7 +168,7 @@ type Lifecycle = "active" | "deprecated" | "retired";
168
168
  type Surface = "cowork" | "space_builder";
169
169
  /** @deprecated use Surface[] */
170
170
  type Exposure = Surface[];
171
- type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video" | "luma" | "fish" | "elevenlabs";
171
+ type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video" | "alibaba" | "luma" | "fish" | "elevenlabs";
172
172
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
173
173
  type ImageSafetySetting = {
174
174
  category: string;
@@ -1066,10 +1066,12 @@ interface UsageEvent {
1066
1066
  keySource?: KeySource;
1067
1067
  raw?: unknown;
1068
1068
  }
1069
- type ProviderKeyName = "openai" | "anthropic" | "google" | "xai" | "perplexity" | "deepseek" | "moonshot" | "minimax" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "luma" | "fish" | "elevenlabs" | "cloudflare";
1069
+ type ProviderKeyName = "openai" | "anthropic" | "google" | "xai" | "perplexity" | "deepseek" | "moonshot" | "minimax" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "alibaba" | "luma" | "fish" | "elevenlabs" | "cloudflare";
1070
1070
  type ProviderKeys = Partial<Record<ProviderKeyName, string>> & {
1071
1071
  /** Higgsfield needs the pair; both switch together. */
1072
1072
  higgsfieldSecret?: string;
1073
+ /** Model Studio workspace the `alibaba` key belongs to; its endpoint takes keys of that workspace only. */
1074
+ alibabaWorkspace?: string;
1073
1075
  /** Bedrock runtime credentials for Anthropic models when routing.anthropic = "bedrock". */
1074
1076
  aws?: {
1075
1077
  /** Bedrock region. Must serve the chosen inference profile (us-east-1 for "us"). */
@@ -1119,6 +1121,8 @@ interface AdapterEndpoints {
1119
1121
  ark?: string;
1120
1122
  /** Luma Agents API. Defaults to https://agents.lumalabs.ai. */
1121
1123
  luma?: string;
1124
+ /** Alibaba Model Studio API base (ending in /api/v1). Defaults to the workspace endpoint in US (Virginia). */
1125
+ alibaba?: string;
1122
1126
  /** Fish Audio API. Defaults to https://api.fish.audio. */
1123
1127
  fish?: string;
1124
1128
  /** ElevenLabs API. Defaults to https://api.elevenlabs.io. */
@@ -1212,7 +1216,7 @@ declare function isListed(row: CatalogModel): boolean;
1212
1216
  */
1213
1217
  declare const MODELS: CatalogModel[];
1214
1218
 
1215
- declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video", "luma", "fish", "elevenlabs"];
1219
+ declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video", "luma", "alibaba", "fish", "elevenlabs"];
1216
1220
  declare const SurfaceSchema: z.ZodEnum<{
1217
1221
  cowork: "cowork";
1218
1222
  space_builder: "space_builder";
@@ -1262,6 +1266,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1262
1266
  prodia: "prodia";
1263
1267
  higgsfield: "higgsfield";
1264
1268
  "xai-video": "xai-video";
1269
+ alibaba: "alibaba";
1265
1270
  luma: "luma";
1266
1271
  fish: "fish";
1267
1272
  elevenlabs: "elevenlabs";
package/dist/catalog.d.ts CHANGED
@@ -168,7 +168,7 @@ type Lifecycle = "active" | "deprecated" | "retired";
168
168
  type Surface = "cowork" | "space_builder";
169
169
  /** @deprecated use Surface[] */
170
170
  type Exposure = Surface[];
171
- type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video" | "luma" | "fish" | "elevenlabs";
171
+ type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video" | "alibaba" | "luma" | "fish" | "elevenlabs";
172
172
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
173
173
  type ImageSafetySetting = {
174
174
  category: string;
@@ -1066,10 +1066,12 @@ interface UsageEvent {
1066
1066
  keySource?: KeySource;
1067
1067
  raw?: unknown;
1068
1068
  }
1069
- type ProviderKeyName = "openai" | "anthropic" | "google" | "xai" | "perplexity" | "deepseek" | "moonshot" | "minimax" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "luma" | "fish" | "elevenlabs" | "cloudflare";
1069
+ type ProviderKeyName = "openai" | "anthropic" | "google" | "xai" | "perplexity" | "deepseek" | "moonshot" | "minimax" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "alibaba" | "luma" | "fish" | "elevenlabs" | "cloudflare";
1070
1070
  type ProviderKeys = Partial<Record<ProviderKeyName, string>> & {
1071
1071
  /** Higgsfield needs the pair; both switch together. */
1072
1072
  higgsfieldSecret?: string;
1073
+ /** Model Studio workspace the `alibaba` key belongs to; its endpoint takes keys of that workspace only. */
1074
+ alibabaWorkspace?: string;
1073
1075
  /** Bedrock runtime credentials for Anthropic models when routing.anthropic = "bedrock". */
1074
1076
  aws?: {
1075
1077
  /** Bedrock region. Must serve the chosen inference profile (us-east-1 for "us"). */
@@ -1119,6 +1121,8 @@ interface AdapterEndpoints {
1119
1121
  ark?: string;
1120
1122
  /** Luma Agents API. Defaults to https://agents.lumalabs.ai. */
1121
1123
  luma?: string;
1124
+ /** Alibaba Model Studio API base (ending in /api/v1). Defaults to the workspace endpoint in US (Virginia). */
1125
+ alibaba?: string;
1122
1126
  /** Fish Audio API. Defaults to https://api.fish.audio. */
1123
1127
  fish?: string;
1124
1128
  /** ElevenLabs API. Defaults to https://api.elevenlabs.io. */
@@ -1212,7 +1216,7 @@ declare function isListed(row: CatalogModel): boolean;
1212
1216
  */
1213
1217
  declare const MODELS: CatalogModel[];
1214
1218
 
1215
- declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video", "luma", "fish", "elevenlabs"];
1219
+ declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video", "luma", "alibaba", "fish", "elevenlabs"];
1216
1220
  declare const SurfaceSchema: z.ZodEnum<{
1217
1221
  cowork: "cowork";
1218
1222
  space_builder: "space_builder";
@@ -1262,6 +1266,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1262
1266
  prodia: "prodia";
1263
1267
  higgsfield: "higgsfield";
1264
1268
  "xai-video": "xai-video";
1269
+ alibaba: "alibaba";
1265
1270
  luma: "luma";
1266
1271
  fish: "fish";
1267
1272
  elevenlabs: "elevenlabs";
package/dist/catalog.js CHANGED
@@ -260,14 +260,15 @@ var FAL_IMAGE_MODELS = [
260
260
  }
261
261
  },
262
262
  {
263
- // alibaba/qwen-image-3/text-to-image; references switch to .../edit (1-3 images, addressed
264
- // as "image 1".."image 3"). $0.04 per image at 1K, $0.075 at 2K.
263
+ // Alibaba Model Studio direct (qwen-image-3.0-pro; fal's qwen-image-3 bills its prices).
264
+ // 1-3 input images make it an edit, addressed as "image 1".."image 3". png output only.
265
+ // https://www.alibabacloud.com/help/en/model-studio/qwen-image-generation-and-editing-api-reference
265
266
  id: "qwen-image-3",
266
267
  aliases: [],
267
268
  label: "Qwen Image 3",
268
269
  type: "image",
269
- adapter: "fal",
270
- providerModelId: "alibaba/qwen-image-3/text-to-image",
270
+ adapter: "alibaba",
271
+ providerModelId: "qwen-image-3.0-pro",
271
272
  lifecycle: "active",
272
273
  exposure: EXPOSURE,
273
274
  constraints: {
@@ -5634,14 +5635,15 @@ var VIDEO_FAMILY_MODELS = [
5634
5635
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
5635
5636
  },
5636
5637
  {
5637
- // https://fal.ai/models/alibaba/happy-horse/v1.1/text-to-video/api (+ /image-to-video,
5638
- // /reference-to-video): one row; references, else a start frame, else text.
5638
+ // Alibaba Model Studio direct: one row for happyhorse-1.1-t2v / -i2v / -r2v; references,
5639
+ // else a start frame, else text. 480P exists too, unpriced, so it stays out.
5640
+ // https://www.alibabacloud.com/help/en/model-studio/happyhorse-reference-to-video-api-reference
5639
5641
  id: "happy-horse-1.1",
5640
5642
  aliases: ["happy-horse"],
5641
5643
  label: "Happy Horse 1.1",
5642
5644
  type: "video",
5643
- adapter: "fal",
5644
- providerModelId: "alibaba/happy-horse/v1.1",
5645
+ adapter: "alibaba",
5646
+ providerModelId: "happyhorse-1.1",
5645
5647
  lifecycle: "active",
5646
5648
  exposure: ["cowork", "space_builder"],
5647
5649
  constraints: {
@@ -5650,7 +5652,7 @@ var VIDEO_FAMILY_MODELS = [
5650
5652
  durations: range(3, 15),
5651
5653
  ratioIgnoredWith: ["firstFrame"],
5652
5654
  references: { ...NO_REFERENCES, images: 9 },
5653
- supports: ["seed", "safetyChecker"],
5655
+ supports: ["seed"],
5654
5656
  prompt: { referenceSyntax: "numbered", maxChars: 2500 },
5655
5657
  audio: "always"
5656
5658
  },
@@ -6599,15 +6601,15 @@ var VIDEO_MODELS = [
6599
6601
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
6600
6602
  },
6601
6603
  {
6602
- // One row for fal's three Wan 3.0 endpoints; the adapter picks text-, image- or
6603
- // reference-to-video from the inputs. Each takes aspect_ratio, so none is ignored.
6604
- // https://fal.ai/models/alibaba/wan-3.0/reference-to-video/api
6604
+ // Alibaba Model Studio direct, one model id for text-, image- (first/last frame) and
6605
+ // reference-to-video. Reference-video seconds bill on top of the output seconds.
6606
+ // https://www.alibabacloud.com/help/en/model-studio/wan3-video-generation-api-reference
6605
6607
  id: "wan-3.0",
6606
6608
  aliases: ["wan-3", "wan3"],
6607
6609
  label: "Wan 3",
6608
6610
  type: "video",
6609
- adapter: "fal",
6610
- providerModelId: "alibaba/wan-3.0",
6611
+ adapter: "alibaba",
6612
+ providerModelId: "wan3.0-video",
6611
6613
  lifecycle: "active",
6612
6614
  exposure: ["cowork", "space_builder"],
6613
6615
  constraints: {
@@ -6622,7 +6624,7 @@ var VIDEO_MODELS = [
6622
6624
  videoSeconds: { total: 15 },
6623
6625
  audioSeconds: { total: 15 }
6624
6626
  },
6625
- supports: ["seed", "lastFrame", "generateAudio", "safetyChecker"],
6627
+ supports: ["seed", "lastFrame", "generateAudio"],
6626
6628
  prompt: WAN_PROMPT,
6627
6629
  audio: "optional"
6628
6630
  },
@@ -6641,15 +6643,14 @@ var VIDEO_MODELS = [
6641
6643
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES, lastFrameRequiresFirstFrame: true }
6642
6644
  },
6643
6645
  {
6644
- // fal's Wan 3.0 Prime endpoints share Wan 3.0's input schemas field for field but bill
6645
- // more per second, so Prime is its own row (the id is the pricing key).
6646
- // https://fal.ai/models/alibaba/wan-3.0-prime/reference-to-video/api
6646
+ // Wan 3.0 Prime takes Wan 3.0's request field for field but bills more per second, so
6647
+ // Prime is its own row (the id is the pricing key).
6647
6648
  id: "wan-3.0-prime",
6648
6649
  aliases: ["wan-3-prime", "wan3-prime"],
6649
6650
  label: "Wan 3 Prime",
6650
6651
  type: "video",
6651
- adapter: "fal",
6652
- providerModelId: "alibaba/wan-3.0-prime",
6652
+ adapter: "alibaba",
6653
+ providerModelId: "wan3.0-video-prime",
6653
6654
  lifecycle: "active",
6654
6655
  exposure: ["cowork", "space_builder"],
6655
6656
  constraints: {
@@ -6664,7 +6665,7 @@ var VIDEO_MODELS = [
6664
6665
  videoSeconds: { total: 15 },
6665
6666
  audioSeconds: { total: 15 }
6666
6667
  },
6667
- supports: ["seed", "lastFrame", "generateAudio", "safetyChecker"],
6668
+ supports: ["seed", "lastFrame", "generateAudio"],
6668
6669
  prompt: WAN_PROMPT,
6669
6670
  audio: "optional"
6670
6671
  },
@@ -7983,6 +7984,7 @@ var ADAPTER_IDS = [
7983
7984
  "higgsfield",
7984
7985
  "xai-video",
7985
7986
  "luma",
7987
+ "alibaba",
7986
7988
  "fish",
7987
7989
  "elevenlabs"
7988
7990
  ];
@@ -9241,7 +9243,8 @@ var QWEN_EXACT = {
9241
9243
  maxSide: 14142,
9242
9244
  minArea: 512 * 512,
9243
9245
  maxArea: 2048 * 2048,
9244
- multipleOf: 1
9246
+ multipleOf: 1,
9247
+ maxAspect: 8
9245
9248
  };
9246
9249
  var MINIMAX_H3_IMAGE_EXACT = {
9247
9250
  minSide: 1,
@@ -9293,7 +9296,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9293
9296
  }
9294
9297
  ],
9295
9298
  [
9296
- "alibaba/qwen-image-3/text-to-image",
9299
+ // Alibaba direct (adapters/alibaba-image.ts); png only, which the adapter warns about.
9300
+ "qwen-image-3.0-pro",
9297
9301
  {
9298
9302
  label: "Qwen Image 3",
9299
9303
  maxReferences: 3,
@@ -9460,7 +9464,7 @@ function falExactSize(spec, req) {
9460
9464
  return check.ok ? check.size : void 0;
9461
9465
  }
9462
9466
  function applyFalImageRules(model, req, callerSize, warnings) {
9463
- if (model.adapter !== "fal") return;
9467
+ if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
9464
9468
  const spec = falImageSpec(model.providerModelId);
9465
9469
  if (spec === void 0) return;
9466
9470
  const problem = falImageProblem(spec, withPromptForResolve(req));
@@ -9523,7 +9527,7 @@ var KLING_V4_FLASH_EDIT = "kling/v4/flash/video-to-video";
9523
9527
  var H3_TURBO = "minimax/h3-max-turbo";
9524
9528
  var H3_RECAST = "minimax/h3-max/recast";
9525
9529
  var H3_RELIGHT = "minimax/h3-max/relight";
9526
- var HAPPY_HORSE = "alibaba/happy-horse/v1.1";
9530
+ var HAPPY_HORSE = "happyhorse-1.1";
9527
9531
  var HAPPY_HORSE_EDIT = "alibaba/happy-horse/video-edit";
9528
9532
  var VIDU_Q4 = "fal-ai/vidu/q4";
9529
9533
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
@@ -9728,7 +9732,7 @@ function fillKlingModeResolution(model, req) {
9728
9732
  }
9729
9733
  }
9730
9734
  function applyFalVideoRules(model, req, callerRatio, warnings) {
9731
- if (model.adapter !== "fal") return;
9735
+ if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
9732
9736
  const problem = falVideoProblem(model.providerModelId, withPromptForResolve(req));
9733
9737
  if (problem !== void 0) throw ruleRefusal(model, problem.message, problem.code);
9734
9738
  const id = model.providerModelId.toLowerCase();