@shop-os/modelkit 0.29.0 → 0.30.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/CHANGELOG.md +11 -0
- package/dist/catalog.cjs +102 -12
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +102 -12
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +164 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +164 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.js
CHANGED
|
@@ -904,6 +904,65 @@ var IMAGE_MODELS = [
|
|
|
904
904
|
description: "Ideogram's precise edit model: repeated edits keep the untouched pixels and colours intact, at the source's native resolution. Also generates from text."
|
|
905
905
|
}
|
|
906
906
|
},
|
|
907
|
+
{
|
|
908
|
+
// Generation only: fal charges edits more, so editing is its own row
|
|
909
|
+
// (ideogram-4.6-edit) with its own prices. fal bills any output above
|
|
910
|
+
// 2048x2048 in area at the 4K price; very_low renders at most 2K, so it is
|
|
911
|
+
// not exposed (no 4K price exists for it, and the catalog seed gate needs
|
|
912
|
+
// every size x quality priced). https://fal.ai/models/ideogram/v4.6
|
|
913
|
+
id: "ideogram-4.6",
|
|
914
|
+
aliases: [],
|
|
915
|
+
label: "Ideogram 4.6",
|
|
916
|
+
type: "image",
|
|
917
|
+
adapter: "fal",
|
|
918
|
+
providerModelId: "ideogram/v4.6",
|
|
919
|
+
lifecycle: "active",
|
|
920
|
+
exposure: ["cowork", "space_builder"],
|
|
921
|
+
constraints: {
|
|
922
|
+
aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
|
|
923
|
+
sizes: ["2K", "4K"],
|
|
924
|
+
qualityOptions: ["auto", "low", "medium", "high"],
|
|
925
|
+
references: { images: 0 },
|
|
926
|
+
supports: ["quality", "count", "seed"]
|
|
927
|
+
},
|
|
928
|
+
defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
|
|
929
|
+
usage: { ...IMAGE_USAGE3, slug: "ideogram" },
|
|
930
|
+
pricingKind: "image_size",
|
|
931
|
+
display: {
|
|
932
|
+
provider: "ideogram",
|
|
933
|
+
description: "Ideogram 4.6 text-to-image from a prompt, at 2K or 4K. Edits go to Ideogram 4.6 Edit."
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
// Precise Edit only: references switch to the /edit endpoint, where the
|
|
938
|
+
// first is the image to edit and the rest (up to 4) guide it, so 5 images
|
|
939
|
+
// in all. The output keeps the source size, so `size` only picks the
|
|
940
|
+
// billed tier. Same provider model as the generate row, whose adapter
|
|
941
|
+
// routes on references. https://fal.ai/models/ideogram/v4.6/edit
|
|
942
|
+
id: "ideogram-4.6-edit",
|
|
943
|
+
aliases: [],
|
|
944
|
+
label: "Ideogram 4.6 Edit",
|
|
945
|
+
type: "image",
|
|
946
|
+
adapter: "fal",
|
|
947
|
+
providerModelId: "ideogram/v4.6",
|
|
948
|
+
lifecycle: "active",
|
|
949
|
+
exposure: ["cowork", "space_builder"],
|
|
950
|
+
constraints: {
|
|
951
|
+
aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
|
|
952
|
+
sizes: ["2K", "4K"],
|
|
953
|
+
qualityOptions: ["auto", "low", "medium", "high"],
|
|
954
|
+
references: { images: 5 },
|
|
955
|
+
requires: ["references"],
|
|
956
|
+
supports: ["quality", "count", "seed"]
|
|
957
|
+
},
|
|
958
|
+
defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
|
|
959
|
+
usage: { ...IMAGE_USAGE3, slug: "ideogram" },
|
|
960
|
+
pricingKind: "image_size",
|
|
961
|
+
display: {
|
|
962
|
+
provider: "ideogram",
|
|
963
|
+
description: "Ideogram 4.6 Precise Edit: the first image is edited and up to 4 more guide it. Repeated edits keep the untouched pixels and colours intact, and the output keeps the source size."
|
|
964
|
+
}
|
|
965
|
+
},
|
|
907
966
|
{
|
|
908
967
|
id: "seedream-5-0-pro",
|
|
909
968
|
aliases: ["seedream-4-5"],
|
|
@@ -9909,6 +9968,17 @@ function falImageSpec(providerModelId) {
|
|
|
9909
9968
|
}
|
|
9910
9969
|
var AREA_1K = 1024 * 1024;
|
|
9911
9970
|
var AREA_2K = 2048 * 2048;
|
|
9971
|
+
var IDEOGRAM_46_EXACT = {
|
|
9972
|
+
minSide: 256,
|
|
9973
|
+
maxSide: 4096,
|
|
9974
|
+
minArea: 256 * 256,
|
|
9975
|
+
maxArea: 4096 * 4096,
|
|
9976
|
+
multipleOf: 32,
|
|
9977
|
+
maxAspect: 6,
|
|
9978
|
+
minTier: "2K",
|
|
9979
|
+
topTier: "4K"
|
|
9980
|
+
};
|
|
9981
|
+
var IDEOGRAM_46_IDS = /* @__PURE__ */ new Set(["ideogram/v4.6"]);
|
|
9912
9982
|
function checkExactSize(exact, b) {
|
|
9913
9983
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
9914
9984
|
if (match === null) {
|
|
@@ -9932,7 +10002,7 @@ function checkExactSize(exact, b) {
|
|
|
9932
10002
|
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
9933
10003
|
}
|
|
9934
10004
|
function exactTier(area, b) {
|
|
9935
|
-
if (area <= AREA_1K) return "1K";
|
|
10005
|
+
if (area <= AREA_1K) return b.minTier ?? "1K";
|
|
9936
10006
|
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
9937
10007
|
return b.topTier;
|
|
9938
10008
|
}
|
|
@@ -9994,23 +10064,43 @@ function falImageProblem(spec, req) {
|
|
|
9994
10064
|
}
|
|
9995
10065
|
function falExactSize(spec, req) {
|
|
9996
10066
|
if (req.exactSize === void 0 || spec.exactSize === void 0) return void 0;
|
|
9997
|
-
|
|
10067
|
+
return checkedExactSize(req.exactSize, spec.exactSize);
|
|
10068
|
+
}
|
|
10069
|
+
function checkedExactSize(exact, bounds) {
|
|
10070
|
+
const check = checkExactSize(exact, bounds);
|
|
9998
10071
|
return check.ok ? check.size : void 0;
|
|
9999
10072
|
}
|
|
10073
|
+
function ideogram46ExactSize(model, req) {
|
|
10074
|
+
if (req.exactSize === void 0) return void 0;
|
|
10075
|
+
const check = checkExactSize(req.exactSize, IDEOGRAM_46_EXACT);
|
|
10076
|
+
if (check.ok) return check.size;
|
|
10077
|
+
throw new ModelKitError({
|
|
10078
|
+
code: "unsupported_option",
|
|
10079
|
+
message: `${model.label}: ${check.message}`,
|
|
10080
|
+
model: model.id,
|
|
10081
|
+
retryable: false
|
|
10082
|
+
});
|
|
10083
|
+
}
|
|
10000
10084
|
function applyFalImageRules(model, req, callerSize, warnings) {
|
|
10001
10085
|
if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
|
|
10002
10086
|
const spec = falImageSpec(model.providerModelId);
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10087
|
+
const ideogram46 = IDEOGRAM_46_IDS.has(model.providerModelId.toLowerCase());
|
|
10088
|
+
if (spec === void 0 && !ideogram46) return;
|
|
10089
|
+
let exact;
|
|
10090
|
+
if (spec === void 0) {
|
|
10091
|
+
exact = ideogram46ExactSize(model, req);
|
|
10092
|
+
} else {
|
|
10093
|
+
const problem = falImageProblem(spec, withPromptForResolve(req));
|
|
10094
|
+
if (problem !== void 0) {
|
|
10095
|
+
throw new ModelKitError({
|
|
10096
|
+
code: problem.code,
|
|
10097
|
+
message: problem.message,
|
|
10098
|
+
model: model.id,
|
|
10099
|
+
retryable: false
|
|
10100
|
+
});
|
|
10101
|
+
}
|
|
10102
|
+
exact = falExactSize(spec, req);
|
|
10012
10103
|
}
|
|
10013
|
-
const exact = falExactSize(spec, req);
|
|
10014
10104
|
if (exact === void 0) return;
|
|
10015
10105
|
if (callerSize !== void 0 && callerSize !== exact.tier) {
|
|
10016
10106
|
warnings.push({
|