@sogni-ai/sogni-client 5.74.0 → 5.75.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 +25 -0
- package/README.md +32 -0
- package/dist/Chat/_hostedToolsManifest.generated.js +44 -5
- package/dist/Chat/_hostedToolsManifest.generated.js.map +1 -1
- package/dist/Chat/modelRouting.d.ts +2 -0
- package/dist/Chat/modelRouting.js +2 -0
- package/dist/Chat/modelRouting.js.map +1 -1
- package/dist/Projects/createJobRequestMessage.js +11 -1
- package/dist/Projects/createJobRequestMessage.js.map +1 -1
- package/dist/Projects/index.d.ts +1 -1
- package/dist/Projects/index.js +13 -1
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/index.d.ts +13 -1
- package/dist/Projects/types/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/gptImageGif.d.ts +26 -0
- package/dist/lib/gptImageGif.js +92 -0
- package/dist/lib/gptImageGif.js.map +1 -0
- package/dist/lib/validation.d.ts +1 -1
- package/dist/lib/validation.js +55 -5
- package/dist/lib/validation.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist-esm/Chat/_hostedToolsManifest.generated.js +44 -5
- package/dist-esm/Chat/_hostedToolsManifest.generated.js.map +1 -1
- package/dist-esm/Chat/modelRouting.js +2 -0
- package/dist-esm/Chat/modelRouting.js.map +1 -1
- package/dist-esm/Projects/createJobRequestMessage.js +12 -2
- package/dist-esm/Projects/createJobRequestMessage.js.map +1 -1
- package/dist-esm/Projects/index.js +14 -2
- package/dist-esm/Projects/index.js.map +1 -1
- package/dist-esm/Projects/types/index.js.map +1 -1
- package/dist-esm/index.js +1 -0
- package/dist-esm/index.js.map +1 -1
- package/dist-esm/lib/gptImageGif.js +86 -0
- package/dist-esm/lib/gptImageGif.js.map +1 -0
- package/dist-esm/lib/validation.js +53 -4
- package/dist-esm/lib/validation.js.map +1 -1
- package/dist-esm/version.js +1 -1
- package/package.json +4 -3
- package/src/Chat/_hostedToolsManifest.generated.ts +44 -5
- package/src/Chat/modelRouting.ts +2 -0
- package/src/Projects/createJobRequestMessage.ts +10 -1
- package/src/Projects/index.ts +13 -1
- package/src/Projects/types/index.ts +13 -1
- package/src/index.ts +9 -1
- package/src/lib/gptImageGif.ts +110 -0
- package/src/lib/validation.ts +69 -2
- package/src/version.ts +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** GIF frames are rendered on a supported image sheet, including unused cells. */
|
|
2
|
+
export function getGptImageGifLayouts(frameCount = 9) {
|
|
3
|
+
if (!Number.isInteger(frameCount) || frameCount < 2 || frameCount > 16) {
|
|
4
|
+
throw new Error('GIF frame count must be 2–16');
|
|
5
|
+
}
|
|
6
|
+
// Provider validation and measured usage, 2026-11-04: even two frames use
|
|
7
|
+
// an eight-cell sheet. Nine uses 3x3; ten through twelve use 4x3/3x4; the rest use 4x4.
|
|
8
|
+
return frameCount <= 8
|
|
9
|
+
? [
|
|
10
|
+
{ columns: 4, rows: 2 },
|
|
11
|
+
{ columns: 2, rows: 4 }
|
|
12
|
+
]
|
|
13
|
+
: frameCount === 9
|
|
14
|
+
? [{ columns: 3, rows: 3 }]
|
|
15
|
+
: frameCount <= 12
|
|
16
|
+
? [
|
|
17
|
+
{ columns: 4, rows: 3 },
|
|
18
|
+
{ columns: 3, rows: 4 }
|
|
19
|
+
]
|
|
20
|
+
: [{ columns: 4, rows: 4 }];
|
|
21
|
+
}
|
|
22
|
+
export function getGptImageGifFrameBounds(frameCount = 9) {
|
|
23
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
24
|
+
const cells = layouts[0].columns * layouts[0].rows;
|
|
25
|
+
return {
|
|
26
|
+
minDimension: 16,
|
|
27
|
+
dimensionStep: 16,
|
|
28
|
+
maxAspectRatio: 3,
|
|
29
|
+
maxWidth: Math.max(...layouts.map((layout) => 3840 / layout.columns)),
|
|
30
|
+
maxHeight: Math.max(...layouts.map((layout) => 3840 / layout.rows)),
|
|
31
|
+
minPixels: Math.ceil(655360 / cells),
|
|
32
|
+
maxPixels: Math.floor(8294400 / cells)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** The most expensive valid orientation is the reservation envelope. */
|
|
36
|
+
export function getGptImageGifSheet(width, height, frameCount = 9) {
|
|
37
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
38
|
+
if (![width, height].every((value) => Number.isInteger(value) && value > 0 && value % 16 === 0) ||
|
|
39
|
+
Math.max(width, height) / Math.min(width, height) > 3) {
|
|
40
|
+
throw new Error('GIF frame dimensions must be positive multiples of 16 within 3:1');
|
|
41
|
+
}
|
|
42
|
+
const sheets = layouts
|
|
43
|
+
.map((layout) => (Object.assign(Object.assign({}, layout), { width: width * layout.columns, height: height * layout.rows })))
|
|
44
|
+
.filter((sheet) => Math.max(sheet.width, sheet.height) <= 3840 &&
|
|
45
|
+
Math.max(sheet.width, sheet.height) / Math.min(sheet.width, sheet.height) <= 3 &&
|
|
46
|
+
sheet.width * sheet.height >= 655360 &&
|
|
47
|
+
sheet.width * sheet.height <= 8294400);
|
|
48
|
+
if (!sheets.length) {
|
|
49
|
+
throw new Error('GIF frames cannot fit a supported sheet: use smaller or larger frames within the 655360–8294400 pixel budget and 3840 sheet edge limit');
|
|
50
|
+
}
|
|
51
|
+
// Every orientation has the same area. The closest to square has the
|
|
52
|
+
// greatest output-token budget at every supported quality.
|
|
53
|
+
sheets.sort((a, b) => Math.max(a.width, a.height) / Math.min(a.width, a.height) -
|
|
54
|
+
Math.max(b.width, b.height) / Math.min(b.width, b.height));
|
|
55
|
+
return sheets[0];
|
|
56
|
+
}
|
|
57
|
+
/** Preserve explicit pixels; infer omitted dimensions within the sheet limits. */
|
|
58
|
+
export function resolveGptImageGifSize(width, height, frameCount = 9, ratio = 1) {
|
|
59
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
60
|
+
if (!Number.isFinite(ratio) || ratio < 1 / 3 || ratio > 3)
|
|
61
|
+
throw new Error('GIF aspect ratio must be within 3:1');
|
|
62
|
+
if (width !== undefined || height !== undefined) {
|
|
63
|
+
const w = width !== null && width !== void 0 ? width : Math.max(16, Math.round((height * ratio) / 16) * 16);
|
|
64
|
+
const h = height !== null && height !== void 0 ? height : Math.max(16, Math.round(w / ratio / 16) * 16);
|
|
65
|
+
getGptImageGifSheet(w, h, frameCount);
|
|
66
|
+
return { width: w, height: h };
|
|
67
|
+
}
|
|
68
|
+
const candidates = [];
|
|
69
|
+
for (const layout of layouts) {
|
|
70
|
+
const sheetRatio = (ratio * layout.columns) / layout.rows;
|
|
71
|
+
if (sheetRatio < 1 / 3 || sheetRatio > 3)
|
|
72
|
+
continue;
|
|
73
|
+
const area = Math.min(Math.pow(896, 2), 8294400 / (layout.columns * layout.rows), Math.pow((3840 / layout.columns), 2) / ratio, Math.pow((3840 / layout.rows), 2) * ratio);
|
|
74
|
+
let w = Math.floor(Math.sqrt(area * ratio) / 16) * 16;
|
|
75
|
+
let h = Math.floor(Math.sqrt(area / ratio) / 16) * 16;
|
|
76
|
+
w = Math.min(w, h * 3);
|
|
77
|
+
h = Math.min(h, w * 3);
|
|
78
|
+
getGptImageGifSheet(w, h, frameCount);
|
|
79
|
+
candidates.push({ width: w, height: h });
|
|
80
|
+
}
|
|
81
|
+
candidates.sort((a, b) => b.width * b.height - a.width * a.height);
|
|
82
|
+
if (!candidates.length)
|
|
83
|
+
throw new Error('GIF aspect ratio cannot fit a supported sheet');
|
|
84
|
+
return candidates[0];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=gptImageGif.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gptImageGif.js","sourceRoot":"","sources":["../../src/lib/gptImageGif.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,UAAU,qBAAqB,CAAC,UAAU,GAAG,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC,S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,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;QACtD,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACtC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACzF,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -1,14 +1,63 @@
|
|
|
1
|
+
import { resolveGptImageGifSize } from './gptImageGif.js';
|
|
2
|
+
export { resolveGptImageGifSize } from './gptImageGif.js';
|
|
1
3
|
import { ApiError } from '../ApiClient/index.js';
|
|
2
4
|
const GPT_IMAGE_MODEL_IDS = new Set([
|
|
3
5
|
'gpt-image-2',
|
|
4
6
|
'gpt-image-2.5-sunburst',
|
|
5
|
-
'gpt-image-2.5-flare'
|
|
7
|
+
'gpt-image-2.5-flare',
|
|
8
|
+
'gpt-image-2.6-sunburst',
|
|
9
|
+
'gpt-image-2.6-flare'
|
|
6
10
|
]);
|
|
7
11
|
export function isGptImageModel(modelId) {
|
|
8
12
|
return modelId !== undefined && GPT_IMAGE_MODEL_IDS.has(modelId);
|
|
9
13
|
}
|
|
10
14
|
export function validateGptImageOptions(params) {
|
|
11
|
-
var _a, _b;
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
const is26 = params.modelId === 'gpt-image-2.6-sunburst' || params.modelId === 'gpt-image-2.6-flare';
|
|
17
|
+
const advancedFormat = params.outputFormat === 'gif';
|
|
18
|
+
if (!is26 &&
|
|
19
|
+
(advancedFormat ||
|
|
20
|
+
params.gptImageComplexity !== undefined ||
|
|
21
|
+
params.gptImageFrameCount !== undefined ||
|
|
22
|
+
params.gptImageFrameDurationMs !== undefined ||
|
|
23
|
+
params.gptImageMarkupUrl !== undefined)) {
|
|
24
|
+
throw new Error('GIF, complexity and markup options require GPT Image 2.6');
|
|
25
|
+
}
|
|
26
|
+
if (is26) {
|
|
27
|
+
if (params.outputFormat === 'gif' &&
|
|
28
|
+
(!params.sizePreset || params.sizePreset === 'custom' || params.width || params.height))
|
|
29
|
+
resolveGptImageGifSize(params.width, params.height, params.gptImageFrameCount);
|
|
30
|
+
if (params.gptImageComplexity !== undefined &&
|
|
31
|
+
!['low', 'medium', 'high'].includes(params.gptImageComplexity))
|
|
32
|
+
throw new Error('Unsupported GPT Image complexity');
|
|
33
|
+
if (advancedFormat &&
|
|
34
|
+
(((_a = params.contextImages) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
35
|
+
params.gptImageMask ||
|
|
36
|
+
params.gptImageMaskUrl ||
|
|
37
|
+
params.gptImageMarkupUrl))
|
|
38
|
+
throw new Error('GIF output require text-to-image generation');
|
|
39
|
+
if (params.outputFormat !== 'gif' &&
|
|
40
|
+
(params.gptImageFrameCount !== undefined || params.gptImageFrameDurationMs !== undefined))
|
|
41
|
+
throw new Error('Frame options require GIF output');
|
|
42
|
+
if (params.gptImageFrameCount !== undefined &&
|
|
43
|
+
(!Number.isInteger(params.gptImageFrameCount) ||
|
|
44
|
+
params.gptImageFrameCount < 2 ||
|
|
45
|
+
params.gptImageFrameCount > 16))
|
|
46
|
+
throw new Error('GIF frame count must be an integer from 2 to 16');
|
|
47
|
+
if (params.gptImageFrameDurationMs !== undefined &&
|
|
48
|
+
(!Number.isInteger(params.gptImageFrameDurationMs) ||
|
|
49
|
+
params.gptImageFrameDurationMs < 20 ||
|
|
50
|
+
params.gptImageFrameDurationMs > 2000))
|
|
51
|
+
throw new Error('GIF frame duration must be an integer from 20 to 2000 ms');
|
|
52
|
+
if (params.gptImageMarkupUrl !== undefined &&
|
|
53
|
+
(!params.gptImageMarkupUrl.trim() ||
|
|
54
|
+
!((_b = params.contextImages) === null || _b === void 0 ? void 0 : _b.length) ||
|
|
55
|
+
params.gptImageMask ||
|
|
56
|
+
params.gptImageMaskUrl))
|
|
57
|
+
throw new Error('Markup requires a first edit reference and cannot combine with a mask');
|
|
58
|
+
if (params.gptImageBackground === 'transparent' && advancedFormat)
|
|
59
|
+
throw new Error('Transparent output requires PNG or WebP');
|
|
60
|
+
}
|
|
12
61
|
if (!isGptImageModel(params.modelId)) {
|
|
13
62
|
if (params.gptImageMask || params.gptImageMaskUrl)
|
|
14
63
|
throw new Error('GPT Image masks require a GPT Image model');
|
|
@@ -16,7 +65,7 @@ export function validateGptImageOptions(params) {
|
|
|
16
65
|
}
|
|
17
66
|
if (params.gptImageMask && params.gptImageMaskUrl)
|
|
18
67
|
throw new Error('Provide one GPT Image mask');
|
|
19
|
-
if (params.gptImageMask && !((
|
|
68
|
+
if (params.gptImageMask && !((_c = params.contextImages) === null || _c === void 0 ? void 0 : _c.length))
|
|
20
69
|
throw new Error('GPT Image mask requires a first reference image');
|
|
21
70
|
if (params.contextImages !== undefined &&
|
|
22
71
|
(!Array.isArray(params.contextImages) ||
|
|
@@ -27,7 +76,7 @@ export function validateGptImageOptions(params) {
|
|
|
27
76
|
if (params.gptImageMaskUrl !== undefined &&
|
|
28
77
|
(typeof params.gptImageMaskUrl !== 'string' ||
|
|
29
78
|
!params.gptImageMaskUrl.trim() ||
|
|
30
|
-
!((
|
|
79
|
+
!((_d = params.contextImages) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
31
80
|
throw new Error('GPT Image mask requires a mask URL and a first reference image');
|
|
32
81
|
}
|
|
33
82
|
const is25 = params.modelId !== 'gpt-image-2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,aAAa;IACb,wBAAwB;IACxB,qBAAqB;CACtB,CAAC,CAAC;AAEH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,OAAO,KAAK,SAAS,IAAI,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAA0B;;IAChE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe;YAC/C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACjG,IAAI,MAAM,CAAC,YAAY,IAAI,CAAC,CAAA,MAAA,MAAM,CAAC,aAAa,0CAAE,MAAM,CAAA;QACtD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,IACE,MAAM,CAAC,aAAa,KAAK,SAAS;QAClC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;YACnC,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,EAAE;YAChC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC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B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAC9E,CAAC;AACJ,CAAC"}
|
package/dist-esm/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.75.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=22"
|
|
9
9
|
},
|
|
@@ -127,7 +127,8 @@
|
|
|
127
127
|
"test:result-download-endpoint": "npm run build && node scripts/check-result-download-endpoint.cjs",
|
|
128
128
|
"test:remote-media-hosts": "npm run build && node scripts/check-remote-media-hosts.cjs",
|
|
129
129
|
"test:large-data-uri": "npm run build && node scripts/check-large-data-uri.cjs",
|
|
130
|
-
"test:world-builds": "npm run build && node scripts/check-world-builds.cjs"
|
|
130
|
+
"test:world-builds": "npm run build && node scripts/check-world-builds.cjs",
|
|
131
|
+
"test:gpt-image-26": "npm run build && node scripts/check-gpt-image-26.cjs"
|
|
131
132
|
},
|
|
132
133
|
"repository": {
|
|
133
134
|
"type": "git",
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
"homepage": "https://github.com/Sogni-AI/sogni-client#readme",
|
|
142
143
|
"dependencies": {
|
|
143
144
|
"@lukeed/uuid": "^2.0.1",
|
|
144
|
-
"@sogni-ai/sogni-protocol": "1.0.0-alpha.
|
|
145
|
+
"@sogni-ai/sogni-protocol": "1.0.0-alpha.59",
|
|
145
146
|
"@types/js-cookie": "^3.0.6",
|
|
146
147
|
"@types/lodash": "^4.17.23",
|
|
147
148
|
"@types/ws": "^8.5.13",
|
|
@@ -52,9 +52,11 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
52
52
|
"faetastic-xl",
|
|
53
53
|
"zavychroma-xl",
|
|
54
54
|
"pony-faetality",
|
|
55
|
-
"dreamshaper-xl"
|
|
55
|
+
"dreamshaper-xl",
|
|
56
|
+
"gpt-image-2.6-sunburst",
|
|
57
|
+
"gpt-image-2.6-flare"
|
|
56
58
|
],
|
|
57
|
-
"description": "DO NOT SET THIS PARAMETER unless the user names a specific model, asks for a very complex image render, asks for a video storyboard/storyboard sheet/contact sheet/panel layout image, asks for anime without naming a model, requests permitted NSFW/nudity content, or explicitly asks for Z-image/Z-image Turbo/Krea 2 Turbo image-to-image. The app auto-selects based on quality settings. Set \"gpt-image-2.5-flare\" when the user asks for a ChatGPT, OpenAI, GPT, or GPT Image image/model without naming a version. Set \"gpt-image-2\" only when the user explicitly names GPT Image 2, GPT-2, or gpt-image-2; GPT Image 2 is never a default. Set \"gpt-image-2.5-sunburst\" when the user explicitly requests very strong text rendering, and by default for video storyboards and other complex single-image renders that need dense labels, crisp typography, multi-panel composition, timing notes, foley notes, professional storyboard-sheet layout, or a comprehensive character/mascot/model sheet with turnarounds, expressions, accessories, palette swatches, and brand notes. Set \"one-obsession-v22\" when the user asks for an anime or anime-style image and has not named a specific image model. Set \"z-turbo\" when the user asks for Z-image Turbo; set \"z-image\" when they ask for Z-image without Turbo. Set \"krea-2-turbo\" when the user asks for Krea 2 Turbo. Set \"flux-3-klein\" when the user asks for FLUX 3 or FLUX 3 Image Klein. If the user names another image model, honor that requested model instead. A model preference usually does not change which tool to use; the Z-image and Krea 2 Turbo image-to-image exception uses sourceImageIndex plus starting_image_strength on this tool. NSFW rule: GPT Image models and Qwen image models CANNOT do nudity. For permitted NSFW/nudity content, prefer \"dark-beast-krea2\", then \"dark-beast-z-turbo\"; \"chroma1-hd\", \"pony-v7\", \"chroma-detail\", \"chroma-v46-flash\", \"z-turbo\", \"moss-image\", and \"moss-image-8step\" are compatible fallbacks. GPT Image 2.5 adds two distinct models: use \"gpt-image-2.5-sunburst\" for an explicit Sunburst request and \"gpt-image-2.5-flare\" for an explicit Flare request. For GPT Image 2.5 without a named variant, use Flare. Preserve explicit GPT Image 2.0 as \"gpt-image-2\". Sunburst is positioned for difficult images and precise edits; Flare for faster everyday generation. Both generate and edit. Model choice is independent of rendering quality. Set \"moss-image\" when the user requests MOSS-Image or MOSS-Image SFT. Set \"moss-image-8step\" when the user requests MOSS 8-step or MOSS DMD; this preset uses 8 steps and guidance 1. Both MOSS presets are uncensored and support compatible Personal LoRAs. MOSS-Image SFT is text-to-image only; it has no uploaded-image instruction-editing input. For its JSON layouts, send one complete literal layout per call; numberOfVariations varies seeds. Use separate calls for different layouts, and do not put Dynamic Prompt choices inside layout JSON."
|
|
59
|
+
"description": "DO NOT SET THIS PARAMETER unless the user names a specific model, requests an animated GIF, asks for a very complex image render, asks for a video storyboard/storyboard sheet/contact sheet/panel layout image, asks for anime without naming a model, requests permitted NSFW/nudity content, or explicitly asks for Z-image/Z-image Turbo/Krea 2 Turbo image-to-image. The app auto-selects based on quality settings. For an animated GIF, select gpt-image-2.6-flare unless the user names another compatible 2.6 variant; use generate_image with text only. Set \"gpt-image-2.5-flare\" when the user asks for a ChatGPT, OpenAI, GPT, or GPT Image image/model without naming a version. Set \"gpt-image-2\" only when the user explicitly names GPT Image 2, GPT-2, or gpt-image-2; GPT Image 2 is never a default. Set \"gpt-image-2.5-sunburst\" when the user explicitly requests very strong text rendering, and by default for video storyboards and other complex single-image renders that need dense labels, crisp typography, multi-panel composition, timing notes, foley notes, professional storyboard-sheet layout, or a comprehensive character/mascot/model sheet with turnarounds, expressions, accessories, palette swatches, and brand notes. Set \"one-obsession-v22\" when the user asks for an anime or anime-style image and has not named a specific image model. Set \"z-turbo\" when the user asks for Z-image Turbo; set \"z-image\" when they ask for Z-image without Turbo. Set \"krea-2-turbo\" when the user asks for Krea 2 Turbo. Set \"flux-3-klein\" when the user asks for FLUX 3 or FLUX 3 Image Klein. If the user names another image model, honor that requested model instead. A model preference usually does not change which tool to use; the Z-image and Krea 2 Turbo image-to-image exception uses sourceImageIndex plus starting_image_strength on this tool. NSFW rule: GPT Image models and Qwen image models CANNOT do nudity. For permitted NSFW/nudity content, prefer \"dark-beast-krea2\", then \"dark-beast-z-turbo\"; \"chroma1-hd\", \"pony-v7\", \"chroma-detail\", \"chroma-v46-flash\", \"z-turbo\", \"moss-image\", and \"moss-image-8step\" are compatible fallbacks. GPT Image 2.5 adds two distinct models: use \"gpt-image-2.5-sunburst\" for an explicit Sunburst request and \"gpt-image-2.5-flare\" for an explicit Flare request. For GPT Image 2.5 without a named variant, use Flare. Preserve explicit GPT Image 2.0 as \"gpt-image-2\". Sunburst is positioned for difficult images and precise edits; Flare for faster everyday generation. Both generate and edit. Model choice is independent of rendering quality. Set \"moss-image\" when the user requests MOSS-Image or MOSS-Image SFT. Set \"moss-image-8step\" when the user requests MOSS 8-step or MOSS DMD; this preset uses 8 steps and guidance 1. Both MOSS presets are uncensored and support compatible Personal LoRAs. MOSS-Image SFT is text-to-image only; it has no uploaded-image instruction-editing input. For its JSON layouts, send one complete literal layout per call; numberOfVariations varies seeds. Use separate calls for different layouts, and do not put Dynamic Prompt choices inside layout JSON."
|
|
58
60
|
},
|
|
59
61
|
"width": {
|
|
60
62
|
"type": "number",
|
|
@@ -107,7 +109,8 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
107
109
|
"png",
|
|
108
110
|
"jpg",
|
|
109
111
|
"jpeg",
|
|
110
|
-
"webp"
|
|
112
|
+
"webp",
|
|
113
|
+
"gif"
|
|
111
114
|
],
|
|
112
115
|
"description": "Optional output file format for generated images. Set only when the user explicitly requests PNG, JPG/JPEG, or WebP. Hosts should normalize \"jpeg\" to the Sogni project format \"jpg\"."
|
|
113
116
|
},
|
|
@@ -148,6 +151,27 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
148
151
|
"type": "number"
|
|
149
152
|
},
|
|
150
153
|
"description": "Strength for each LoRA in loras, in the same order. Omitting the array uses 1.0 for every LoRA, which is not each LoRA's catalog default — krea2-chest-firmness, krea2-nipple-projection and krea2-height default to 0 (no effect) — so prefer explicit values. Do NOT clamp to 0-1: most Krea 2 LoRAs are bipolar, so krea2-warm-light warms the grade at 2 and cools it at -2. Usable bands vary per LoRA — roughly -2..5 for krea2-detail-enhancer, -3..3 for krea2-warm-light, 3..9 for krea2-candid, 0.5..1 for krea2-realism-engine, 1..2 for the filter-bypass pair. Scale the magnitude to how strongly the user asked; the server clamps out-of-range values, and pushing past a LoRA's recommended band costs image quality rather than adding effect. Preserve explicit user values. Example: loras=[\"krea2-detail-enhancer\",\"krea2-amateur\"], loraStrengths=[3,-2]."
|
|
154
|
+
},
|
|
155
|
+
"gptImageComplexity": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"enum": [
|
|
158
|
+
"low",
|
|
159
|
+
"medium",
|
|
160
|
+
"high"
|
|
161
|
+
],
|
|
162
|
+
"description": "GPT Image 2.6 planning complexity. Default high; quality is separate."
|
|
163
|
+
},
|
|
164
|
+
"gptImageFrameCount": {
|
|
165
|
+
"type": "integer",
|
|
166
|
+
"minimum": 2,
|
|
167
|
+
"maximum": 16,
|
|
168
|
+
"description": "GPT Image 2.6 GIF only: frame count, default 9. Frames must fit the request pixel budget."
|
|
169
|
+
},
|
|
170
|
+
"gptImageFrameDurationMs": {
|
|
171
|
+
"type": "integer",
|
|
172
|
+
"minimum": 20,
|
|
173
|
+
"maximum": 2000,
|
|
174
|
+
"description": "GPT Image 2.6 GIF only: milliseconds per frame, rounded to 10 ms; default 200."
|
|
151
175
|
}
|
|
152
176
|
},
|
|
153
177
|
"required": [
|
|
@@ -536,7 +560,9 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
536
560
|
"qwen",
|
|
537
561
|
"krea-identity-edit",
|
|
538
562
|
"dark-beast-krea2-identity-edit",
|
|
539
|
-
"flux-3-klein"
|
|
563
|
+
"flux-3-klein",
|
|
564
|
+
"gpt-image-2.6-sunburst",
|
|
565
|
+
"gpt-image-2.6-flare"
|
|
540
566
|
],
|
|
541
567
|
"description": "The app auto-selects Fast→Qwen Lightning and HQ/Pro→full Qwen only for ordinary identity-neutral edits. REQUIRED IDENTITY DEFAULT: set \"krea-identity-edit\" whenever an edit of a referenced person or character must keep likeness or character identity while changing clothing, hair or makeup, pose or position, face/head/body, background, lighting, or visual style. Infer that semantic intent in any language; never route from keyword or regex matching. Also use it for a non-Pro single-character sheet. This default applies even when the user did not name Krea; an explicitly requested model always wins. Set \"dark-beast-krea2-identity-edit\" only when the user explicitly requests that model, its uncensored/community variant, or dark_beast_krea2_identity_edit_v1_2. Set \"gpt-image-2\" only when the user explicitly names legacy GPT Image 2 (GPT Image 2, GPT-2, or gpt-image-2); it is never a default. A ChatGPT, OpenAI, GPT, or GPT Image edit request that names no version uses \"gpt-image-2.5-flare\". Set \"gpt-image-2.5-sunburst\" when precise typography, dense labels, or a professional multi-panel layout is the primary requirement; Pro character sheets use Sunburst unless the user names another model. If GPT Image 2.5 Sunburst is unavailable for detail-critical layout work, fall back to full \"qwen\", never \"qwen-lightning\". Krea identity edit models require at least one reference image, accept up to two context images, and work best at 512-2048px. Set \"flux-3-klein\" when the user asks for FLUX 3 or FLUX 3 Image Klein; it accepts 1-10 reference images and works at 256-4096px, including 4K. For it, describe the whole result as a full scene caption that folds the requested change into a description of the reference, and refer to references in order (the first image, the second image); guidance is fixed and a negative prompt has no effect, so do not send one. Let the model tier and worker choose current steps, guidance, sampler, scheduler, grounding, and reference-boost defaults; do not send a negative prompt. When Krea is selected, override the generic prompt-length guidance with a concise 1-4 sentence delta instruction; name only the requested change and details that must remain fixed. Put the base scene/image first and an optional person/detail reference second. Z-image, Z-image Turbo, and base Krea 2 Turbo are generate_image img2img models, not edit_image selectors. If the user names another edit/image model, honor it. GPT Image 2 always processes input images at high fidelity; do not set input_fidelity. GPT Image 2.5 adds two distinct models: use \"gpt-image-2.5-sunburst\" for an explicit Sunburst request and \"gpt-image-2.5-flare\" for an explicit Flare request. For GPT Image 2.5 without a named variant, use Flare. Preserve explicit GPT Image 2.0 as \"gpt-image-2\". Sunburst is positioned for difficult images and precise edits; Flare for faster everyday generation. Both generate and edit. Model choice is independent of rendering quality."
|
|
542
568
|
},
|
|
@@ -624,6 +650,19 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
624
650
|
"type": "number"
|
|
625
651
|
},
|
|
626
652
|
"description": "Strength for each LoRA in loras, in the same order. Omitting the array uses 1.0 for every LoRA, which is not each LoRA's catalog default — krea2-chest-firmness, krea2-nipple-projection and krea2-height default to 0 (no effect) — so prefer explicit values. Do NOT clamp to 0-1: most Krea 2 LoRAs are bipolar, so krea2-warm-light warms the grade at 2 and cools it at -2. Usable bands vary per LoRA — roughly -2..5 for krea2-detail-enhancer, -3..3 for krea2-warm-light, 3..9 for krea2-candid, 0.5..1 for krea2-realism-engine, 1..2 for the filter-bypass pair. Scale the magnitude to how strongly the user asked; the server clamps out-of-range values, and pushing past a LoRA's recommended band costs image quality rather than adding effect. Preserve explicit user values. Example: loras=[\"krea2-detail-enhancer\",\"krea2-amateur\"], loraStrengths=[3,-2]."
|
|
653
|
+
},
|
|
654
|
+
"gptImageComplexity": {
|
|
655
|
+
"type": "string",
|
|
656
|
+
"enum": [
|
|
657
|
+
"low",
|
|
658
|
+
"medium",
|
|
659
|
+
"high"
|
|
660
|
+
],
|
|
661
|
+
"description": "GPT Image 2.6 planning complexity. Default high; quality is separate."
|
|
662
|
+
},
|
|
663
|
+
"markup_image_url": {
|
|
664
|
+
"type": "string",
|
|
665
|
+
"description": "GPT Image 2.6 edit annotation layer for the first reference. Cannot combine with mask_image_url."
|
|
627
666
|
}
|
|
628
667
|
},
|
|
629
668
|
"required": [
|
|
@@ -694,7 +733,7 @@ export const SOGNI_HOSTED_TOOLS_MANIFEST: unknown = {
|
|
|
694
733
|
"fast",
|
|
695
734
|
"hq"
|
|
696
735
|
],
|
|
697
|
-
"description": "DO NOT SET THIS PARAMETER unless the user explicitly asks for \"high quality\" or \"fast\". The app auto-selects based on quality settings."
|
|
736
|
+
"description": "DO NOT SET THIS PARAMETER unless the user explicitly asks for \"high quality\" or \"fast\". The app auto-selects based on quality settings. For an animated GIF, select gpt-image-2.6-flare unless the user names another compatible 2.6 variant; use generate_image with text only."
|
|
698
737
|
},
|
|
699
738
|
"scale": {
|
|
700
739
|
"type": "number",
|
package/src/Chat/modelRouting.ts
CHANGED
|
@@ -100,6 +100,8 @@ export const PREFERRED_MODEL_IDS = {
|
|
|
100
100
|
gptImage2: 'gpt-image-2',
|
|
101
101
|
gptImage25Sunburst: 'gpt-image-2.5-sunburst',
|
|
102
102
|
gptImage25Flare: 'gpt-image-2.5-flare',
|
|
103
|
+
gptImage26Flare: 'gpt-image-2.6-flare',
|
|
104
|
+
gptImage26Sunburst: 'gpt-image-2.6-sunburst',
|
|
103
105
|
// Seedream 5.0 Pro Uncensored: requires the one-time agreement Seedance 2.5
|
|
104
106
|
// Uncensored uses, and is only ever chosen by name.
|
|
105
107
|
seedream5ProUncensored: 'seedream-5-0-pro-uncensored',
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
validateNumber,
|
|
20
20
|
validateCustomImageSize,
|
|
21
21
|
validateGptImageOptions,
|
|
22
|
+
resolveGptImageGifSize,
|
|
22
23
|
validateSeedreamOptions,
|
|
23
24
|
validateVideoSize,
|
|
24
25
|
validateTeacacheThreshold,
|
|
@@ -1613,7 +1614,12 @@ function applyImageParams(
|
|
|
1613
1614
|
}
|
|
1614
1615
|
keyFrame.sizePreset = effectiveSizePreset;
|
|
1615
1616
|
|
|
1616
|
-
if (effectiveSizePreset === 'custom'
|
|
1617
|
+
if (params.outputFormat === 'gif' && (!effectiveSizePreset || effectiveSizePreset === 'custom' || params.width || params.height)) {
|
|
1618
|
+
const dimensions = resolveGptImageGifSize(params.width, params.height, params.gptImageFrameCount);
|
|
1619
|
+
keyFrame.sizePreset = 'custom';
|
|
1620
|
+
keyFrame.width = dimensions.width;
|
|
1621
|
+
keyFrame.height = dimensions.height;
|
|
1622
|
+
} else if (effectiveSizePreset === 'custom' && params.width && params.height) {
|
|
1617
1623
|
keyFrame.width = validateCustomImageSize(params.width, {
|
|
1618
1624
|
modelId: params.modelId,
|
|
1619
1625
|
propertyName: 'Width'
|
|
@@ -1624,6 +1630,9 @@ function applyImageParams(
|
|
|
1624
1630
|
});
|
|
1625
1631
|
}
|
|
1626
1632
|
validateGptImageOptions(params);
|
|
1633
|
+
for (const field of ['gptImageComplexity', 'gptImageFrameCount', 'gptImageFrameDurationMs', 'gptImageMarkupUrl'] as const) {
|
|
1634
|
+
if (params[field] !== undefined) keyFrame[field] = params[field];
|
|
1635
|
+
}
|
|
1627
1636
|
validateSeedreamOptions(params);
|
|
1628
1637
|
if (params.gptImageMask) {
|
|
1629
1638
|
keyFrame.hasReferenceMask = true;
|
package/src/Projects/index.ts
CHANGED
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
import { getFileContentType } from './utils/fileContentType.js';
|
|
93
93
|
import { TokenType } from '../types/token.js';
|
|
94
94
|
import type { JobProvenance } from './types/JobProvenance.js';
|
|
95
|
-
import { getMaxContextImages, validateSampler, isGptImageModel } from '../lib/validation.js';
|
|
95
|
+
import { getMaxContextImages, validateSampler, isGptImageModel, resolveGptImageGifSize } from '../lib/validation.js';
|
|
96
96
|
import ModelTiersRaw, {
|
|
97
97
|
isAudioTier,
|
|
98
98
|
isComfyImageTier,
|
|
@@ -3343,12 +3343,21 @@ class ProjectsApi extends ApiGroup<ProjectApiEvents> {
|
|
|
3343
3343
|
sampler,
|
|
3344
3344
|
contextImages,
|
|
3345
3345
|
gptImageQuality,
|
|
3346
|
+
gptImageFrameCount,
|
|
3347
|
+
gptImageFrameDurationMs,
|
|
3348
|
+
gptImageComplexity,
|
|
3346
3349
|
outputFormat,
|
|
3347
3350
|
billingMode,
|
|
3348
3351
|
priorityMode
|
|
3349
3352
|
}: EstimateRequest): Promise<CostEstimation> {
|
|
3350
3353
|
let apiVersion = 2;
|
|
3351
3354
|
const modelOptions = await this.getModelOptions(model);
|
|
3355
|
+
if (outputFormat === 'gif' && (!sizePreset || sizePreset === 'custom' || width || height)) {
|
|
3356
|
+
const size = resolveGptImageGifSize(width, height, gptImageFrameCount);
|
|
3357
|
+
width = size.width;
|
|
3358
|
+
height = size.height;
|
|
3359
|
+
sizePreset = undefined;
|
|
3360
|
+
}
|
|
3352
3361
|
const pathParams = [
|
|
3353
3362
|
tokenType || 'spark',
|
|
3354
3363
|
network,
|
|
@@ -3379,6 +3388,9 @@ class ProjectsApi extends ApiGroup<ProjectApiEvents> {
|
|
|
3379
3388
|
}
|
|
3380
3389
|
const queryParams = new URLSearchParams();
|
|
3381
3390
|
if (gptImageQuality) queryParams.set('gptImageQuality', gptImageQuality);
|
|
3391
|
+
if (gptImageFrameCount !== undefined) queryParams.set('gptImageFrameCount', String(gptImageFrameCount));
|
|
3392
|
+
if (gptImageFrameDurationMs !== undefined) queryParams.set('gptImageFrameDurationMs', String(gptImageFrameDurationMs));
|
|
3393
|
+
if (gptImageComplexity !== undefined) queryParams.set('gptImageComplexity', gptImageComplexity);
|
|
3382
3394
|
if (outputFormat) queryParams.set('outputFormat', outputFormat);
|
|
3383
3395
|
if (billingMode) queryParams.set('billingMode', billingMode);
|
|
3384
3396
|
if (priorityMode !== undefined) queryParams.set('priorityMode', String(priorityMode));
|
|
@@ -46,7 +46,7 @@ export interface SizePreset {
|
|
|
46
46
|
aspect: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export type ImageOutputFormat = 'png' | 'jpg' | 'webp';
|
|
49
|
+
export type ImageOutputFormat = 'png' | 'jpg' | 'webp' | 'gif';
|
|
50
50
|
/**
|
|
51
51
|
* GPT Image quality preset. `xhigh` and `max` need GPT Image 2.5.
|
|
52
52
|
*
|
|
@@ -1087,6 +1087,14 @@ export interface ImageProjectParams
|
|
|
1087
1087
|
gptImageBackground?: GptImageBackground;
|
|
1088
1088
|
/** JPEG/WebP compression (0–100). Omit for PNG. */
|
|
1089
1089
|
gptImageOutputCompression?: number;
|
|
1090
|
+
/** GPT Image 2.6 planning effort. Omitted uses the provider's high setting. */
|
|
1091
|
+
gptImageComplexity?: 'low' | 'medium' | 'high';
|
|
1092
|
+
/** Animated GIF only: 2–16 frames, default 9. */
|
|
1093
|
+
gptImageFrameCount?: number;
|
|
1094
|
+
/** Animated GIF only: 20–2000 ms per frame, rounded to 10 ms by OpenAI. */
|
|
1095
|
+
gptImageFrameDurationMs?: number;
|
|
1096
|
+
/** Annotation overlay for the first edit reference; cannot combine with a mask. */
|
|
1097
|
+
gptImageMarkupUrl?: string;
|
|
1090
1098
|
/** PNG alpha mask URL or data URI matching contextImages[0]. Transparent regions are edited. */
|
|
1091
1099
|
gptImageMaskUrl?: string;
|
|
1092
1100
|
/** PNG alpha mask, uploaded in the referenceMask asset slot for durable replay. */
|
|
@@ -1333,6 +1341,10 @@ export interface EstimateRequest {
|
|
|
1333
1341
|
* Output format, when estimating models with format-specific request metadata.
|
|
1334
1342
|
*/
|
|
1335
1343
|
outputFormat?: ImageOutputFormat;
|
|
1344
|
+
/** GIF frame count used by the quote; default 9. */
|
|
1345
|
+
gptImageFrameCount?: number;
|
|
1346
|
+
gptImageFrameDurationMs?: number;
|
|
1347
|
+
gptImageComplexity?: 'low' | 'medium' | 'high';
|
|
1336
1348
|
/**
|
|
1337
1349
|
* Billing intent of the job being quoted. 'tokens' opts out of plan coverage,
|
|
1338
1350
|
* so the estimate carries no `dailyFairUsePct`.
|
package/src/index.ts
CHANGED
|
@@ -704,7 +704,8 @@ export class SogniClient {
|
|
|
704
704
|
// An API-key session learns its address from the socket's authenticated
|
|
705
705
|
// frame; before that arrives, `me()` answers it.
|
|
706
706
|
this.projects._setAccountAddressResolver(
|
|
707
|
-
async () =>
|
|
707
|
+
async () =>
|
|
708
|
+
this.account.currentAccount.walletAddress || (await this.account.me()).walletAddress
|
|
708
709
|
);
|
|
709
710
|
this.stats = new StatsApi(config);
|
|
710
711
|
this.chat = new ChatApi(config, this.projects);
|
|
@@ -866,3 +867,10 @@ export type {
|
|
|
866
867
|
WorldBuildWaiting,
|
|
867
868
|
WorldBuildWaitingReason
|
|
868
869
|
} from './Worlds/types.js';
|
|
870
|
+
|
|
871
|
+
export {
|
|
872
|
+
getGptImageGifLayouts,
|
|
873
|
+
getGptImageGifFrameBounds,
|
|
874
|
+
getGptImageGifSheet,
|
|
875
|
+
resolveGptImageGifSize
|
|
876
|
+
} from './lib/gptImageGif.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** GIF frames are rendered on a supported image sheet, including unused cells. */
|
|
2
|
+
export function getGptImageGifLayouts(frameCount = 9): { columns: number; rows: number }[] {
|
|
3
|
+
if (!Number.isInteger(frameCount) || frameCount < 2 || frameCount > 16) {
|
|
4
|
+
throw new Error('GIF frame count must be 2–16');
|
|
5
|
+
}
|
|
6
|
+
// Provider validation and measured usage, 2026-11-04: even two frames use
|
|
7
|
+
// an eight-cell sheet. Nine uses 3x3; ten through twelve use 4x3/3x4; the rest use 4x4.
|
|
8
|
+
return frameCount <= 8
|
|
9
|
+
? [
|
|
10
|
+
{ columns: 4, rows: 2 },
|
|
11
|
+
{ columns: 2, rows: 4 }
|
|
12
|
+
]
|
|
13
|
+
: frameCount === 9
|
|
14
|
+
? [{ columns: 3, rows: 3 }]
|
|
15
|
+
: frameCount <= 12
|
|
16
|
+
? [
|
|
17
|
+
{ columns: 4, rows: 3 },
|
|
18
|
+
{ columns: 3, rows: 4 }
|
|
19
|
+
]
|
|
20
|
+
: [{ columns: 4, rows: 4 }];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getGptImageGifFrameBounds(frameCount = 9) {
|
|
24
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
25
|
+
const cells = layouts[0].columns * layouts[0].rows;
|
|
26
|
+
return {
|
|
27
|
+
minDimension: 16,
|
|
28
|
+
dimensionStep: 16,
|
|
29
|
+
maxAspectRatio: 3,
|
|
30
|
+
maxWidth: Math.max(...layouts.map((layout) => 3840 / layout.columns)),
|
|
31
|
+
maxHeight: Math.max(...layouts.map((layout) => 3840 / layout.rows)),
|
|
32
|
+
minPixels: Math.ceil(655360 / cells),
|
|
33
|
+
maxPixels: Math.floor(8294400 / cells)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The most expensive valid orientation is the reservation envelope. */
|
|
38
|
+
export function getGptImageGifSheet(width: number, height: number, frameCount = 9) {
|
|
39
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
40
|
+
if (
|
|
41
|
+
![width, height].every((value) => Number.isInteger(value) && value > 0 && value % 16 === 0) ||
|
|
42
|
+
Math.max(width, height) / Math.min(width, height) > 3
|
|
43
|
+
) {
|
|
44
|
+
throw new Error('GIF frame dimensions must be positive multiples of 16 within 3:1');
|
|
45
|
+
}
|
|
46
|
+
const sheets = layouts
|
|
47
|
+
.map((layout) => ({
|
|
48
|
+
...layout,
|
|
49
|
+
width: width * layout.columns,
|
|
50
|
+
height: height * layout.rows
|
|
51
|
+
}))
|
|
52
|
+
.filter(
|
|
53
|
+
(sheet) =>
|
|
54
|
+
Math.max(sheet.width, sheet.height) <= 3840 &&
|
|
55
|
+
Math.max(sheet.width, sheet.height) / Math.min(sheet.width, sheet.height) <= 3 &&
|
|
56
|
+
sheet.width * sheet.height >= 655360 &&
|
|
57
|
+
sheet.width * sheet.height <= 8294400
|
|
58
|
+
);
|
|
59
|
+
if (!sheets.length) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
'GIF frames cannot fit a supported sheet: use smaller or larger frames within the 655360–8294400 pixel budget and 3840 sheet edge limit'
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
// Every orientation has the same area. The closest to square has the
|
|
65
|
+
// greatest output-token budget at every supported quality.
|
|
66
|
+
sheets.sort(
|
|
67
|
+
(a, b) =>
|
|
68
|
+
Math.max(a.width, a.height) / Math.min(a.width, a.height) -
|
|
69
|
+
Math.max(b.width, b.height) / Math.min(b.width, b.height)
|
|
70
|
+
);
|
|
71
|
+
return sheets[0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Preserve explicit pixels; infer omitted dimensions within the sheet limits. */
|
|
75
|
+
export function resolveGptImageGifSize(
|
|
76
|
+
width?: number,
|
|
77
|
+
height?: number,
|
|
78
|
+
frameCount = 9,
|
|
79
|
+
ratio = 1
|
|
80
|
+
): { width: number; height: number } {
|
|
81
|
+
const layouts = getGptImageGifLayouts(frameCount);
|
|
82
|
+
if (!Number.isFinite(ratio) || ratio < 1 / 3 || ratio > 3)
|
|
83
|
+
throw new Error('GIF aspect ratio must be within 3:1');
|
|
84
|
+
if (width !== undefined || height !== undefined) {
|
|
85
|
+
const w = width ?? Math.max(16, Math.round((height! * ratio) / 16) * 16);
|
|
86
|
+
const h = height ?? Math.max(16, Math.round(w / ratio / 16) * 16);
|
|
87
|
+
getGptImageGifSheet(w, h, frameCount);
|
|
88
|
+
return { width: w, height: h };
|
|
89
|
+
}
|
|
90
|
+
const candidates: { width: number; height: number }[] = [];
|
|
91
|
+
for (const layout of layouts) {
|
|
92
|
+
const sheetRatio = (ratio * layout.columns) / layout.rows;
|
|
93
|
+
if (sheetRatio < 1 / 3 || sheetRatio > 3) continue;
|
|
94
|
+
const area = Math.min(
|
|
95
|
+
896 ** 2,
|
|
96
|
+
8294400 / (layout.columns * layout.rows),
|
|
97
|
+
(3840 / layout.columns) ** 2 / ratio,
|
|
98
|
+
(3840 / layout.rows) ** 2 * ratio
|
|
99
|
+
);
|
|
100
|
+
let w = Math.floor(Math.sqrt(area * ratio) / 16) * 16;
|
|
101
|
+
let h = Math.floor(Math.sqrt(area / ratio) / 16) * 16;
|
|
102
|
+
w = Math.min(w, h * 3);
|
|
103
|
+
h = Math.min(h, w * 3);
|
|
104
|
+
getGptImageGifSheet(w, h, frameCount);
|
|
105
|
+
candidates.push({ width: w, height: h });
|
|
106
|
+
}
|
|
107
|
+
candidates.sort((a, b) => b.width * b.height - a.width * a.height);
|
|
108
|
+
if (!candidates.length) throw new Error('GIF aspect ratio cannot fit a supported sheet');
|
|
109
|
+
return candidates[0];
|
|
110
|
+
}
|