@shop-os/modelkit 0.1.8 → 0.1.9

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",
@@ -796,6 +823,14 @@ function text(id, label, providerModelId, extra) {
796
823
  ...extra
797
824
  };
798
825
  }
826
+ var ANTHROPIC_THINKING = {
827
+ anthropic: { thinking: { type: "enabled", budgetTokens: 4e3 }, sendReasoning: true }
828
+ };
829
+ var ANTHROPIC_ADAPTIVE = {
830
+ anthropic: { thinking: { type: "adaptive", display: "summarized" }, sendReasoning: true }
831
+ };
832
+ var OPENAI_REASONING = { openai: { reasoningEffort: "medium", reasoningSummary: "auto" } };
833
+ var DEEPSEEK_THINKING = { deepseek: { thinking: { type: "enabled" } } };
799
834
  var TEXT_MODELS = [
800
835
  text("gpt-4o", "GPT-4o", "gpt-4o", {
801
836
  exposure: "internal",
@@ -874,6 +909,7 @@ var TEXT_MODELS = [
874
909
  }
875
910
  }),
876
911
  text("gpt-5.6-luna", "GPT-5.6 Luna", "gpt-5.6-luna", {
912
+ providerOptions: OPENAI_REASONING,
877
913
  exposure: "catalog",
878
914
  display: {
879
915
  provider: "openai",
@@ -881,6 +917,7 @@ var TEXT_MODELS = [
881
917
  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
918
  },
883
919
  capabilities: {
920
+ reasoning: true,
884
921
  vision: true,
885
922
  tools: true,
886
923
  structuredOutput: true,
@@ -888,6 +925,7 @@ var TEXT_MODELS = [
888
925
  }
889
926
  }),
890
927
  text("gpt-5.6-terra", "GPT-5.6 Terra", "gpt-5.6-terra", {
928
+ providerOptions: OPENAI_REASONING,
891
929
  exposure: "catalog",
892
930
  display: {
893
931
  provider: "openai",
@@ -895,6 +933,7 @@ var TEXT_MODELS = [
895
933
  description: "OpenAI GPT-5.6 Terra balanced tier of the GPT-5.6 reasoning family; text and image input, 1.05M-token context."
896
934
  },
897
935
  capabilities: {
936
+ reasoning: true,
898
937
  vision: true,
899
938
  tools: true,
900
939
  structuredOutput: true,
@@ -902,6 +941,7 @@ var TEXT_MODELS = [
902
941
  }
903
942
  }),
904
943
  text("gpt-5.6-sol", "GPT-5.6 Sol", "gpt-5.6-sol", {
944
+ providerOptions: OPENAI_REASONING,
905
945
  exposure: "catalog",
906
946
  display: {
907
947
  provider: "openai",
@@ -909,6 +949,7 @@ var TEXT_MODELS = [
909
949
  description: "OpenAI GPT-5.6 Sol flagship tier of the GPT-5.6 reasoning family; text and image input, 1.05M-token context."
910
950
  },
911
951
  capabilities: {
952
+ reasoning: true,
912
953
  vision: true,
913
954
  tools: true,
914
955
  structuredOutput: true,
@@ -928,6 +969,7 @@ var TEXT_MODELS = [
928
969
  }),
929
970
  // Anthropic retired the dated 4.0 ids; callers that still send them get 4.6.
930
971
  text("claude-sonnet-4-6", "Claude Sonnet 4.6", "claude-sonnet-4-6", {
972
+ providerOptions: ANTHROPIC_THINKING,
931
973
  exposure: "catalog",
932
974
  aliases: [
933
975
  "claude-sonnet-4.6",
@@ -941,6 +983,7 @@ var TEXT_MODELS = [
941
983
  description: "Anthropic Claude Sonnet 4.6 (legacy) balanced model; text and image input, 1M-token context."
942
984
  },
943
985
  capabilities: {
986
+ reasoning: true,
944
987
  vision: true,
945
988
  tools: true,
946
989
  structuredOutput: true,
@@ -948,6 +991,7 @@ var TEXT_MODELS = [
948
991
  }
949
992
  }),
950
993
  text("claude-sonnet-5", "Claude Sonnet 5", "claude-sonnet-5", {
994
+ providerOptions: ANTHROPIC_ADAPTIVE,
951
995
  exposure: "catalog",
952
996
  display: {
953
997
  provider: "anthropic",
@@ -955,6 +999,7 @@ var TEXT_MODELS = [
955
999
  description: "Anthropic Claude Sonnet 5 current balanced model; text and image input, 1M-token context."
956
1000
  },
957
1001
  capabilities: {
1002
+ reasoning: true,
958
1003
  vision: true,
959
1004
  tools: true,
960
1005
  structuredOutput: true,
@@ -962,6 +1007,7 @@ var TEXT_MODELS = [
962
1007
  }
963
1008
  }),
964
1009
  text("claude-opus-4-8", "Claude Opus 4.8", "claude-opus-4-8", {
1010
+ providerOptions: ANTHROPIC_ADAPTIVE,
965
1011
  exposure: "catalog",
966
1012
  aliases: ["claude-opus-4.8", "claude-opus-4", "claude-opus-4.0", "claude-opus-4-20250514"],
967
1013
  display: {
@@ -970,6 +1016,7 @@ var TEXT_MODELS = [
970
1016
  description: "Anthropic Claude Opus 4.8 (legacy) frontier model; text and image input, 1M-token context."
971
1017
  },
972
1018
  capabilities: {
1019
+ reasoning: true,
973
1020
  vision: true,
974
1021
  tools: true,
975
1022
  structuredOutput: true,
@@ -977,6 +1024,7 @@ var TEXT_MODELS = [
977
1024
  }
978
1025
  }),
979
1026
  text("claude-haiku-4-5", "Claude Haiku 4.5", "claude-haiku-4-5", {
1027
+ providerOptions: ANTHROPIC_THINKING,
980
1028
  exposure: "catalog",
981
1029
  aliases: ["claude-haiku-4.5", "claude-haiku-4-5-20251001", "claude-haiku-4"],
982
1030
  display: {
@@ -984,7 +1032,13 @@ var TEXT_MODELS = [
984
1032
  costTier: 1,
985
1033
  description: "Anthropic Claude Haiku 4.5 fast model with near-frontier intelligence; text and image input, 200K-token context."
986
1034
  },
987
- capabilities: { vision: true, tools: true, structuredOutput: true, contextWindow: 2e5 }
1035
+ capabilities: {
1036
+ reasoning: true,
1037
+ vision: true,
1038
+ tools: true,
1039
+ structuredOutput: true,
1040
+ contextWindow: 2e5
1041
+ }
988
1042
  }),
989
1043
  text("claude-opus-5", "Claude Opus 5", "claude-opus-5", {
990
1044
  exposure: "internal",
@@ -1176,15 +1230,21 @@ var TEXT_MODELS = [
1176
1230
  contextWindow: 128e3
1177
1231
  }
1178
1232
  }),
1179
- text("deepseek-v4-flash", "DeepSeek V4 Flash", "deepseek-v4-flash", {
1233
+ // DeepSeek retired V4 Flash upstream and routes the old id to V4.1 Flash at
1234
+ // Flash rates (https://api-docs.deepseek.com/news/news260910/); the old id
1235
+ // stays an alias so stored selections keep resolving.
1236
+ text("deepseek-flash", "DeepSeek V4.1 Flash", "deepseek-flash", {
1237
+ providerOptions: DEEPSEEK_THINKING,
1238
+ aliases: ["deepseek-v4-flash"],
1180
1239
  exposure: "catalog",
1181
1240
  display: {
1182
1241
  provider: "deepseek",
1183
1242
  costTier: 1,
1184
1243
  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."
1244
+ 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
1245
  },
1187
1246
  capabilities: {
1247
+ reasoning: true,
1188
1248
  vision: true,
1189
1249
  tools: true,
1190
1250
  structuredOutput: true,
@@ -1192,6 +1252,7 @@ var TEXT_MODELS = [
1192
1252
  }
1193
1253
  }),
1194
1254
  text("deepseek-v4-pro", "DeepSeek V4 Pro", "deepseek-v4-pro", {
1255
+ providerOptions: DEEPSEEK_THINKING,
1195
1256
  exposure: "catalog",
1196
1257
  display: {
1197
1258
  provider: "deepseek",
@@ -1199,6 +1260,7 @@ var TEXT_MODELS = [
1199
1260
  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
1261
  },
1201
1262
  capabilities: {
1263
+ reasoning: true,
1202
1264
  vision: false,
1203
1265
  tools: true,
1204
1266
  structuredOutput: true,
@@ -1222,6 +1284,7 @@ var TEXT_MODELS = [
1222
1284
  }),
1223
1285
  // Moonshot retired kimi-k2.5 on 2026-08-31 and no longer publishes its specs.
1224
1286
  text("kimi-k2.5", "Kimi K2.5", "kimi-k2.5", {
1287
+ defaults: { temperature: 1 },
1225
1288
  exposure: "catalog",
1226
1289
  display: {
1227
1290
  provider: "moonshot",
@@ -1231,6 +1294,7 @@ var TEXT_MODELS = [
1231
1294
  capabilities: {}
1232
1295
  }),
1233
1296
  text("kimi-k3", "Kimi K3", "kimi-k3", {
1297
+ defaults: { temperature: 1 },
1234
1298
  exposure: "catalog",
1235
1299
  display: {
1236
1300
  provider: "moonshot",
@@ -1238,6 +1302,7 @@ var TEXT_MODELS = [
1238
1302
  description: "Moonshot Kimi K3 flagship model with native visual understanding and always-on thinking; text, image, and video input, 1M-token context."
1239
1303
  },
1240
1304
  capabilities: {
1305
+ reasoning: true,
1241
1306
  vision: true,
1242
1307
  tools: true,
1243
1308
  structuredOutput: true,
@@ -1292,7 +1357,7 @@ var VIDEO_MODELS = [
1292
1357
  supports: ["lastFrame"]
1293
1358
  },
1294
1359
  defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
1295
- usage: { ...VIDEO_USAGE },
1360
+ usage: { ...VIDEO_USAGE, slug: "veo" },
1296
1361
  pricingKind: "video_per_second",
1297
1362
  display: {
1298
1363
  provider: "google",
@@ -1384,7 +1449,7 @@ var VIDEO_MODELS = [
1384
1449
  supports: []
1385
1450
  },
1386
1451
  defaults: {},
1387
- usage: { ...VIDEO_USAGE },
1452
+ usage: { ...VIDEO_USAGE, slug: "gemini_omni" },
1388
1453
  pricingKind: "video_per_second",
1389
1454
  display: {
1390
1455
  provider: "google",
@@ -1443,7 +1508,7 @@ var VIDEO_MODELS = [
1443
1508
  aspectRatio: "16:9",
1444
1509
  generateAudio: true
1445
1510
  },
1446
- usage: { ...VIDEO_USAGE },
1511
+ usage: { ...VIDEO_USAGE, slug: "seedance2", providerLabel: "byteplus" },
1447
1512
  pricingKind: "video_per_second",
1448
1513
  display: {
1449
1514
  provider: "bytedance",
@@ -1565,7 +1630,7 @@ var VIDEO_MODELS = [
1565
1630
  cfgScale: 0.5,
1566
1631
  negativePrompt: NEGATIVE_PROMPT
1567
1632
  },
1568
- usage: { ...VIDEO_USAGE },
1633
+ usage: { ...VIDEO_USAGE, slug: "grok" },
1569
1634
  pricingKind: "video_per_second",
1570
1635
  display: {
1571
1636
  provider: "kuaishou",
@@ -2016,6 +2081,40 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
2016
2081
  model: model.id
2017
2082
  });
2018
2083
  }
2084
+ if (merged.sourceVideo !== void 0 && !model.capabilities?.acceptsSourceVideo) {
2085
+ if (onUnsupported === "error") {
2086
+ throw new ModelKitError({
2087
+ code: "unsupported_option",
2088
+ message: `${model.id} does not take a source video`,
2089
+ model: model.id
2090
+ });
2091
+ }
2092
+ warnings.push({
2093
+ code: "option_ignored",
2094
+ field: "sourceVideo",
2095
+ message: `${model.id} does not take a source video; dropped`
2096
+ });
2097
+ delete merged.sourceVideo;
2098
+ }
2099
+ const hasFrames = merged.firstFrame !== void 0 || merged.lastFrame !== void 0;
2100
+ const hasRefs = compact(merged.referenceImages).length + compact(merged.referenceVideos).length + compact(merged.referenceAudios).length > 0;
2101
+ if (hasFrames && hasRefs && model.capabilities?.framesExcludeReferences) {
2102
+ if (onUnsupported === "error") {
2103
+ throw new ModelKitError({
2104
+ code: "unsupported_option",
2105
+ message: `${model.id} takes frames or references, not both`,
2106
+ model: model.id
2107
+ });
2108
+ }
2109
+ warnings.push({
2110
+ code: "option_ignored",
2111
+ field: "referenceImages",
2112
+ message: `${model.id} takes frames or references, not both; references dropped`
2113
+ });
2114
+ delete merged.referenceImages;
2115
+ delete merged.referenceVideos;
2116
+ delete merged.referenceAudios;
2117
+ }
2019
2118
  for (const input of c.ratioIgnoredWith ?? []) {
2020
2119
  if (merged[input] !== void 0 && merged.aspectRatio !== void 0) {
2021
2120
  if (request.aspectRatio !== void 0) {