@shop-os/modelkit 0.1.8 → 0.1.10

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.cjs CHANGED
@@ -213,7 +213,7 @@ function geminiImage(id, label, aliases, sizes, display, exposure) {
213
213
  supports: ["safetySettings", "temperature"]
214
214
  },
215
215
  defaults: { size: "1K", aspectRatio: "1:1" },
216
- usage: { ...IMAGE_USAGE },
216
+ usage: { ...IMAGE_USAGE, slug: "gemini" },
217
217
  pricingKind: "image_size",
218
218
  display,
219
219
  capabilities: { ...IMAGE_GENERATE_EDIT }
@@ -281,6 +281,15 @@ var IMAGE_MODELS = [
281
281
  lifecycle: "active",
282
282
  exposure: "catalog",
283
283
  constraints: {
284
+ exactSizes: {
285
+ "1:1": "1024x1024",
286
+ "3:2": "1536x1024",
287
+ "2:3": "1024x1536",
288
+ "16:9": "2048x1152",
289
+ "9:16": "1152x2048",
290
+ "4:5": "1024x1280",
291
+ "5:4": "1280x1024"
292
+ },
284
293
  aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
285
294
  sizes: ["1K", "2K", "4K"],
286
295
  qualityOptions: ["auto", "low", "medium", "high"],
@@ -288,7 +297,7 @@ var IMAGE_MODELS = [
288
297
  supports: ["quality", "count"]
289
298
  },
290
299
  defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
291
- usage: { ...IMAGE_USAGE },
300
+ usage: { ...IMAGE_USAGE, slug: "gpt" },
292
301
  pricingKind: "image_size",
293
302
  display: {
294
303
  provider: "openai",
@@ -308,6 +317,15 @@ var IMAGE_MODELS = [
308
317
  lifecycle: "active",
309
318
  exposure: "internal",
310
319
  constraints: {
320
+ exactSizes: {
321
+ "1:1": "1024x1024",
322
+ "3:2": "1536x1024",
323
+ "2:3": "1024x1536",
324
+ "16:9": "2048x1152",
325
+ "9:16": "1152x2048",
326
+ "4:5": "1024x1280",
327
+ "5:4": "1280x1024"
328
+ },
311
329
  aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
312
330
  sizes: ["1K", "2K", "4K"],
313
331
  qualityOptions: ["auto", "low", "medium", "high"],
@@ -334,6 +352,15 @@ var IMAGE_MODELS = [
334
352
  lifecycle: "active",
335
353
  exposure: "internal",
336
354
  constraints: {
355
+ exactSizes: {
356
+ "1:1": "1024x1024",
357
+ "3:2": "1536x1024",
358
+ "2:3": "1024x1536",
359
+ "16:9": "2048x1152",
360
+ "9:16": "1152x2048",
361
+ "4:5": "1024x1280",
362
+ "5:4": "1280x1024"
363
+ },
337
364
  aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
338
365
  sizes: ["1K", "2K", "4K"],
339
366
  qualityOptions: ["auto", "low", "medium", "high"],
@@ -379,7 +406,7 @@ var IMAGE_MODELS = [
379
406
  supports: ["count", "outputFormat"]
380
407
  },
381
408
  defaults: { size: "1K", aspectRatio: "1:1", outputFormat: "png", count: 1 },
382
- usage: { ...IMAGE_USAGE },
409
+ usage: { ...IMAGE_USAGE, slug: "muse" },
383
410
  pricingKind: "image_size",
384
411
  display: {
385
412
  provider: "meta",
@@ -410,6 +437,7 @@ var IMAGE_MODELS = [
410
437
  pricingKind: "image_size",
411
438
  display: {
412
439
  provider: "bytedance",
440
+ logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
413
441
  description: "ByteDance Seedream 5.0 Pro text-to-image and multi-reference image-to-image (up to 10 inputs) with region editing; outputs 1K, 1.5K, or 2K."
414
442
  },
415
443
  capabilities: { ...IMAGE_GENERATE_EDIT }
@@ -615,6 +643,7 @@ var IMAGE_MODELS = [
615
643
  ];
616
644
 
617
645
  // src/catalog/other.ts
646
+ var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
618
647
  var OTHER_MODELS = [
619
648
  {
620
649
  id: "lyria-3-clip-preview",
@@ -635,6 +664,7 @@ var OTHER_MODELS = [
635
664
  pricingKind: "flat",
636
665
  display: {
637
666
  provider: "google",
667
+ logo: GOOGLE_LOGO,
638
668
  description: "Google Lyria 3 Clip short music clips, loops, and previews; takes text and up to 10 image prompts and returns a fixed 30-second MP3 plus lyrics."
639
669
  },
640
670
  capabilities: {}
@@ -657,6 +687,7 @@ var OTHER_MODELS = [
657
687
  pricingKind: "flat",
658
688
  display: {
659
689
  provider: "google",
690
+ logo: GOOGLE_LOGO,
660
691
  description: "Google Lyria 3 Pro flagship music model for full-length songs with verses, choruses, and bridges; takes text and up to 10 image prompts and returns MP3 plus lyrics."
661
692
  },
662
693
  capabilities: {}
@@ -796,6 +827,14 @@ function text(id, label, providerModelId, extra) {
796
827
  ...extra
797
828
  };
798
829
  }
830
+ var ANTHROPIC_THINKING = {
831
+ anthropic: { thinking: { type: "enabled", budgetTokens: 4e3 }, sendReasoning: true }
832
+ };
833
+ var ANTHROPIC_ADAPTIVE = {
834
+ anthropic: { thinking: { type: "adaptive", display: "summarized" }, sendReasoning: true }
835
+ };
836
+ var OPENAI_REASONING = { openai: { reasoningEffort: "medium", reasoningSummary: "auto" } };
837
+ var DEEPSEEK_THINKING = { deepseek: { thinking: { type: "enabled" } } };
799
838
  var TEXT_MODELS = [
800
839
  text("gpt-4o", "GPT-4o", "gpt-4o", {
801
840
  exposure: "internal",
@@ -876,11 +915,13 @@ var TEXT_MODELS = [
876
915
  text("gpt-5.6-luna", "GPT-5.6 Luna", "gpt-5.6-luna", {
877
916
  exposure: "catalog",
878
917
  display: {
918
+ chat: { providerOptions: OPENAI_REASONING },
879
919
  provider: "openai",
880
920
  costTier: 1,
881
921
  description: "OpenAI GPT-5.6 Luna cost-optimized tier of the GPT-5.6 reasoning family; text and image input, 1.05M-token context."
882
922
  },
883
923
  capabilities: {
924
+ reasoning: true,
884
925
  vision: true,
885
926
  tools: true,
886
927
  structuredOutput: true,
@@ -890,11 +931,13 @@ var TEXT_MODELS = [
890
931
  text("gpt-5.6-terra", "GPT-5.6 Terra", "gpt-5.6-terra", {
891
932
  exposure: "catalog",
892
933
  display: {
934
+ chat: { providerOptions: OPENAI_REASONING },
893
935
  provider: "openai",
894
936
  costTier: 2,
895
937
  description: "OpenAI GPT-5.6 Terra balanced tier of the GPT-5.6 reasoning family; text and image input, 1.05M-token context."
896
938
  },
897
939
  capabilities: {
940
+ reasoning: true,
898
941
  vision: true,
899
942
  tools: true,
900
943
  structuredOutput: true,
@@ -904,11 +947,13 @@ var TEXT_MODELS = [
904
947
  text("gpt-5.6-sol", "GPT-5.6 Sol", "gpt-5.6-sol", {
905
948
  exposure: "catalog",
906
949
  display: {
950
+ chat: { providerOptions: OPENAI_REASONING },
907
951
  provider: "openai",
908
952
  costTier: 3,
909
953
  description: "OpenAI GPT-5.6 Sol flagship tier of the GPT-5.6 reasoning family; text and image input, 1.05M-token context."
910
954
  },
911
955
  capabilities: {
956
+ reasoning: true,
912
957
  vision: true,
913
958
  tools: true,
914
959
  structuredOutput: true,
@@ -936,11 +981,13 @@ var TEXT_MODELS = [
936
981
  "claude-sonnet-4-20250514"
937
982
  ],
938
983
  display: {
984
+ chat: { providerOptions: ANTHROPIC_THINKING },
939
985
  provider: "anthropic",
940
986
  costTier: 2,
941
987
  description: "Anthropic Claude Sonnet 4.6 (legacy) balanced model; text and image input, 1M-token context."
942
988
  },
943
989
  capabilities: {
990
+ reasoning: true,
944
991
  vision: true,
945
992
  tools: true,
946
993
  structuredOutput: true,
@@ -950,11 +997,13 @@ var TEXT_MODELS = [
950
997
  text("claude-sonnet-5", "Claude Sonnet 5", "claude-sonnet-5", {
951
998
  exposure: "catalog",
952
999
  display: {
1000
+ chat: { providerOptions: ANTHROPIC_ADAPTIVE },
953
1001
  provider: "anthropic",
954
1002
  costTier: 3,
955
1003
  description: "Anthropic Claude Sonnet 5 current balanced model; text and image input, 1M-token context."
956
1004
  },
957
1005
  capabilities: {
1006
+ reasoning: true,
958
1007
  vision: true,
959
1008
  tools: true,
960
1009
  structuredOutput: true,
@@ -965,11 +1014,13 @@ var TEXT_MODELS = [
965
1014
  exposure: "catalog",
966
1015
  aliases: ["claude-opus-4.8", "claude-opus-4", "claude-opus-4.0", "claude-opus-4-20250514"],
967
1016
  display: {
1017
+ chat: { providerOptions: ANTHROPIC_ADAPTIVE },
968
1018
  provider: "anthropic",
969
1019
  costTier: 3,
970
1020
  description: "Anthropic Claude Opus 4.8 (legacy) frontier model; text and image input, 1M-token context."
971
1021
  },
972
1022
  capabilities: {
1023
+ reasoning: true,
973
1024
  vision: true,
974
1025
  tools: true,
975
1026
  structuredOutput: true,
@@ -980,11 +1031,18 @@ var TEXT_MODELS = [
980
1031
  exposure: "catalog",
981
1032
  aliases: ["claude-haiku-4.5", "claude-haiku-4-5-20251001", "claude-haiku-4"],
982
1033
  display: {
1034
+ chat: { providerOptions: ANTHROPIC_THINKING },
983
1035
  provider: "anthropic",
984
1036
  costTier: 1,
985
1037
  description: "Anthropic Claude Haiku 4.5 fast model with near-frontier intelligence; text and image input, 200K-token context."
986
1038
  },
987
- capabilities: { vision: true, tools: true, structuredOutput: true, contextWindow: 2e5 }
1039
+ capabilities: {
1040
+ reasoning: true,
1041
+ vision: true,
1042
+ tools: true,
1043
+ structuredOutput: true,
1044
+ contextWindow: 2e5
1045
+ }
988
1046
  }),
989
1047
  text("claude-opus-5", "Claude Opus 5", "claude-opus-5", {
990
1048
  exposure: "internal",
@@ -1176,15 +1234,21 @@ var TEXT_MODELS = [
1176
1234
  contextWindow: 128e3
1177
1235
  }
1178
1236
  }),
1179
- text("deepseek-v4-flash", "DeepSeek V4 Flash", "deepseek-v4-flash", {
1237
+ // DeepSeek retired V4 Flash upstream and routes the old id to V4.1 Flash at
1238
+ // Flash rates (https://api-docs.deepseek.com/news/news260910/); the old id
1239
+ // stays an alias so stored selections keep resolving.
1240
+ text("deepseek-flash", "DeepSeek V4.1 Flash", "deepseek-flash", {
1241
+ aliases: ["deepseek-v4-flash"],
1180
1242
  exposure: "catalog",
1181
1243
  display: {
1244
+ chat: { providerOptions: DEEPSEEK_THINKING },
1182
1245
  provider: "deepseek",
1183
1246
  costTier: 1,
1184
1247
  recommended: true,
1185
- description: "DeepSeek V4 Flash thinking/non-thinking model with vision, tool calls, and JSON output; 1M-token context and up to 384K output tokens."
1248
+ description: "DeepSeek V4.1 Flash thinking/non-thinking model with vision, tool calls, and JSON output; 1M-token context and up to 384K output tokens."
1186
1249
  },
1187
1250
  capabilities: {
1251
+ reasoning: true,
1188
1252
  vision: true,
1189
1253
  tools: true,
1190
1254
  structuredOutput: true,
@@ -1194,11 +1258,13 @@ var TEXT_MODELS = [
1194
1258
  text("deepseek-v4-pro", "DeepSeek V4 Pro", "deepseek-v4-pro", {
1195
1259
  exposure: "catalog",
1196
1260
  display: {
1261
+ chat: { providerOptions: DEEPSEEK_THINKING },
1197
1262
  provider: "deepseek",
1198
1263
  costTier: 2,
1199
1264
  description: "DeepSeek V4 Pro thinking/non-thinking text model with tool calls and JSON output (no vision); 1M-token context and up to 384K output tokens."
1200
1265
  },
1201
1266
  capabilities: {
1267
+ reasoning: true,
1202
1268
  vision: false,
1203
1269
  tools: true,
1204
1270
  structuredOutput: true,
@@ -1224,6 +1290,7 @@ var TEXT_MODELS = [
1224
1290
  text("kimi-k2.5", "Kimi K2.5", "kimi-k2.5", {
1225
1291
  exposure: "catalog",
1226
1292
  display: {
1293
+ chat: { temperature: 1 },
1227
1294
  provider: "moonshot",
1228
1295
  costTier: 2,
1229
1296
  description: "Moonshot Kimi K2.5; the provider retired the model on 2026-08-31 and calls now return a model-not-found error."
@@ -1233,11 +1300,13 @@ var TEXT_MODELS = [
1233
1300
  text("kimi-k3", "Kimi K3", "kimi-k3", {
1234
1301
  exposure: "catalog",
1235
1302
  display: {
1303
+ chat: { temperature: 1 },
1236
1304
  provider: "moonshot",
1237
1305
  costTier: 2,
1238
1306
  description: "Moonshot Kimi K3 flagship model with native visual understanding and always-on thinking; text, image, and video input, 1M-token context."
1239
1307
  },
1240
1308
  capabilities: {
1309
+ reasoning: true,
1241
1310
  vision: true,
1242
1311
  tools: true,
1243
1312
  structuredOutput: true,
@@ -1268,7 +1337,8 @@ var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
1268
1337
  var H3_REFERENCE_RATIOS = ["adaptive", ...H3_RATIOS];
1269
1338
  var NEGATIVE_PROMPT = "blur, distort, and low quality";
1270
1339
  var FRAMES_EXCLUDE_REFERENCES = { framesExcludeReferences: true };
1271
- var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
1340
+ var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
1341
+ var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
1272
1342
  var VIDEO_MODELS = [
1273
1343
  {
1274
1344
  id: "veo-3.1",
@@ -1292,12 +1362,12 @@ var VIDEO_MODELS = [
1292
1362
  supports: ["lastFrame"]
1293
1363
  },
1294
1364
  defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
1295
- usage: { ...VIDEO_USAGE },
1365
+ usage: { ...VIDEO_USAGE, slug: "veo" },
1296
1366
  pricingKind: "video_per_second",
1297
1367
  display: {
1298
1368
  provider: "google",
1299
1369
  description: "Google's highest-quality video generation model. Supports up to 4K resolution and 8-second clips with reference image conditioning.",
1300
- logo: GOOGLE_LOGO
1370
+ logo: GOOGLE_LOGO2
1301
1371
  },
1302
1372
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
1303
1373
  },
@@ -1384,12 +1454,12 @@ var VIDEO_MODELS = [
1384
1454
  supports: []
1385
1455
  },
1386
1456
  defaults: {},
1387
- usage: { ...VIDEO_USAGE },
1457
+ usage: { ...VIDEO_USAGE, slug: "gemini_omni" },
1388
1458
  pricingKind: "video_per_second",
1389
1459
  display: {
1390
1460
  provider: "google",
1391
1461
  description: "Google's conversational video model with native audio, human support, and natural language editing. Aspect ratio only \u2014 resolution and duration are model-determined.",
1392
- logo: GOOGLE_LOGO
1462
+ logo: GOOGLE_LOGO2
1393
1463
  },
1394
1464
  capabilities: { acceptsSourceVideo: true }
1395
1465
  },
@@ -1414,6 +1484,7 @@ var VIDEO_MODELS = [
1414
1484
  pricingKind: "video_per_second",
1415
1485
  display: {
1416
1486
  provider: "google",
1487
+ logo: GOOGLE_LOGO2,
1417
1488
  description: "Google Gemini Omni Flash 1.1 conversational video generation and editing; text, image, and up to 10-second video input, 3-10 second output at up to 4K and 24 FPS."
1418
1489
  },
1419
1490
  capabilities: { acceptsSourceVideo: true }
@@ -1443,12 +1514,12 @@ var VIDEO_MODELS = [
1443
1514
  aspectRatio: "16:9",
1444
1515
  generateAudio: true
1445
1516
  },
1446
- usage: { ...VIDEO_USAGE },
1517
+ usage: { ...VIDEO_USAGE, slug: "seedance2", providerLabel: "byteplus" },
1447
1518
  pricingKind: "video_per_second",
1448
1519
  display: {
1449
1520
  provider: "bytedance",
1450
1521
  description: "High-quality AI video generation with reference image conditioning. Supports 4-15 second clips with human preprocessing.",
1451
- logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png"
1522
+ logo: BYTEDANCE_LOGO
1452
1523
  },
1453
1524
  capabilities: { acceptsSourceVideo: true, ...FRAMES_EXCLUDE_REFERENCES }
1454
1525
  },
@@ -1479,6 +1550,7 @@ var VIDEO_MODELS = [
1479
1550
  pricingKind: "video_per_second",
1480
1551
  display: {
1481
1552
  provider: "bytedance",
1553
+ logo: BYTEDANCE_LOGO,
1482
1554
  description: "Speed- and cost-optimized ByteDance Seedance 2.0 Fast; text plus image, video, and audio references to generate or edit 4-15 second clips."
1483
1555
  },
1484
1556
  capabilities: { acceptsSourceVideo: true, ...FRAMES_EXCLUDE_REFERENCES }
@@ -1511,6 +1583,7 @@ var VIDEO_MODELS = [
1511
1583
  pricingKind: "video_per_second",
1512
1584
  display: {
1513
1585
  provider: "bytedance",
1586
+ logo: BYTEDANCE_LOGO,
1514
1587
  description: "ByteDance Seedance 2.5 for long-form storytelling and omni-reference generation/editing; up to 50 reference assets and 4-30 second clips at up to 1080p."
1515
1588
  },
1516
1589
  capabilities: { acceptsSourceVideo: true, ...FRAMES_EXCLUDE_REFERENCES }
@@ -1535,7 +1608,7 @@ var VIDEO_MODELS = [
1535
1608
  },
1536
1609
  // No resolution default: xAI picks its own unless the caller asks.
1537
1610
  defaults: { durationSeconds: 8, aspectRatio: "16:9" },
1538
- usage: { unit: "reported_cost_usd", modality: "VIDEO" },
1611
+ usage: { unit: "reported_cost_usd", modality: "VIDEO", slug: "grok" },
1539
1612
  pricingKind: "video_per_second",
1540
1613
  display: {
1541
1614
  provider: "xai",
@@ -2016,6 +2089,40 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
2016
2089
  model: model.id
2017
2090
  });
2018
2091
  }
2092
+ if (merged.sourceVideo !== void 0 && !model.capabilities?.acceptsSourceVideo) {
2093
+ if (onUnsupported === "error") {
2094
+ throw new ModelKitError({
2095
+ code: "unsupported_option",
2096
+ message: `${model.id} does not take a source video`,
2097
+ model: model.id
2098
+ });
2099
+ }
2100
+ warnings.push({
2101
+ code: "option_ignored",
2102
+ field: "sourceVideo",
2103
+ message: `${model.id} does not take a source video; dropped`
2104
+ });
2105
+ delete merged.sourceVideo;
2106
+ }
2107
+ const hasFrames = merged.firstFrame !== void 0 || merged.lastFrame !== void 0;
2108
+ const hasRefs = compact(merged.referenceImages).length + compact(merged.referenceVideos).length + compact(merged.referenceAudios).length > 0;
2109
+ if (hasFrames && hasRefs && model.capabilities?.framesExcludeReferences) {
2110
+ if (onUnsupported === "error") {
2111
+ throw new ModelKitError({
2112
+ code: "unsupported_option",
2113
+ message: `${model.id} takes frames or references, not both`,
2114
+ model: model.id
2115
+ });
2116
+ }
2117
+ warnings.push({
2118
+ code: "option_ignored",
2119
+ field: "referenceImages",
2120
+ message: `${model.id} takes frames or references, not both; references dropped`
2121
+ });
2122
+ delete merged.referenceImages;
2123
+ delete merged.referenceVideos;
2124
+ delete merged.referenceAudios;
2125
+ }
2019
2126
  for (const input of c.ratioIgnoredWith ?? []) {
2020
2127
  if (merged[input] !== void 0 && merged.aspectRatio !== void 0) {
2021
2128
  if (request.aspectRatio !== void 0) {