@howells/motif-sdk 7.1.0 → 7.3.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.
package/dist/registry.js CHANGED
@@ -26,6 +26,25 @@ const FAL_PRESET_SIZES = {
26
26
  width: 1024
27
27
  }
28
28
  };
29
+ // src/errors.ts
30
+ /** `MotifError` and the fal HTTP error mapping. */
31
+ var MotifError = class extends Error {
32
+ status;
33
+ code;
34
+ /** fal's request-correlation id (from the `x-fal-request-id` header or the
35
+ * error body). Ties a failure back to fal's dashboard/support. */
36
+ requestId;
37
+ /** Structured context for the failure, e.g. the refused field. */
38
+ details;
39
+ constructor(message, status, code, requestId, details) {
40
+ super(message);
41
+ this.name = "MotifError";
42
+ this.status = status;
43
+ this.code = code;
44
+ this.requestId = requestId;
45
+ this.details = details;
46
+ }
47
+ };
29
48
  // src/models.ts
30
49
  const AA_IMAGE_LEADERBOARD_SNAPSHOT = "2026-10-07";
31
50
  const AA_IMAGE_SOURCES = ["https://artificialanalysis.ai/image/leaderboard/text-to-image", "https://artificialanalysis.ai/image/leaderboard/editing"];
@@ -72,6 +91,8 @@ const MODELS = {
72
91
  maskImageField: "mask_url",
73
92
  supportsMarkupImage: true,
74
93
  autoEditSize: true,
94
+ maxCount: 10,
95
+ singleImageFormats: ["svg"],
75
96
  supportsNumImages: true,
76
97
  supportsOutputFormat: true,
77
98
  supportedOutputFormats: [
@@ -96,7 +117,7 @@ const MODELS = {
96
117
  "xhigh",
97
118
  "max"
98
119
  ],
99
- supportsResolution: false,
120
+ supportsResolution: true,
100
121
  supportsSyncMode: true,
101
122
  type: "generation",
102
123
  useQueue: true
@@ -139,6 +160,8 @@ const MODELS = {
139
160
  maskImageField: "mask_url",
140
161
  supportsMarkupImage: true,
141
162
  autoEditSize: true,
163
+ maxCount: 10,
164
+ singleImageFormats: ["svg"],
142
165
  supportsNumImages: true,
143
166
  supportsOutputFormat: true,
144
167
  supportedOutputFormats: [
@@ -163,7 +186,7 @@ const MODELS = {
163
186
  "xhigh",
164
187
  "max"
165
188
  ],
166
- supportsResolution: false,
189
+ supportsResolution: true,
167
190
  supportsSyncMode: true,
168
191
  type: "generation",
169
192
  useQueue: true
@@ -210,6 +233,12 @@ const MODELS = {
210
233
  pricePerImageUsd: .133,
211
234
  pricing: "$0.133",
212
235
  sizeMode: "gpt_size",
236
+ supportedAspects: [
237
+ "auto",
238
+ "1:1",
239
+ "3:2",
240
+ "2:3"
241
+ ],
213
242
  supportsAspect: false,
214
243
  supportsBackground: true,
215
244
  streaming: {
@@ -218,6 +247,7 @@ const MODELS = {
218
247
  },
219
248
  supportsEdit: true,
220
249
  supportsMaskImage: true,
250
+ maxCount: 4,
221
251
  supportsNumImages: true,
222
252
  supportsOutputFormat: true,
223
253
  supportsQuality: true,
@@ -259,6 +289,7 @@ const MODELS = {
259
289
  supportsAspect: true,
260
290
  supportsEdit: true,
261
291
  supportsLimitGenerations: true,
292
+ maxCount: 4,
262
293
  supportsNumImages: true,
263
294
  supportsOutputFormat: true,
264
295
  supportsResolution: true,
@@ -304,6 +335,7 @@ const MODELS = {
304
335
  ],
305
336
  supportsAspect: true,
306
337
  supportsEdit: true,
338
+ maxCount: 4,
307
339
  supportsNumImages: true,
308
340
  supportsOutputFormat: true,
309
341
  supportsResolution: false,
@@ -351,6 +383,7 @@ const MODELS = {
351
383
  supportsEdit: true,
352
384
  supportsGoogleSearch: true,
353
385
  supportsLimitGenerations: true,
386
+ maxCount: 4,
354
387
  supportsNumImages: true,
355
388
  supportsOutputFormat: true,
356
389
  supportsResolution: true,
@@ -425,6 +458,7 @@ const MODELS = {
425
458
  supportsEdit: true,
426
459
  supportsGoogleSearch: true,
427
460
  supportsLimitGenerations: true,
461
+ maxCount: 4,
428
462
  supportsNumImages: true,
429
463
  supportsOutputFormat: true,
430
464
  supportsResolution: true,
@@ -471,6 +505,7 @@ const MODELS = {
471
505
  supportsAspect: true,
472
506
  supportsResolution: false,
473
507
  supportsEdit: true,
508
+ maxCount: 6,
474
509
  supportsNumImages: true,
475
510
  supportsSeed: true,
476
511
  supportsSyncMode: true,
@@ -512,6 +547,7 @@ const MODELS = {
512
547
  supportsAspect: true,
513
548
  supportsResolution: false,
514
549
  supportsEdit: true,
550
+ maxCount: 6,
515
551
  supportsNumImages: true,
516
552
  supportsSeed: true,
517
553
  supportsSyncMode: true,
@@ -660,6 +696,7 @@ const MODELS = {
660
696
  supportsAspect: true,
661
697
  supportsEdit: false,
662
698
  supportsGuidanceScale: true,
699
+ maxCount: 4,
663
700
  supportsNumImages: true,
664
701
  supportsOutputFormat: true,
665
702
  supportsResolution: false,
@@ -700,6 +737,7 @@ const MODELS = {
700
737
  supportsAspect: true,
701
738
  supportsResolution: false,
702
739
  supportsEdit: false,
740
+ maxCount: 4,
703
741
  supportsNumImages: true,
704
742
  supportsRenderingSpeed: true,
705
743
  supportsSeed: true,
@@ -745,6 +783,7 @@ const MODELS = {
745
783
  unit: "images",
746
784
  unitPrice: .02
747
785
  },
786
+ lowercaseResolution: true,
748
787
  maxReferenceImages: 3,
749
788
  name: "Grok Imagine Image",
750
789
  pricePerImageUsd: .02,
@@ -762,6 +801,7 @@ const MODELS = {
762
801
  supportedResolutions: ["1K", "2K"],
763
802
  supportsAspect: true,
764
803
  supportsEdit: true,
804
+ maxCount: 4,
765
805
  supportsNumImages: true,
766
806
  supportsOutputFormat: true,
767
807
  supportsResolution: true,
@@ -812,6 +852,7 @@ const MODELS = {
812
852
  supportsAspect: true,
813
853
  supportsEdit: true,
814
854
  supportsNegativePrompt: true,
855
+ maxCount: 6,
815
856
  supportsNumImages: true,
816
857
  supportsOutputFormat: true,
817
858
  supportsResolution: false,
@@ -864,6 +905,7 @@ const MODELS = {
864
905
  ],
865
906
  supportsAspect: true,
866
907
  supportsEdit: true,
908
+ maxCount: 4,
867
909
  supportsNumImages: true,
868
910
  supportsOutputFormat: true,
869
911
  supportsResolution: false,
@@ -893,6 +935,7 @@ const MODELS = {
893
935
  supportsAspect: true,
894
936
  supportsEdit: true,
895
937
  supportsLimitGenerations: true,
938
+ maxCount: 4,
896
939
  supportsNumImages: true,
897
940
  supportsOutputFormat: true,
898
941
  supportsResolution: false,
@@ -917,6 +960,7 @@ const MODELS = {
917
960
  pricePerImageUsd: .06,
918
961
  pricing: "$0.03 TURBO / $0.06 BALANCED / $0.09 QUALITY",
919
962
  sizeMode: "aspect_ratio",
963
+ fixedOutputFormat: "png",
920
964
  supportedAspects: [
921
965
  "16:9",
922
966
  "9:16",
@@ -932,6 +976,7 @@ const MODELS = {
932
976
  supportsEdit: false,
933
977
  supportsExpandPrompt: true,
934
978
  supportsNegativePrompt: true,
979
+ maxCount: 8,
935
980
  supportsNumImages: true,
936
981
  supportsRenderingSpeed: true,
937
982
  supportsResolution: false,
@@ -990,6 +1035,7 @@ const MODELS = {
990
1035
  unit: "images",
991
1036
  unitPrice: .06
992
1037
  },
1038
+ lowercaseResolution: true,
993
1039
  maxReferenceImages: 3,
994
1040
  name: "Grok Imagine Image 2.0",
995
1041
  pricePerImageUsd: .06,
@@ -1007,6 +1053,7 @@ const MODELS = {
1007
1053
  supportedResolutions: ["1K", "2K"],
1008
1054
  supportsAspect: true,
1009
1055
  supportsEdit: true,
1056
+ maxCount: 10,
1010
1057
  supportsNumImages: true,
1011
1058
  supportsOutputFormat: true,
1012
1059
  supportsResolution: true,
@@ -1049,6 +1096,7 @@ const MODELS = {
1049
1096
  ],
1050
1097
  supportsAspect: true,
1051
1098
  supportsEdit: true,
1099
+ maxCount: 10,
1052
1100
  supportsNumImages: true,
1053
1101
  supportsOutputFormat: true,
1054
1102
  supportsResolution: false,
@@ -1104,6 +1152,7 @@ const MODELS = {
1104
1152
  unit: "images",
1105
1153
  unitPrice: .05
1106
1154
  },
1155
+ lowercaseResolution: true,
1107
1156
  maxReferenceImages: 3,
1108
1157
  name: "Grok Imagine Image Quality",
1109
1158
  pricePerImageUsd: .05,
@@ -1121,6 +1170,7 @@ const MODELS = {
1121
1170
  supportedResolutions: ["1K", "2K"],
1122
1171
  supportsAspect: true,
1123
1172
  supportsEdit: true,
1173
+ maxCount: 4,
1124
1174
  supportsNumImages: true,
1125
1175
  supportsOutputFormat: true,
1126
1176
  supportsResolution: true,
@@ -1129,40 +1179,79 @@ const MODELS = {
1129
1179
  },
1130
1180
  kling: {
1131
1181
  endpoint: "fal-ai/kling-video/v3/pro/image-to-video",
1182
+ generatesAudio: true,
1132
1183
  name: "Kling v3 Pro",
1184
+ outputKeys: ["video"],
1185
+ price: {
1186
+ audioUsd: .168,
1187
+ kind: "output-second",
1188
+ usd: .112
1189
+ },
1133
1190
  pricing: "$0.11/sec",
1134
1191
  sizeMode: "none",
1192
+ startFrameField: "start_image_url",
1135
1193
  supportsAspect: false,
1136
1194
  supportsEdit: false,
1137
1195
  supportsNumImages: false,
1138
1196
  supportsResolution: false,
1139
- type: "video"
1197
+ type: "video",
1198
+ useQueue: true
1140
1199
  },
1141
1200
  "kling-turbo": {
1142
1201
  endpoint: "fal-ai/kling-video/v3/turbo/pro/image-to-video",
1143
1202
  name: "Kling v3 Turbo Pro",
1203
+ outputKeys: ["video"],
1204
+ price: {
1205
+ kind: "output-second",
1206
+ usd: .14
1207
+ },
1144
1208
  pricing: "$0.14/sec",
1145
1209
  sizeMode: "none",
1210
+ startFrameField: "image_url",
1146
1211
  supportsAspect: false,
1147
1212
  supportsEdit: false,
1148
1213
  supportsNumImages: false,
1149
1214
  supportsResolution: false,
1150
- type: "video"
1215
+ type: "video",
1216
+ useQueue: true
1151
1217
  },
1152
1218
  clarity: {
1219
+ defaultScale: 2,
1153
1220
  endpoint: "fal-ai/clarity-upscaler",
1154
1221
  name: "Clarity Upscaler",
1222
+ outputKeys: ["image"],
1223
+ price: {
1224
+ kind: "megapixel",
1225
+ usd: .03
1226
+ },
1155
1227
  pricing: "$0.03/MP",
1228
+ scaleField: "upscale_factor",
1229
+ scaleRange: {
1230
+ max: 4,
1231
+ min: 1
1232
+ },
1156
1233
  supportsAspect: false,
1157
1234
  supportsEdit: false,
1158
1235
  supportsNumImages: false,
1236
+ supportsPrompt: true,
1159
1237
  supportsResolution: false,
1160
1238
  type: "utility"
1161
1239
  },
1162
1240
  crystal: {
1241
+ defaultScale: 2,
1163
1242
  endpoint: "clarityai/crystal-upscaler",
1164
1243
  name: "Crystal Upscaler",
1165
- pricing: "$0.02",
1244
+ outputKeys: ["image"],
1245
+ price: {
1246
+ kind: "megapixel",
1247
+ usd: .016
1248
+ },
1249
+ pricing: "$0.016/MP of output",
1250
+ scaleField: "scale_factor",
1251
+ scaleRange: {
1252
+ max: 200,
1253
+ min: 1
1254
+ },
1166
1255
  supportsAspect: false,
1167
1256
  supportsEdit: false,
1168
1257
  supportsNumImages: false,
@@ -1170,55 +1259,27 @@ const MODELS = {
1170
1259
  type: "utility"
1171
1260
  }
1172
1261
  };
1173
- [
1174
- "sunburst",
1175
- "flare",
1176
- "gpt",
1177
- "banana21",
1178
- "banana2",
1179
- "banana",
1180
- "mai-image-2.5",
1181
- "mai-image-2.5-pro",
1182
- "seedream5",
1183
- "qwen3",
1184
- "banana2-lite",
1185
- "grok-image-2",
1186
- "grok-image-quality",
1187
- "grok-image",
1188
- "muse-image",
1189
- "krea3",
1190
- "flux2-flex",
1191
- "flux2-pro",
1192
- "flux2-turbo",
1193
- "seedream5-lite",
1194
- "ideogram4",
1195
- "ideogram3-transparent",
1196
- "recraft41"
1197
- ].filter((id) => MODELS[id]?.supportsEdit === true);
1262
+ Object.keys(MODELS).filter((id) => MODELS[id]?.type === "generation");
1198
1263
  // src/cost.ts
1199
1264
  /**
1200
1265
  * Estimate cost based on model and settings. `editImages` is the number of
1201
1266
  * input images on an edit, for Models whose edits cost more than generation.
1267
+ * Null for a token-metered Model; throws for an id with no per-image price.
1202
1268
  */
1203
1269
  function estimateCost(model, resolution, numImages = 1, editImages = 0) {
1204
- const configuredPrice = MODELS[model]?.pricePerImageUsd;
1270
+ const config = MODELS[model];
1271
+ if (config === void 0) throw new MotifError(`Unknown Model: ${model}`, 0, "UNKNOWN_MODEL");
1272
+ const configuredPrice = config.pricePerImageUsd;
1205
1273
  if (configuredPrice === null) return null;
1274
+ if (configuredPrice === void 0) throw new MotifError(`${model} has no per-image price`, 0);
1206
1275
  if (model === "mai-image-2.5-pro" && editImages > 0) return .27 * numImages;
1207
1276
  if (model === "grok-image-2" && editImages > 0) return (resolution === "2K" || resolution === "4K" ? .08 : .06) * numImages + .01 * editImages;
1208
1277
  if (model === "grok-image-quality") return (resolution === "2K" || resolution === "4K" ? .07 : .05) * numImages + .01 * editImages;
1209
- if (configuredPrice !== void 0) {
1210
- if (model === "banana" && resolution === "4K") return configuredPrice * 2 * numImages;
1211
- if (model === "seedream5" && (resolution === "2K" || resolution === "4K")) return configuredPrice * 2 * numImages;
1212
- if (model === "grok-image-2" && (resolution === "2K" || resolution === "4K")) return .08 * numImages;
1213
- if (model === "banana2") return configuredPrice * (resolution === "4K" ? 2 : resolution === "2K" ? 1.5 : resolution === "0.5K" ? .75 : 1) * numImages;
1214
- return configuredPrice * numImages;
1215
- }
1216
- switch (model) {
1217
- case "gpt": return .133 * numImages;
1218
- case "clarity": return .03 * numImages;
1219
- case "crystal": return .02 * numImages;
1220
- default: return .1 * numImages;
1221
- }
1278
+ if (model === "banana" && resolution === "4K") return configuredPrice * 2 * numImages;
1279
+ if (model === "seedream5" && (resolution === "2K" || resolution === "4K")) return configuredPrice * 2 * numImages;
1280
+ if (model === "grok-image-2" && (resolution === "2K" || resolution === "4K")) return .08 * numImages;
1281
+ if (model === "banana2") return configuredPrice * (resolution === "4K" ? 2 : resolution === "2K" ? 1.5 : resolution === "0.5K" ? .75 : 1) * numImages;
1282
+ return configuredPrice * numImages;
1222
1283
  }
1223
1284
  // src/tool-registry/analysis.ts
1224
1285
  const ANALYSIS_TOOLS = {
@@ -1596,6 +1657,7 @@ const ASSET_TOOLS = {
1596
1657
  price: { kind: "metered" },
1597
1658
  pricing: "$0.02 per unit; fal does not define a unit, and this endpoint returns one mesh per detected object, so no estimate is reported",
1598
1659
  queued: true,
1660
+ requiredPrompt: "a prompt naming the objects",
1599
1661
  sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects",
1600
1662
  task: "single-image 3D object reconstruction"
1601
1663
  },
@@ -1631,6 +1693,10 @@ const ASSET_TOOLS = {
1631
1693
  },
1632
1694
  pricing: "$0.0025/megapixel",
1633
1695
  queued: true,
1696
+ scaleRange: {
1697
+ max: 10,
1698
+ min: 1
1699
+ },
1634
1700
  sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless",
1635
1701
  task: "seamless texture upscaling"
1636
1702
  },
@@ -1675,7 +1741,6 @@ const BACKGROUND_TOOLS = {
1675
1741
  defaultOptions: {
1676
1742
  model: "General Use (Light)",
1677
1743
  operating_resolution: "1024x1024",
1678
- output_format: "png",
1679
1744
  refine_foreground: true
1680
1745
  },
1681
1746
  description: "High-resolution dichotomous image segmentation and background removal.",
@@ -1803,7 +1868,6 @@ const BACKGROUND_TOOLS = {
1803
1868
  },
1804
1869
  "seedvr-upscale": {
1805
1870
  category: "restoration",
1806
- defaultOptions: { output_format: "png" },
1807
1871
  description: "Diffusion image restoration and upscaling with SeedVR.",
1808
1872
  endpoint: "fal-ai/seedvr/upscale/image",
1809
1873
  inputField: "image_url",
@@ -1816,12 +1880,15 @@ const BACKGROUND_TOOLS = {
1816
1880
  },
1817
1881
  pricing: "$0.001/megapixel",
1818
1882
  queued: true,
1883
+ scaleRange: {
1884
+ max: 10,
1885
+ min: 1
1886
+ },
1819
1887
  sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image",
1820
1888
  task: "image restoration and upscaling"
1821
1889
  },
1822
1890
  "topaz-adjust": {
1823
1891
  category: "restoration",
1824
- defaultOptions: { output_format: "png" },
1825
1892
  description: "Topaz exposure, white balance, and colour adjustment.",
1826
1893
  endpoint: "topaz/adjust/image",
1827
1894
  inputField: "image_url",
@@ -1840,7 +1907,6 @@ const BACKGROUND_TOOLS = {
1840
1907
  },
1841
1908
  "topaz-creative": {
1842
1909
  category: "restoration",
1843
- defaultOptions: { output_format: "png" },
1844
1910
  description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.",
1845
1911
  endpoint: "topaz/upscale/image/creative",
1846
1912
  inputField: "image_url",
@@ -1854,12 +1920,15 @@ const BACKGROUND_TOOLS = {
1854
1920
  },
1855
1921
  pricing: "$0.08 per started 2 output megapixels, any Bloom model",
1856
1922
  queued: true,
1923
+ scaleRange: {
1924
+ max: 4,
1925
+ min: 1
1926
+ },
1857
1927
  sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative",
1858
1928
  task: "creative image upscaling"
1859
1929
  },
1860
1930
  "topaz-denoise": {
1861
1931
  category: "restoration",
1862
- defaultOptions: { output_format: "png" },
1863
1932
  description: "Topaz noise reduction at source resolution.",
1864
1933
  endpoint: "topaz/denoise/image",
1865
1934
  inputField: "image_url",
@@ -1878,7 +1947,6 @@ const BACKGROUND_TOOLS = {
1878
1947
  },
1879
1948
  "topaz-generative": {
1880
1949
  category: "restoration",
1881
- defaultOptions: { output_format: "png" },
1882
1950
  description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.",
1883
1951
  endpoint: "topaz/upscale/image/generative",
1884
1952
  inputField: "image_url",
@@ -1892,6 +1960,10 @@ const BACKGROUND_TOOLS = {
1892
1960
  },
1893
1961
  pricing: "$0.08 per started 8 output megapixels at the default Wonder 3; per started 4 with Wonder, Wonder 2, Standard MAX, Redefine or Recover 3",
1894
1962
  queued: true,
1963
+ scaleRange: {
1964
+ max: 4,
1965
+ min: 1
1966
+ },
1895
1967
  sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative",
1896
1968
  task: "generative image upscaling"
1897
1969
  },
@@ -1899,7 +1971,6 @@ const BACKGROUND_TOOLS = {
1899
1971
  category: "upscale",
1900
1972
  defaultOptions: {
1901
1973
  model: "Standard V2",
1902
- output_format: "jpeg",
1903
1974
  upscale_factor: 2
1904
1975
  },
1905
1976
  description: "Professional Topaz image enhancement and upscaling.",
@@ -1915,12 +1986,15 @@ const BACKGROUND_TOOLS = {
1915
1986
  },
1916
1987
  pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP",
1917
1988
  queued: true,
1989
+ scaleRange: {
1990
+ max: 4,
1991
+ min: 1
1992
+ },
1918
1993
  sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image",
1919
1994
  task: "image enhancement"
1920
1995
  },
1921
1996
  "topaz-precision": {
1922
1997
  category: "restoration",
1923
- defaultOptions: { output_format: "png" },
1924
1998
  description: "Topaz upscaling that preserves the original detail rather than inventing it.",
1925
1999
  endpoint: "topaz/upscale/image/precision",
1926
2000
  inputField: "image_url",
@@ -1934,12 +2008,15 @@ const BACKGROUND_TOOLS = {
1934
2008
  },
1935
2009
  pricing: "$0.08 per 24 output megapixels, any precision model",
1936
2010
  queued: true,
2011
+ scaleRange: {
2012
+ max: 4,
2013
+ min: 1
2014
+ },
1937
2015
  sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision",
1938
2016
  task: "faithful image upscaling"
1939
2017
  },
1940
2018
  "topaz-restore": {
1941
2019
  category: "restoration",
1942
- defaultOptions: { output_format: "png" },
1943
2020
  description: "Topaz restoration of damaged or degraded photographs at source resolution.",
1944
2021
  endpoint: "topaz/restore/image",
1945
2022
  inputField: "image_url",
@@ -1958,7 +2035,6 @@ const BACKGROUND_TOOLS = {
1958
2035
  },
1959
2036
  "topaz-sharpen": {
1960
2037
  category: "restoration",
1961
- defaultOptions: { output_format: "png" },
1962
2038
  description: "Topaz deblurring and sharpening at source resolution.",
1963
2039
  endpoint: "topaz/sharpen/image",
1964
2040
  inputField: "image_url",
@@ -1979,8 +2055,10 @@ const BACKGROUND_TOOLS = {
1979
2055
  category: "restoration",
1980
2056
  description: "Topaz upscaling that preserves the alpha channel end to end.",
1981
2057
  endpoint: "topaz/upscale/image/transparent",
2058
+ fixedScale: 4,
1982
2059
  inputField: "image_url",
1983
2060
  inputKind: "image",
2061
+ keepsAlpha: true,
1984
2062
  name: "Topaz Transparent Upscale",
1985
2063
  outputKeys: ["image"],
1986
2064
  price: {
@@ -2023,6 +2101,10 @@ const BACKGROUND_TOOLS = {
2023
2101
  },
2024
2102
  pricing: "$0.01/sec up to 720p output; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2",
2025
2103
  queued: true,
2104
+ scaleRange: {
2105
+ max: 4,
2106
+ min: 1
2107
+ },
2026
2108
  sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video",
2027
2109
  task: "video enhancement"
2028
2110
  }
@@ -2035,6 +2117,7 @@ const EDITING_TOOLS = {
2035
2117
  endpoint: "fal-ai/bria/eraser",
2036
2118
  inputField: "image_url",
2037
2119
  inputKind: "image",
2120
+ maskField: "mask_url",
2038
2121
  name: "Bria Eraser",
2039
2122
  outputKeys: ["image"],
2040
2123
  price: {
@@ -2067,6 +2150,7 @@ const EDITING_TOOLS = {
2067
2150
  endpoint: "fal-ai/bria/genfill",
2068
2151
  inputField: "image_url",
2069
2152
  inputKind: "image",
2153
+ maskField: "mask_url",
2070
2154
  name: "Bria GenFill",
2071
2155
  outputKeys: ["images"],
2072
2156
  price: {
@@ -2117,6 +2201,7 @@ const EDITING_TOOLS = {
2117
2201
  endpoint: "fal-ai/iclight-v2",
2118
2202
  inputField: "image_url",
2119
2203
  inputKind: "image",
2204
+ maskField: "mask_image_url",
2120
2205
  name: "IC-Light v2",
2121
2206
  outputKeys: ["images"],
2122
2207
  price: {
@@ -2180,6 +2265,7 @@ const EDITING_TOOLS = {
2180
2265
  category: "erase",
2181
2266
  description: "Remove whatever falls inside supplied bounding boxes.",
2182
2267
  endpoint: "fal-ai/object-removal/bbox",
2268
+ fractionBoxes: true,
2183
2269
  inputField: "image_url",
2184
2270
  inputKind: "image",
2185
2271
  name: "Object Removal by Box",
@@ -2198,6 +2284,7 @@ const EDITING_TOOLS = {
2198
2284
  endpoint: "fal-ai/object-removal/mask",
2199
2285
  inputField: "image_url",
2200
2286
  inputKind: "image",
2287
+ maskField: "mask_url",
2201
2288
  name: "Object Removal by Mask",
2202
2289
  outputKeys: ["images"],
2203
2290
  price: {
@@ -2263,7 +2350,6 @@ const EDITING_TOOLS = {
2263
2350
  },
2264
2351
  "text-removal": {
2265
2352
  category: "erase",
2266
- defaultOptions: { output_format: "png" },
2267
2353
  description: "Remove all rendered text from an image, rebuilding what sat behind it.",
2268
2354
  endpoint: "fal-ai/image-editing/text-removal",
2269
2355
  inputField: "image_url",
@@ -2473,7 +2559,6 @@ const STRUCTURE_TOOLS = {
2473
2559
  category: "segmentation",
2474
2560
  defaultOptions: {
2475
2561
  min_mask_region_area: 100,
2476
- output_format: "png",
2477
2562
  points_per_side: 32,
2478
2563
  pred_iou_thresh: .88,
2479
2564
  stability_score_thresh: .95
@@ -2497,14 +2582,14 @@ const STRUCTURE_TOOLS = {
2497
2582
  category: "segmentation",
2498
2583
  defaultOptions: {
2499
2584
  apply_mask: true,
2500
- max_masks: 3,
2501
- output_format: "png"
2585
+ max_masks: 3
2502
2586
  },
2503
2587
  description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.",
2504
2588
  endpoint: "fal-ai/sam-3-1/image",
2505
2589
  inputField: "image_url",
2506
2590
  inputKind: "image",
2507
2591
  name: "SAM 3.1 Image",
2592
+ needsTarget: true,
2508
2593
  outputKeys: [
2509
2594
  "image",
2510
2595
  "masks",
@@ -2522,15 +2607,13 @@ const STRUCTURE_TOOLS = {
2522
2607
  },
2523
2608
  "sam3-1-video": {
2524
2609
  category: "segmentation",
2525
- defaultOptions: {
2526
- apply_mask: true,
2527
- prompt: "person"
2528
- },
2610
+ defaultOptions: { apply_mask: true },
2529
2611
  description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.",
2530
2612
  endpoint: "fal-ai/sam-3-1/video",
2531
2613
  inputField: "video_url",
2532
2614
  inputKind: "video",
2533
2615
  name: "SAM 3.1 Video",
2616
+ needsTarget: true,
2534
2617
  outputKeys: ["video", "boundingbox_frames_zip"],
2535
2618
  price: {
2536
2619
  frames: 16,
@@ -2546,14 +2629,14 @@ const STRUCTURE_TOOLS = {
2546
2629
  category: "segmentation",
2547
2630
  defaultOptions: {
2548
2631
  apply_mask: true,
2549
- max_masks: 3,
2550
- output_format: "png"
2632
+ max_masks: 3
2551
2633
  },
2552
2634
  description: "Segment image objects with text, point, or box prompts.",
2553
2635
  endpoint: "fal-ai/sam-3/image",
2554
2636
  inputField: "image_url",
2555
2637
  inputKind: "image",
2556
2638
  name: "SAM 3 Image",
2639
+ needsTarget: true,
2557
2640
  outputKeys: [
2558
2641
  "image",
2559
2642
  "masks",
@@ -2580,6 +2663,7 @@ const STRUCTURE_TOOLS = {
2580
2663
  inputField: "image_url",
2581
2664
  inputKind: "image",
2582
2665
  name: "SAM 3 Image RLE",
2666
+ needsTarget: true,
2583
2667
  outputKeys: [
2584
2668
  "rle",
2585
2669
  "scores",
@@ -2599,7 +2683,6 @@ const STRUCTURE_TOOLS = {
2599
2683
  defaultOptions: {
2600
2684
  apply_mask: true,
2601
2685
  detection_threshold: .5,
2602
- prompt: "person",
2603
2686
  video_output_type: "X264 (.mp4)"
2604
2687
  },
2605
2688
  description: "Segment and track prompted objects across video frames.",
@@ -2607,6 +2690,7 @@ const STRUCTURE_TOOLS = {
2607
2690
  inputField: "video_url",
2608
2691
  inputKind: "video",
2609
2692
  name: "SAM 3 Video",
2693
+ needsTarget: true,
2610
2694
  outputKeys: ["video", "boundingbox_frames_zip"],
2611
2695
  price: {
2612
2696
  frames: 16,
@@ -2622,14 +2706,14 @@ const STRUCTURE_TOOLS = {
2622
2706
  category: "segmentation",
2623
2707
  defaultOptions: {
2624
2708
  apply_mask: true,
2625
- detection_threshold: .5,
2626
- prompt: "person"
2709
+ detection_threshold: .5
2627
2710
  },
2628
2711
  description: "Track prompted video objects and return RLE mask data.",
2629
2712
  endpoint: "fal-ai/sam-3/video-rle",
2630
2713
  inputField: "video_url",
2631
2714
  inputKind: "video",
2632
2715
  name: "SAM 3 Video RLE",
2716
+ needsTarget: true,
2633
2717
  outputKeys: ["video", "boundingbox_frames_zip"],
2634
2718
  price: {
2635
2719
  frames: 16,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/motif-sdk",
3
- "version": "7.1.0",
3
+ "version": "7.3.0",
4
4
  "description": "Node SDK for Motif: image, video and 3D Tasks on fal.ai, with Motif choosing the Model.",
5
5
  "keywords": [
6
6
  "fal",