getaiapi 0.4.2 → 0.4.5
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/{chunk-AHDDOGQB.js → chunk-ZSVRV6GS.js} +376 -4
- package/dist/chunk-ZSVRV6GS.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/registry/registry.json +701 -1429
- package/dist/chunk-AHDDOGQB.js.map +0 -1
|
@@ -29,6 +29,29 @@ var ModelNotFoundError = class extends GetAIApiError {
|
|
|
29
29
|
this.suggestions = suggestions;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
var NoProviderError = class extends GetAIApiError {
|
|
33
|
+
query;
|
|
34
|
+
model;
|
|
35
|
+
requiredProviders;
|
|
36
|
+
availableProviders;
|
|
37
|
+
constructor(query, model, requiredProviders, availableProviders) {
|
|
38
|
+
const envHints = {
|
|
39
|
+
"fal-ai": "FAL_KEY",
|
|
40
|
+
replicate: "REPLICATE_API_TOKEN",
|
|
41
|
+
wavespeed: "WAVESPEED_API_KEY",
|
|
42
|
+
openrouter: "OPENROUTER_API_KEY"
|
|
43
|
+
};
|
|
44
|
+
const needed = requiredProviders.map((p) => `${p} (${envHints[p] || "unknown"})`).join(" or ");
|
|
45
|
+
super(
|
|
46
|
+
`Model "${query}" found but requires ${needed}. You have: ${availableProviders.length > 0 ? availableProviders.join(", ") : "none"}.`
|
|
47
|
+
);
|
|
48
|
+
this.name = "NoProviderError";
|
|
49
|
+
this.query = query;
|
|
50
|
+
this.model = model;
|
|
51
|
+
this.requiredProviders = requiredProviders;
|
|
52
|
+
this.availableProviders = availableProviders;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
32
55
|
var ValidationError = class extends GetAIApiError {
|
|
33
56
|
field;
|
|
34
57
|
constructor(field, message) {
|
|
@@ -199,8 +222,12 @@ function resolveModel(query, availableProviders) {
|
|
|
199
222
|
(p) => availableProviders.includes(p.provider)
|
|
200
223
|
);
|
|
201
224
|
if (filteredProviders.length === 0) {
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
throw new NoProviderError(
|
|
226
|
+
trimmedQuery,
|
|
227
|
+
matched.canonical_name,
|
|
228
|
+
matched.providers.map((p) => p.provider),
|
|
229
|
+
availableProviders
|
|
230
|
+
);
|
|
204
231
|
}
|
|
205
232
|
return { ...matched, providers: filteredProviders };
|
|
206
233
|
}
|
|
@@ -937,6 +964,342 @@ var textGenerationTemplate = {
|
|
|
937
964
|
default_timeout_ms: 12e4
|
|
938
965
|
};
|
|
939
966
|
|
|
967
|
+
// src/categories/image-to-image.ts
|
|
968
|
+
var imageToImageTemplate = {
|
|
969
|
+
category: "image-to-image",
|
|
970
|
+
input_mappings: [
|
|
971
|
+
{
|
|
972
|
+
universal: "image",
|
|
973
|
+
providers: {
|
|
974
|
+
"fal-ai": "image_url",
|
|
975
|
+
"replicate": "image",
|
|
976
|
+
"wavespeed": "image"
|
|
977
|
+
},
|
|
978
|
+
required: true
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
universal: "prompt",
|
|
982
|
+
providers: {
|
|
983
|
+
"fal-ai": "prompt",
|
|
984
|
+
"replicate": "prompt",
|
|
985
|
+
"wavespeed": "prompt"
|
|
986
|
+
}
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
universal: "strength",
|
|
990
|
+
providers: {
|
|
991
|
+
"fal-ai": "strength",
|
|
992
|
+
"replicate": "prompt_strength",
|
|
993
|
+
"wavespeed": "strength"
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
universal: "seed",
|
|
998
|
+
providers: {
|
|
999
|
+
"fal-ai": "seed",
|
|
1000
|
+
"replicate": "seed",
|
|
1001
|
+
"wavespeed": "seed"
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
universal: "guidance",
|
|
1006
|
+
providers: {
|
|
1007
|
+
"fal-ai": "guidance_scale",
|
|
1008
|
+
"replicate": "guidance",
|
|
1009
|
+
"wavespeed": "guidance_scale"
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
universal: "format",
|
|
1014
|
+
providers: {
|
|
1015
|
+
"fal-ai": "output_format",
|
|
1016
|
+
"replicate": "output_format",
|
|
1017
|
+
"wavespeed": "output_format"
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
universal: "quality",
|
|
1022
|
+
providers: {
|
|
1023
|
+
"fal-ai": "quality",
|
|
1024
|
+
"replicate": "output_quality",
|
|
1025
|
+
"wavespeed": "quality"
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
universal: "safety",
|
|
1030
|
+
providers: {
|
|
1031
|
+
"fal-ai": "enable_safety_checker",
|
|
1032
|
+
"replicate": "disable_safety_checker",
|
|
1033
|
+
"wavespeed": "enable_safety_checker"
|
|
1034
|
+
},
|
|
1035
|
+
transform: "flip_boolean"
|
|
1036
|
+
}
|
|
1037
|
+
],
|
|
1038
|
+
output_type: "image",
|
|
1039
|
+
output_extract: {
|
|
1040
|
+
"fal-ai": "images[].url",
|
|
1041
|
+
"replicate": "output[]",
|
|
1042
|
+
"wavespeed": "data.outputs[]"
|
|
1043
|
+
},
|
|
1044
|
+
default_timeout_ms: 6e4
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
// src/categories/text-to-3d.ts
|
|
1048
|
+
var textTo3dTemplate = {
|
|
1049
|
+
category: "text-to-3d",
|
|
1050
|
+
input_mappings: [
|
|
1051
|
+
{
|
|
1052
|
+
universal: "prompt",
|
|
1053
|
+
providers: {
|
|
1054
|
+
"fal-ai": "prompt",
|
|
1055
|
+
"replicate": "prompt",
|
|
1056
|
+
"wavespeed": "prompt"
|
|
1057
|
+
},
|
|
1058
|
+
required: true
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
universal: "seed",
|
|
1062
|
+
providers: {
|
|
1063
|
+
"fal-ai": "seed",
|
|
1064
|
+
"replicate": "seed",
|
|
1065
|
+
"wavespeed": "seed"
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
universal: "format",
|
|
1070
|
+
providers: {
|
|
1071
|
+
"fal-ai": "output_format",
|
|
1072
|
+
"replicate": "output_format",
|
|
1073
|
+
"wavespeed": "output_format"
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
universal: "quality",
|
|
1078
|
+
providers: {
|
|
1079
|
+
"fal-ai": "quality",
|
|
1080
|
+
"replicate": "output_quality",
|
|
1081
|
+
"wavespeed": "quality"
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
],
|
|
1085
|
+
output_type: "3d",
|
|
1086
|
+
output_extract: {
|
|
1087
|
+
"fal-ai": "output.url",
|
|
1088
|
+
"replicate": "output",
|
|
1089
|
+
"wavespeed": "data.output"
|
|
1090
|
+
},
|
|
1091
|
+
default_timeout_ms: 6e5
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
// src/categories/image-to-3d.ts
|
|
1095
|
+
var imageTo3dTemplate = {
|
|
1096
|
+
category: "image-to-3d",
|
|
1097
|
+
input_mappings: [
|
|
1098
|
+
{
|
|
1099
|
+
universal: "image",
|
|
1100
|
+
providers: {
|
|
1101
|
+
"fal-ai": "image_url",
|
|
1102
|
+
"replicate": "image",
|
|
1103
|
+
"wavespeed": "image"
|
|
1104
|
+
},
|
|
1105
|
+
required: true
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
universal: "prompt",
|
|
1109
|
+
providers: {
|
|
1110
|
+
"fal-ai": "prompt",
|
|
1111
|
+
"replicate": "prompt",
|
|
1112
|
+
"wavespeed": "prompt"
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
universal: "seed",
|
|
1117
|
+
providers: {
|
|
1118
|
+
"fal-ai": "seed",
|
|
1119
|
+
"replicate": "seed",
|
|
1120
|
+
"wavespeed": "seed"
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
universal: "format",
|
|
1125
|
+
providers: {
|
|
1126
|
+
"fal-ai": "output_format",
|
|
1127
|
+
"replicate": "output_format",
|
|
1128
|
+
"wavespeed": "output_format"
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
],
|
|
1132
|
+
output_type: "3d",
|
|
1133
|
+
output_extract: {
|
|
1134
|
+
"fal-ai": "output.url",
|
|
1135
|
+
"replicate": "output",
|
|
1136
|
+
"wavespeed": "data.output"
|
|
1137
|
+
},
|
|
1138
|
+
default_timeout_ms: 6e5
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
// src/categories/upscale-video.ts
|
|
1142
|
+
var upscaleVideoTemplate = {
|
|
1143
|
+
category: "upscale-video",
|
|
1144
|
+
input_mappings: [
|
|
1145
|
+
{
|
|
1146
|
+
universal: "video",
|
|
1147
|
+
providers: {
|
|
1148
|
+
"fal-ai": "video_url",
|
|
1149
|
+
"replicate": "video",
|
|
1150
|
+
"wavespeed": "video"
|
|
1151
|
+
},
|
|
1152
|
+
required: true
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
universal: "strength",
|
|
1156
|
+
providers: {
|
|
1157
|
+
"fal-ai": "scale",
|
|
1158
|
+
"replicate": "scale",
|
|
1159
|
+
"wavespeed": "scale"
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
],
|
|
1163
|
+
output_type: "video",
|
|
1164
|
+
output_extract: {
|
|
1165
|
+
"fal-ai": "video.url",
|
|
1166
|
+
"replicate": "output",
|
|
1167
|
+
"wavespeed": "data.output"
|
|
1168
|
+
},
|
|
1169
|
+
default_timeout_ms: 6e5
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
// src/categories/video-to-audio.ts
|
|
1173
|
+
var videoToAudioTemplate = {
|
|
1174
|
+
category: "video-to-audio",
|
|
1175
|
+
input_mappings: [
|
|
1176
|
+
{
|
|
1177
|
+
universal: "video",
|
|
1178
|
+
providers: {
|
|
1179
|
+
"fal-ai": "video_url",
|
|
1180
|
+
"replicate": "video",
|
|
1181
|
+
"wavespeed": "video"
|
|
1182
|
+
},
|
|
1183
|
+
required: true
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
universal: "prompt",
|
|
1187
|
+
providers: {
|
|
1188
|
+
"fal-ai": "prompt",
|
|
1189
|
+
"replicate": "prompt",
|
|
1190
|
+
"wavespeed": "prompt"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
],
|
|
1194
|
+
output_type: "audio",
|
|
1195
|
+
output_extract: {
|
|
1196
|
+
"fal-ai": "audio.url",
|
|
1197
|
+
"replicate": "output",
|
|
1198
|
+
"wavespeed": "data.output"
|
|
1199
|
+
},
|
|
1200
|
+
default_timeout_ms: 12e4
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// src/categories/segmentation.ts
|
|
1204
|
+
var segmentationTemplate = {
|
|
1205
|
+
category: "segmentation",
|
|
1206
|
+
input_mappings: [
|
|
1207
|
+
{
|
|
1208
|
+
universal: "image",
|
|
1209
|
+
providers: {
|
|
1210
|
+
"fal-ai": "image_url",
|
|
1211
|
+
"replicate": "image",
|
|
1212
|
+
"wavespeed": "image"
|
|
1213
|
+
},
|
|
1214
|
+
required: true
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
universal: "prompt",
|
|
1218
|
+
providers: {
|
|
1219
|
+
"fal-ai": "prompt",
|
|
1220
|
+
"replicate": "prompt",
|
|
1221
|
+
"wavespeed": "prompt"
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
],
|
|
1225
|
+
output_type: "segmentation",
|
|
1226
|
+
output_extract: {
|
|
1227
|
+
"fal-ai": "output.url",
|
|
1228
|
+
"replicate": "output",
|
|
1229
|
+
"wavespeed": "data.output"
|
|
1230
|
+
},
|
|
1231
|
+
default_timeout_ms: 6e4
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
// src/categories/moderation.ts
|
|
1235
|
+
var moderationTemplate = {
|
|
1236
|
+
category: "moderation",
|
|
1237
|
+
input_mappings: [
|
|
1238
|
+
{
|
|
1239
|
+
universal: "prompt",
|
|
1240
|
+
providers: {
|
|
1241
|
+
"fal-ai": "prompt",
|
|
1242
|
+
"replicate": "prompt",
|
|
1243
|
+
"wavespeed": "prompt"
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
universal: "image",
|
|
1248
|
+
providers: {
|
|
1249
|
+
"fal-ai": "image_url",
|
|
1250
|
+
"replicate": "image",
|
|
1251
|
+
"wavespeed": "image"
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
universal: "video",
|
|
1256
|
+
providers: {
|
|
1257
|
+
"fal-ai": "video_url",
|
|
1258
|
+
"replicate": "video",
|
|
1259
|
+
"wavespeed": "video"
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
universal: "audio",
|
|
1264
|
+
providers: {
|
|
1265
|
+
"fal-ai": "audio_url",
|
|
1266
|
+
"replicate": "audio",
|
|
1267
|
+
"wavespeed": "audio"
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
],
|
|
1271
|
+
output_type: "text",
|
|
1272
|
+
output_extract: {
|
|
1273
|
+
"fal-ai": "output",
|
|
1274
|
+
"replicate": "output",
|
|
1275
|
+
"wavespeed": "data.output"
|
|
1276
|
+
},
|
|
1277
|
+
default_timeout_ms: 3e4
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
// src/categories/training.ts
|
|
1281
|
+
var trainingTemplate = {
|
|
1282
|
+
category: "training",
|
|
1283
|
+
input_mappings: [
|
|
1284
|
+
{
|
|
1285
|
+
universal: "image",
|
|
1286
|
+
providers: {
|
|
1287
|
+
"fal-ai": "images_data_url",
|
|
1288
|
+
"replicate": "input_images",
|
|
1289
|
+
"wavespeed": "images"
|
|
1290
|
+
},
|
|
1291
|
+
required: true
|
|
1292
|
+
}
|
|
1293
|
+
],
|
|
1294
|
+
output_type: "text",
|
|
1295
|
+
output_extract: {
|
|
1296
|
+
"fal-ai": "output",
|
|
1297
|
+
"replicate": "output",
|
|
1298
|
+
"wavespeed": "data.output"
|
|
1299
|
+
},
|
|
1300
|
+
default_timeout_ms: 18e5
|
|
1301
|
+
};
|
|
1302
|
+
|
|
940
1303
|
// src/categories/index.ts
|
|
941
1304
|
var templates = {
|
|
942
1305
|
"text-to-image": textToImageTemplate,
|
|
@@ -947,7 +1310,15 @@ var templates = {
|
|
|
947
1310
|
"text-to-audio": textToAudioTemplate,
|
|
948
1311
|
"audio-to-text": audioToTextTemplate,
|
|
949
1312
|
"remove-background": removeBackgroundTemplate,
|
|
950
|
-
"text-generation": textGenerationTemplate
|
|
1313
|
+
"text-generation": textGenerationTemplate,
|
|
1314
|
+
"image-to-image": imageToImageTemplate,
|
|
1315
|
+
"text-to-3d": textTo3dTemplate,
|
|
1316
|
+
"image-to-3d": imageTo3dTemplate,
|
|
1317
|
+
"upscale-video": upscaleVideoTemplate,
|
|
1318
|
+
"video-to-audio": videoToAudioTemplate,
|
|
1319
|
+
"segmentation": segmentationTemplate,
|
|
1320
|
+
"moderation": moderationTemplate,
|
|
1321
|
+
"training": trainingTemplate
|
|
951
1322
|
};
|
|
952
1323
|
function getCategoryTemplate(category) {
|
|
953
1324
|
return templates[category];
|
|
@@ -1898,6 +2269,7 @@ export {
|
|
|
1898
2269
|
GetAIApiError,
|
|
1899
2270
|
AuthError,
|
|
1900
2271
|
ModelNotFoundError,
|
|
2272
|
+
NoProviderError,
|
|
1901
2273
|
ValidationError,
|
|
1902
2274
|
ProviderError,
|
|
1903
2275
|
TimeoutError,
|
|
@@ -1913,4 +2285,4 @@ export {
|
|
|
1913
2285
|
listModels,
|
|
1914
2286
|
getModel
|
|
1915
2287
|
};
|
|
1916
|
-
//# sourceMappingURL=chunk-
|
|
2288
|
+
//# sourceMappingURL=chunk-ZSVRV6GS.js.map
|