@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/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,17 @@ header in the release PR.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.30.0] - Unreleased
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `ideogram-4.6` image row on the fal adapter (`ideogram/v4.6`), generation only. `aspectRatio` + `size` (`2K` or `4K`, default `2K`) pick one of fal's fixed sizes, and `exactSize` is sent as given. `quality` is `low`, `medium` or `high`; `auto` sends nothing and fal uses `medium`. fal's prompt expansion is off (the edit endpoint has no such field). It takes no reference images: the edit-only `very_low` tier and masked edits are not exposed.
|
|
16
|
+
- `ideogram-4.6-edit` image row for Precise Edit, on the same `ideogram/v4.6` provider model; the adapter routes there on references. It requires at least one reference (up to 5): the first is the image to edit (`image_url`), the rest (up to 4) are `reference_image_urls`, the output keeps the source size, and `edit_precision` is always `high`. It is a separate row because fal charges edits more than generates and the image price table is keyed by the model row; `size` picks the billed tier.
|
|
17
|
+
|
|
18
|
+
fal bills any output above 2048x2048 px in area at the 4K price, so both rows report the delivered image's tier on the usage event: an edit bills the size it kept, and a generate bills its exact size's area. An `exactSize` needs 256 to 4096 px per side, in multiples of 32, within 1:6; anything else is refused before the call, and an accepted one sets `size` to its area's tier so the quote and the hold price it right.
|
|
19
|
+
|
|
20
|
+
### Live rows to add after publish
|
|
21
|
+
Add the `ideogram-4.6` and `ideogram-4.6-edit` rows to pro-backend's `model_catalog` only after their per-quality image prices exist and every app that will call them runs 0.30.0. An older kit sends `ideogram-4.6` down the Muse path, so every generate fails.
|
|
22
|
+
|
|
12
23
|
## [0.29.0] - Unreleased
|
|
13
24
|
|
|
14
25
|
### Added
|
package/dist/catalog.cjs
CHANGED
|
@@ -996,6 +996,65 @@ var IMAGE_MODELS = [
|
|
|
996
996
|
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."
|
|
997
997
|
}
|
|
998
998
|
},
|
|
999
|
+
{
|
|
1000
|
+
// Generation only: fal charges edits more, so editing is its own row
|
|
1001
|
+
// (ideogram-4.6-edit) with its own prices. fal bills any output above
|
|
1002
|
+
// 2048x2048 in area at the 4K price; very_low renders at most 2K, so it is
|
|
1003
|
+
// not exposed (no 4K price exists for it, and the catalog seed gate needs
|
|
1004
|
+
// every size x quality priced). https://fal.ai/models/ideogram/v4.6
|
|
1005
|
+
id: "ideogram-4.6",
|
|
1006
|
+
aliases: [],
|
|
1007
|
+
label: "Ideogram 4.6",
|
|
1008
|
+
type: "image",
|
|
1009
|
+
adapter: "fal",
|
|
1010
|
+
providerModelId: "ideogram/v4.6",
|
|
1011
|
+
lifecycle: "active",
|
|
1012
|
+
exposure: ["cowork", "space_builder"],
|
|
1013
|
+
constraints: {
|
|
1014
|
+
aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
|
|
1015
|
+
sizes: ["2K", "4K"],
|
|
1016
|
+
qualityOptions: ["auto", "low", "medium", "high"],
|
|
1017
|
+
references: { images: 0 },
|
|
1018
|
+
supports: ["quality", "count", "seed"]
|
|
1019
|
+
},
|
|
1020
|
+
defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
|
|
1021
|
+
usage: { ...IMAGE_USAGE3, slug: "ideogram" },
|
|
1022
|
+
pricingKind: "image_size",
|
|
1023
|
+
display: {
|
|
1024
|
+
provider: "ideogram",
|
|
1025
|
+
description: "Ideogram 4.6 text-to-image from a prompt, at 2K or 4K. Edits go to Ideogram 4.6 Edit."
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
// Precise Edit only: references switch to the /edit endpoint, where the
|
|
1030
|
+
// first is the image to edit and the rest (up to 4) guide it, so 5 images
|
|
1031
|
+
// in all. The output keeps the source size, so `size` only picks the
|
|
1032
|
+
// billed tier. Same provider model as the generate row, whose adapter
|
|
1033
|
+
// routes on references. https://fal.ai/models/ideogram/v4.6/edit
|
|
1034
|
+
id: "ideogram-4.6-edit",
|
|
1035
|
+
aliases: [],
|
|
1036
|
+
label: "Ideogram 4.6 Edit",
|
|
1037
|
+
type: "image",
|
|
1038
|
+
adapter: "fal",
|
|
1039
|
+
providerModelId: "ideogram/v4.6",
|
|
1040
|
+
lifecycle: "active",
|
|
1041
|
+
exposure: ["cowork", "space_builder"],
|
|
1042
|
+
constraints: {
|
|
1043
|
+
aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
|
|
1044
|
+
sizes: ["2K", "4K"],
|
|
1045
|
+
qualityOptions: ["auto", "low", "medium", "high"],
|
|
1046
|
+
references: { images: 5 },
|
|
1047
|
+
requires: ["references"],
|
|
1048
|
+
supports: ["quality", "count", "seed"]
|
|
1049
|
+
},
|
|
1050
|
+
defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
|
|
1051
|
+
usage: { ...IMAGE_USAGE3, slug: "ideogram" },
|
|
1052
|
+
pricingKind: "image_size",
|
|
1053
|
+
display: {
|
|
1054
|
+
provider: "ideogram",
|
|
1055
|
+
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."
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
999
1058
|
{
|
|
1000
1059
|
id: "seedream-5-0-pro",
|
|
1001
1060
|
aliases: ["seedream-4-5"],
|
|
@@ -10001,6 +10060,17 @@ function falImageSpec(providerModelId) {
|
|
|
10001
10060
|
}
|
|
10002
10061
|
var AREA_1K = 1024 * 1024;
|
|
10003
10062
|
var AREA_2K = 2048 * 2048;
|
|
10063
|
+
var IDEOGRAM_46_EXACT = {
|
|
10064
|
+
minSide: 256,
|
|
10065
|
+
maxSide: 4096,
|
|
10066
|
+
minArea: 256 * 256,
|
|
10067
|
+
maxArea: 4096 * 4096,
|
|
10068
|
+
multipleOf: 32,
|
|
10069
|
+
maxAspect: 6,
|
|
10070
|
+
minTier: "2K",
|
|
10071
|
+
topTier: "4K"
|
|
10072
|
+
};
|
|
10073
|
+
var IDEOGRAM_46_IDS = /* @__PURE__ */ new Set(["ideogram/v4.6"]);
|
|
10004
10074
|
function checkExactSize(exact, b) {
|
|
10005
10075
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
10006
10076
|
if (match === null) {
|
|
@@ -10024,7 +10094,7 @@ function checkExactSize(exact, b) {
|
|
|
10024
10094
|
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
10025
10095
|
}
|
|
10026
10096
|
function exactTier(area, b) {
|
|
10027
|
-
if (area <= AREA_1K) return "1K";
|
|
10097
|
+
if (area <= AREA_1K) return b.minTier ?? "1K";
|
|
10028
10098
|
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
10029
10099
|
return b.topTier;
|
|
10030
10100
|
}
|
|
@@ -10086,23 +10156,43 @@ function falImageProblem(spec, req) {
|
|
|
10086
10156
|
}
|
|
10087
10157
|
function falExactSize(spec, req) {
|
|
10088
10158
|
if (req.exactSize === void 0 || spec.exactSize === void 0) return void 0;
|
|
10089
|
-
|
|
10159
|
+
return checkedExactSize(req.exactSize, spec.exactSize);
|
|
10160
|
+
}
|
|
10161
|
+
function checkedExactSize(exact, bounds) {
|
|
10162
|
+
const check = checkExactSize(exact, bounds);
|
|
10090
10163
|
return check.ok ? check.size : void 0;
|
|
10091
10164
|
}
|
|
10165
|
+
function ideogram46ExactSize(model, req) {
|
|
10166
|
+
if (req.exactSize === void 0) return void 0;
|
|
10167
|
+
const check = checkExactSize(req.exactSize, IDEOGRAM_46_EXACT);
|
|
10168
|
+
if (check.ok) return check.size;
|
|
10169
|
+
throw new ModelKitError({
|
|
10170
|
+
code: "unsupported_option",
|
|
10171
|
+
message: `${model.label}: ${check.message}`,
|
|
10172
|
+
model: model.id,
|
|
10173
|
+
retryable: false
|
|
10174
|
+
});
|
|
10175
|
+
}
|
|
10092
10176
|
function applyFalImageRules(model, req, callerSize, warnings) {
|
|
10093
10177
|
if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
|
|
10094
10178
|
const spec = falImageSpec(model.providerModelId);
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10179
|
+
const ideogram46 = IDEOGRAM_46_IDS.has(model.providerModelId.toLowerCase());
|
|
10180
|
+
if (spec === void 0 && !ideogram46) return;
|
|
10181
|
+
let exact;
|
|
10182
|
+
if (spec === void 0) {
|
|
10183
|
+
exact = ideogram46ExactSize(model, req);
|
|
10184
|
+
} else {
|
|
10185
|
+
const problem = falImageProblem(spec, withPromptForResolve(req));
|
|
10186
|
+
if (problem !== void 0) {
|
|
10187
|
+
throw new ModelKitError({
|
|
10188
|
+
code: problem.code,
|
|
10189
|
+
message: problem.message,
|
|
10190
|
+
model: model.id,
|
|
10191
|
+
retryable: false
|
|
10192
|
+
});
|
|
10193
|
+
}
|
|
10194
|
+
exact = falExactSize(spec, req);
|
|
10104
10195
|
}
|
|
10105
|
-
const exact = falExactSize(spec, req);
|
|
10106
10196
|
if (exact === void 0) return;
|
|
10107
10197
|
if (callerSize !== void 0 && callerSize !== exact.tier) {
|
|
10108
10198
|
warnings.push({
|