@nodaro/shared 3.60.1 → 3.62.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/{chunk-5Y42RIGY.cjs → chunk-2D5LQFV4.cjs} +18 -332
- package/dist/chunk-2D5LQFV4.cjs.map +1 -0
- package/dist/{chunk-5G23AJBU.cjs → chunk-2HZGDZZN.cjs} +6 -6
- package/dist/{chunk-5G23AJBU.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
- package/dist/{chunk-DS2TOM32.js → chunk-2QKF7M2Z.js} +28 -4
- package/dist/chunk-2QKF7M2Z.js.map +1 -0
- package/dist/{chunk-CIOXUPCJ.cjs → chunk-2W745U4A.cjs} +228 -355
- package/dist/chunk-2W745U4A.cjs.map +1 -0
- package/dist/{chunk-LN3EVFRS.js → chunk-3OYO3XCC.js} +70 -6
- package/dist/chunk-3OYO3XCC.js.map +1 -0
- package/dist/{chunk-5HK5Z5OB.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
- package/dist/{chunk-5HK5Z5OB.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
- package/dist/{chunk-KOLC7AF2.js → chunk-5YYN5X57.js} +398 -38
- package/dist/chunk-5YYN5X57.js.map +1 -0
- package/dist/{chunk-RRPPXZ36.cjs → chunk-6CSXMWL4.cjs} +4 -4
- package/dist/{chunk-RRPPXZ36.cjs.map → chunk-6CSXMWL4.cjs.map} +1 -1
- package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
- package/dist/chunk-6FQBKI2A.cjs.map +1 -0
- package/dist/{chunk-G4XWVWRI.js → chunk-6G7NN4S4.js} +5 -4
- package/dist/chunk-6G7NN4S4.js.map +1 -0
- package/dist/{chunk-HOKWJXHA.cjs → chunk-A2PX5IRC.cjs} +31 -4
- package/dist/chunk-A2PX5IRC.cjs.map +1 -0
- package/dist/{chunk-W4M7TNXG.cjs → chunk-AFYTX4AI.cjs} +52 -43
- package/dist/chunk-AFYTX4AI.cjs.map +1 -0
- package/dist/chunk-ALRXY4QH.cjs +13 -0
- package/dist/chunk-ALRXY4QH.cjs.map +1 -0
- package/dist/chunk-AOJ6B7K4.cjs +351 -0
- package/dist/chunk-AOJ6B7K4.cjs.map +1 -0
- package/dist/{chunk-KJZVQIN4.js → chunk-C7POAYFE.js} +3 -3
- package/dist/{chunk-KJZVQIN4.js.map → chunk-C7POAYFE.js.map} +1 -1
- package/dist/{chunk-6Q6SI7AG.js → chunk-CC4V2B7S.js} +3 -3
- package/dist/{chunk-6Q6SI7AG.js.map → chunk-CC4V2B7S.js.map} +1 -1
- package/dist/{chunk-GNPJ2JLE.cjs → chunk-CIPPPT7E.cjs} +6 -6
- package/dist/{chunk-GNPJ2JLE.cjs.map → chunk-CIPPPT7E.cjs.map} +1 -1
- package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
- package/dist/chunk-CLAKSLXF.js.map +1 -0
- package/dist/chunk-CTANEPMY.js +61 -0
- package/dist/chunk-CTANEPMY.js.map +1 -0
- package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
- package/dist/chunk-D34K455O.cjs.map +1 -0
- package/dist/chunk-E2HZTGYX.js +331 -0
- package/dist/chunk-E2HZTGYX.js.map +1 -0
- package/dist/{chunk-SKFJIFEV.cjs → chunk-G3KVK7OU.cjs} +21 -21
- package/dist/{chunk-SKFJIFEV.cjs.map → chunk-G3KVK7OU.cjs.map} +1 -1
- package/dist/chunk-G4U3HW6W.js +453 -0
- package/dist/chunk-G4U3HW6W.js.map +1 -0
- package/dist/{chunk-EN2YI5TV.js → chunk-GSFB537T.js} +3 -3
- package/dist/{chunk-EN2YI5TV.js.map → chunk-GSFB537T.js.map} +1 -1
- package/dist/chunk-HRY7KGAE.cjs +506 -0
- package/dist/chunk-HRY7KGAE.cjs.map +1 -0
- package/dist/{chunk-6AJOTEVC.js → chunk-I2RQB7VG.js} +3 -3
- package/dist/{chunk-6AJOTEVC.js.map → chunk-I2RQB7VG.js.map} +1 -1
- package/dist/chunk-IDTKF5EX.cjs +48 -0
- package/dist/chunk-IDTKF5EX.cjs.map +1 -0
- package/dist/{chunk-DQIJPDHC.cjs → chunk-IWWVPR3W.cjs} +88 -11
- package/dist/chunk-IWWVPR3W.cjs.map +1 -0
- package/dist/{chunk-URLDVK67.js → chunk-JJNNM23P.js} +3 -3
- package/dist/{chunk-URLDVK67.js.map → chunk-JJNNM23P.js.map} +1 -1
- package/dist/{chunk-YHVEZVAO.js → chunk-JZGZ26YB.js} +6 -306
- package/dist/chunk-JZGZ26YB.js.map +1 -0
- package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
- package/dist/chunk-KHH54GRP.cjs.map +1 -0
- package/dist/{chunk-AXT7YNOR.cjs → chunk-KJSRPHJ2.cjs} +48 -47
- package/dist/chunk-KJSRPHJ2.cjs.map +1 -0
- package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
- package/dist/chunk-KL6GAYTT.js.map +1 -0
- package/dist/{chunk-AFQFGZN7.cjs → chunk-KYMHFVAZ.cjs} +8 -6
- package/dist/chunk-KYMHFVAZ.cjs.map +1 -0
- package/dist/{chunk-A6HRY3WF.cjs → chunk-MYJQELFN.cjs} +420 -37
- package/dist/chunk-MYJQELFN.cjs.map +1 -0
- package/dist/chunk-N5HH46JF.cjs +68 -0
- package/dist/chunk-N5HH46JF.cjs.map +1 -0
- package/dist/{chunk-BXNPO3PL.cjs → chunk-N7OUQK7E.cjs} +8 -8
- package/dist/{chunk-BXNPO3PL.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
- package/dist/{chunk-JKZVRKN3.js → chunk-NGKKNSK6.js} +31 -8
- package/dist/chunk-NGKKNSK6.js.map +1 -0
- package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
- package/dist/chunk-O7RZRUMZ.js.map +1 -0
- package/dist/{chunk-SCYBGTX6.js → chunk-PTD6EDUU.js} +3 -3
- package/dist/{chunk-SCYBGTX6.js.map → chunk-PTD6EDUU.js.map} +1 -1
- package/dist/{chunk-BDXXOEBZ.cjs → chunk-QWYFHQYK.cjs} +79 -54
- package/dist/chunk-QWYFHQYK.cjs.map +1 -0
- package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
- package/dist/chunk-RGNHHIMN.js.map +1 -0
- package/dist/{chunk-AZGONXWV.js → chunk-S24ZBUB4.js} +194 -299
- package/dist/chunk-S24ZBUB4.js.map +1 -0
- package/dist/{chunk-IV6IDECY.js → chunk-S5TMRJMX.js} +4 -4
- package/dist/{chunk-IV6IDECY.js.map → chunk-S5TMRJMX.js.map} +1 -1
- package/dist/chunk-SMOO5FAH.js +10 -0
- package/dist/chunk-SMOO5FAH.js.map +1 -0
- package/dist/{chunk-HYBACFYW.js → chunk-SYWR5G3T.js} +16 -7
- package/dist/chunk-SYWR5G3T.js.map +1 -0
- package/dist/{chunk-GWBQ3GPO.cjs → chunk-TRVWMKNE.cjs} +343 -53
- package/dist/chunk-TRVWMKNE.cjs.map +1 -0
- package/dist/{chunk-G6GMY5BC.js → chunk-UDDVDQMF.js} +298 -36
- package/dist/chunk-UDDVDQMF.js.map +1 -0
- package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
- package/dist/chunk-V24EPI5N.cjs.map +1 -0
- package/dist/{chunk-HDHLZK7C.cjs → chunk-VACPZPUA.cjs} +5 -5
- package/dist/{chunk-HDHLZK7C.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
- package/dist/{chunk-ICDLYU4I.js → chunk-Y6X7UJSD.js} +10 -9
- package/dist/chunk-Y6X7UJSD.js.map +1 -0
- package/dist/chunk-YCXRSWCQ.js +42 -0
- package/dist/chunk-YCXRSWCQ.js.map +1 -0
- package/dist/entries/apps.cjs +44 -44
- package/dist/entries/apps.js +9 -9
- package/dist/entries/credits.cjs +217 -152
- package/dist/entries/credits.d.cts +112 -6
- package/dist/entries/credits.d.ts +112 -6
- package/dist/entries/credits.js +13 -8
- package/dist/entries/entities.cjs +188 -143
- package/dist/entries/entities.d.cts +122 -1
- package/dist/entries/entities.d.ts +122 -1
- package/dist/entries/entities.js +2 -1
- package/dist/entries/llm-models.d.cts +2 -1
- package/dist/entries/llm-models.d.ts +2 -1
- package/dist/entries/media.cjs +92 -87
- package/dist/entries/media.d.cts +11 -1
- package/dist/entries/media.d.ts +11 -1
- package/dist/entries/media.js +3 -2
- package/dist/entries/model-catalog.cjs +207 -99
- package/dist/entries/model-catalog.d.cts +90 -4
- package/dist/entries/model-catalog.d.ts +90 -4
- package/dist/entries/model-catalog.js +5 -5
- package/dist/entries/models.cjs +407 -294
- package/dist/entries/models.d.cts +4 -3
- package/dist/entries/models.d.ts +4 -3
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +241 -233
- package/dist/entries/nodes.d.cts +15 -2
- package/dist/entries/nodes.d.ts +15 -2
- package/dist/entries/nodes.js +10 -10
- package/dist/entries/pipeline.cjs +152 -152
- package/dist/entries/pipeline.d.cts +2 -1
- package/dist/entries/pipeline.d.ts +2 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +308 -204
- package/dist/entries/video.d.cts +480 -98
- package/dist/entries/video.d.ts +480 -98
- package/dist/entries/video.js +8 -4
- package/dist/entries/workflow.cjs +111 -99
- package/dist/entries/workflow.d.cts +29 -2
- package/dist/entries/workflow.d.ts +29 -2
- package/dist/entries/workflow.js +2 -2
- package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
- package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
- package/dist/index.cjs +2321 -1870
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +26 -23
- package/dist/{model-catalog-D6Es7VG-.d.cts → model-catalog-CCEcv08q.d.cts} +179 -14
- package/dist/{model-catalog-D6Es7VG-.d.ts → model-catalog-CCEcv08q.d.ts} +179 -14
- package/dist/{model-constants-22k3fjp1.d.cts → model-constants-B88p6XR0.d.ts} +305 -20
- package/dist/{model-constants-22k3fjp1.d.ts → model-constants-Cf3zaITt.d.cts} +305 -20
- package/package.json +1 -1
- package/src/__tests__/extend-providers.test.ts +114 -0
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
- package/src/__tests__/gpt-image-2-6.test.ts +7 -0
- package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
- package/src/__tests__/gvp-supported-providers.test.ts +5 -2
- package/src/__tests__/image-mask-mode.test.ts +34 -1
- package/src/__tests__/mask-edit-follows-source.test.ts +150 -0
- package/src/__tests__/minimax-h3-image.test.ts +140 -0
- package/src/__tests__/model-makers.test.ts +49 -11
- package/src/__tests__/model-tree.test.ts +13 -0
- package/src/__tests__/retired-video-provider.test.ts +15 -5
- package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
- package/src/__tests__/seedance-task-type.test.ts +178 -0
- package/src/__tests__/seedream-5-5.test.ts +117 -0
- package/src/__tests__/unit-contract-compose.test.ts +27 -1
- package/src/__tests__/unit-contracts.test.ts +20 -6
- package/src/__tests__/upscale-factors.test.ts +107 -0
- package/src/__tests__/video-character-refs.test.ts +20 -2
- package/src/__tests__/video-collapse-parity.test.ts +19 -0
- package/src/__tests__/video-overlay-geometry.test.ts +68 -0
- package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
- package/src/__tests__/video-overlay-layouts.test.ts +529 -0
- package/src/__tests__/video-overlay-pricing.test.ts +61 -0
- package/src/__tests__/video-overlay-validate.test.ts +128 -0
- package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
- package/src/__tests__/video-overlay.test.ts +280 -194
- package/src/__tests__/video-ref-limits.test.ts +2 -1
- package/src/__tests__/video-reference-only.test.ts +6 -2
- package/src/__tests__/video-start-frame-only.test.ts +98 -0
- package/src/__tests__/wired-character-names.test.ts +220 -0
- package/src/credit-estimators/index.ts +8 -0
- package/src/credit-estimators/video-overlay.ts +70 -0
- package/src/credit-identifiers.ts +102 -5
- package/src/entity-image-url.ts +21 -0
- package/src/entries/credits.ts +14 -0
- package/src/entries/entities.ts +14 -0
- package/src/entries/model-catalog.ts +39 -1
- package/src/entries/models.ts +34 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/video.ts +6 -0
- package/src/entries/workflow.ts +1 -0
- package/src/generated/unit-contracts.ts +8 -1
- package/src/gpt-image-2-6.ts +6 -0
- package/src/input-image-pricing.ts +76 -0
- package/src/mask-composite.ts +11 -0
- package/src/minimax-h3-image.ts +61 -0
- package/src/model-catalog.ts +512 -48
- package/src/model-constants.ts +602 -34
- package/src/node-default-mappings.ts +12 -2
- package/src/node-execution-state.ts +4 -1
- package/src/producer-types.ts +23 -1
- package/src/seedance-task-type.ts +37 -0
- package/src/seedream-5-5.ts +45 -0
- package/src/unit-contract-compose.ts +4 -1
- package/src/upscale-factors.ts +111 -0
- package/src/video-character-refs.ts +7 -4
- package/src/video-overlay-geometry.ts +99 -0
- package/src/video-overlay-input.ts +25 -0
- package/src/video-overlay-layout-ids.ts +48 -0
- package/src/video-overlay-layouts.ts +315 -0
- package/src/video-overlay-validate.ts +223 -0
- package/src/video-overlay-video-layers.ts +304 -0
- package/src/video-overlay.ts +165 -297
- package/src/video-ui-defaults.ts +8 -6
- package/src/wired-character-names.ts +202 -0
- package/src/wired-image-size.ts +55 -0
- package/dist/chunk-5Y42RIGY.cjs.map +0 -1
- package/dist/chunk-6XVHYD5R.js.map +0 -1
- package/dist/chunk-A6HRY3WF.cjs.map +0 -1
- package/dist/chunk-AFQFGZN7.cjs.map +0 -1
- package/dist/chunk-AXT7YNOR.cjs.map +0 -1
- package/dist/chunk-AZGONXWV.js.map +0 -1
- package/dist/chunk-BDXXOEBZ.cjs.map +0 -1
- package/dist/chunk-CIOXUPCJ.cjs.map +0 -1
- package/dist/chunk-DQIJPDHC.cjs.map +0 -1
- package/dist/chunk-DS2TOM32.js.map +0 -1
- package/dist/chunk-FVVD6XY2.js.map +0 -1
- package/dist/chunk-G4XWVWRI.js.map +0 -1
- package/dist/chunk-G6GMY5BC.js.map +0 -1
- package/dist/chunk-G7ZYZQKO.cjs +0 -27
- package/dist/chunk-G7ZYZQKO.cjs.map +0 -1
- package/dist/chunk-GWBQ3GPO.cjs.map +0 -1
- package/dist/chunk-HNEF2N5C.cjs +0 -19
- package/dist/chunk-HNEF2N5C.cjs.map +0 -1
- package/dist/chunk-HOKWJXHA.cjs.map +0 -1
- package/dist/chunk-HYBACFYW.js.map +0 -1
- package/dist/chunk-ICDLYU4I.js.map +0 -1
- package/dist/chunk-JKZVRKN3.js.map +0 -1
- package/dist/chunk-KOLC7AF2.js.map +0 -1
- package/dist/chunk-LN3EVFRS.js.map +0 -1
- package/dist/chunk-M3SXUUWC.cjs.map +0 -1
- package/dist/chunk-MHY47BLL.js +0 -23
- package/dist/chunk-MHY47BLL.js.map +0 -1
- package/dist/chunk-PONP5J5E.cjs.map +0 -1
- package/dist/chunk-SWVGHAYO.js.map +0 -1
- package/dist/chunk-VB2ARGQ6.js.map +0 -1
- package/dist/chunk-VYQ25YQF.js +0 -17
- package/dist/chunk-VYQ25YQF.js.map +0 -1
- package/dist/chunk-W4M7TNXG.cjs.map +0 -1
- package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
- package/dist/chunk-XROE3CAS.cjs.map +0 -1
- package/dist/chunk-YHVEZVAO.js.map +0 -1
package/src/model-catalog.ts
CHANGED
|
@@ -30,7 +30,10 @@
|
|
|
30
30
|
|
|
31
31
|
import { isSeedanceDraftCapable, SEEDANCE_DRAFT_RESOLUTION } from "./seedance-draft.js"
|
|
32
32
|
import { isFlux2Model } from "./flux2-pricing.js"
|
|
33
|
+
import { MINIMAX_H3_IMAGE_DEFAULT_RESOLUTION, MINIMAX_H3_IMAGE_RESOLUTIONS } from "./minimax-h3-image.js"
|
|
33
34
|
import { isAutoVideoDuration } from "./video-duration-auto.js"
|
|
35
|
+
import type { DeclaredSeedanceTaskType } from "./seedance-task-type.js"
|
|
36
|
+
import { SEEDREAM_5_5_DEFAULT_RESOLUTION, SEEDREAM_5_5_RESOLUTIONS } from "./seedream-5-5.js"
|
|
34
37
|
|
|
35
38
|
export type ModelKind = "image" | "video" | "audio"
|
|
36
39
|
|
|
@@ -202,15 +205,20 @@ export function isModelMakerId(value: unknown): value is ModelMakerId {
|
|
|
202
205
|
}
|
|
203
206
|
|
|
204
207
|
/**
|
|
205
|
-
* The maker of a catalog entry, in its wire shape — undefined
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
+
* The maker of a catalog entry, in its wire shape — undefined for a model
|
|
209
|
+
* offered under the deployment's own label (`ownLabel`, which names none —
|
|
210
|
+
* even an entry built at run time, or by a JavaScript caller, that also names a
|
|
211
|
+
* maker) and when its `maker` is not a registry id (an entry built at run time
|
|
212
|
+
* without one). Never throws, so one bad entry cannot fail a whole model
|
|
213
|
+
* listing.
|
|
208
214
|
*/
|
|
209
|
-
export function modelMakerOf(entry: Pick<ModelCatalogEntry, "maker">): ModelMaker | undefined {
|
|
215
|
+
export function modelMakerOf(entry: Pick<ModelCatalogEntry, "maker" | "ownLabel">): ModelMaker | undefined {
|
|
216
|
+
if (entry.ownLabel === true) return undefined
|
|
210
217
|
return isModelMakerId(entry.maker) ? { id: entry.maker, name: MODEL_MAKERS[entry.maker].name } : undefined
|
|
211
218
|
}
|
|
212
219
|
|
|
213
|
-
|
|
220
|
+
/** Every field of a catalog entry but who it is offered under (`maker` / `ownLabel`, {@link ModelCatalogEntry}). */
|
|
221
|
+
export interface ModelCatalogEntryFields {
|
|
214
222
|
id: string
|
|
215
223
|
kind: ModelKind
|
|
216
224
|
/**
|
|
@@ -223,12 +231,6 @@ export interface ModelCatalogEntry {
|
|
|
223
231
|
modes: readonly ModelMode[]
|
|
224
232
|
/** Vendor / lab that produced the model. Used for UI grouping. */
|
|
225
233
|
family: string
|
|
226
|
-
/**
|
|
227
|
-
* The company that made the model (see {@link MODEL_MAKERS}). REQUIRED, so a
|
|
228
|
-
* new model cannot ship without one; every model of a `family` names the same
|
|
229
|
-
* maker.
|
|
230
|
-
*/
|
|
231
|
-
maker: ModelMakerId
|
|
232
234
|
/** Display name (NOT the id — the id is the API enum value). */
|
|
233
235
|
label: string
|
|
234
236
|
/**
|
|
@@ -291,8 +293,10 @@ export interface ModelCatalogEntry {
|
|
|
291
293
|
* `"voice-references"` (video models only) means the model takes each
|
|
292
294
|
* reference AUDIO clip as a VOICE sample — who speaks and how they sound —
|
|
293
295
|
* and makes its own soundtrack, rather than conditioning on the audio itself
|
|
294
|
-
* (Kling 4.0: KIE `voices`, `@VoiceN` in the prompt
|
|
295
|
-
*
|
|
296
|
+
* (Kling 4.0: KIE `voices`, `@VoiceN` in the prompt; Kling 4.0 Flash: each
|
|
297
|
+
* clip is a wired character's voice, KIE `elements[].voice_url` — see
|
|
298
|
+
* `audioBindsToCharacters`). The editor names that input "Voice Refs" for
|
|
299
|
+
* such a model.
|
|
296
300
|
*
|
|
297
301
|
* `"audio-soundtrack"` (video models only) means the platform can play the
|
|
298
302
|
* model's FIRST reference audio clip as the result's soundtrack: it sends
|
|
@@ -327,6 +331,39 @@ export interface ModelCatalogEntry {
|
|
|
327
331
|
* as before. "auto" stays in `aspectRatios`, so every menu still offers it.
|
|
328
332
|
*/
|
|
329
333
|
autoAspectFromSourceImage?: true
|
|
334
|
+
/**
|
|
335
|
+
* The provider's endpoint refuses an aspect ratio this model does not list.
|
|
336
|
+
* Set only when that was read from the provider's own schema: a ratio field
|
|
337
|
+
* marked required, with a closed list (Seedream 5.5: text to image requires
|
|
338
|
+
* one of its eight ratios and has no "auto"; its edit takes "auto" and the
|
|
339
|
+
* same eight; docs.kie.ai/market/seedream/5-5-text-to-image.md and
|
|
340
|
+
* 5-5-image-to-image.md). The lanes that pass a stored ratio straight on (a
|
|
341
|
+
* Scene, a surround continuation) move a ratio such a model does not list to
|
|
342
|
+
* the nearest one it does, checked against the model the request reaches
|
|
343
|
+
* (`aspectRatioForStrictModel` in the backend), and send every other model's
|
|
344
|
+
* ratio exactly as stored.
|
|
345
|
+
*
|
|
346
|
+
* A ratio missing from `aspectRatios` is NOT evidence the provider refuses
|
|
347
|
+
* it. Measured 2026-11-11: the provider rendered 21:9 (1916×821) and 4:5
|
|
348
|
+
* (1122×1402) for GPT Image 2, whose list names neither. Do not set this flag
|
|
349
|
+
* from a catalog list alone, and do not snap those lanes for every model.
|
|
350
|
+
*/
|
|
351
|
+
strictAspectRatios?: true
|
|
352
|
+
/**
|
|
353
|
+
* The pixel size (width, height) this model renders at each aspect ratio and
|
|
354
|
+
* size, from the provider's own table, for a PNG, JPEG or WebP. Read where a
|
|
355
|
+
* run's size is chosen from its photo's size (`maskEditMatchesSource`).
|
|
356
|
+
*/
|
|
357
|
+
outputSizes?: Readonly<Record<string, Readonly<Record<string, readonly [number, number]>>>>
|
|
358
|
+
/**
|
|
359
|
+
* A masked edit on this model follows its photo: the result is pasted back
|
|
360
|
+
* onto the photo at the photo's own size, so the run keeps the photo's shape
|
|
361
|
+
* ("auto", whatever ratio it names) and renders at the size of `outputSizes`
|
|
362
|
+
* whose long side is nearest the photo's, priced at that size
|
|
363
|
+
* (`normalizeModelInput` with `context.masked`; `resolutionNearestSource`).
|
|
364
|
+
* With the photo's size unknown, the size asked is kept.
|
|
365
|
+
*/
|
|
366
|
+
maskEditMatchesSource?: true
|
|
330
367
|
resolutions?: readonly string[]
|
|
331
368
|
/**
|
|
332
369
|
* The aspect ratios at which this model renders fewer sizes than
|
|
@@ -358,6 +395,16 @@ export interface ModelCatalogEntry {
|
|
|
358
395
|
* the two cannot drift.
|
|
359
396
|
*/
|
|
360
397
|
unlistedResolutionRendersAs?: string
|
|
398
|
+
/**
|
|
399
|
+
* The resolutions (catalog spelling) at which this video model takes a start
|
|
400
|
+
* frame ONLY: no end frame, no loop and no in-between frames beside it. A run
|
|
401
|
+
* that would send any of them at such a resolution is refused before any
|
|
402
|
+
* credits are held, with one sentence (`videoStartFrameOnlyProblem`), on the
|
|
403
|
+
* API routes, the workflow run and the editor's Run; the editor offers the
|
|
404
|
+
* resolution only while nothing but a start frame is wired. Declared from the
|
|
405
|
+
* provider's own refusal, never guessed.
|
|
406
|
+
*/
|
|
407
|
+
startFrameOnlyResolutions?: readonly string[]
|
|
361
408
|
qualities?: readonly string[]
|
|
362
409
|
/**
|
|
363
410
|
* The quality a run renders at when none is named, where that is not the
|
|
@@ -415,6 +462,16 @@ export interface ModelCatalogEntry {
|
|
|
415
462
|
* the longest clip and settled on the delivered one.
|
|
416
463
|
*/
|
|
417
464
|
autoDuration?: boolean
|
|
465
|
+
/**
|
|
466
|
+
* The reference task types this model accepts as a declaration (see
|
|
467
|
+
* `SEEDANCE_REFERENCE_TASK_TYPES`): what the request's reference media is for
|
|
468
|
+
* — a `reference`, an `edit` of the reference video, or an `extend` of it.
|
|
469
|
+
* The list is what is honoured: `resolveSeedanceTaskType` declares only a
|
|
470
|
+
* value listed here, and anything else runs as Auto. Absent or empty: the
|
|
471
|
+
* model takes no such declaration and the provider guesses from the prompt.
|
|
472
|
+
* `supportsReferenceTaskType` says whether the list is non-empty.
|
|
473
|
+
*/
|
|
474
|
+
referenceTaskTypes?: readonly DeclaredSeedanceTaskType[]
|
|
418
475
|
/**
|
|
419
476
|
* The model takes NO seed: its provider schema has none, so a seed the
|
|
420
477
|
* request carries is dropped before the provider call and repeat runs vary.
|
|
@@ -464,6 +521,23 @@ export interface ModelCatalogEntry {
|
|
|
464
521
|
tts?: TtsCapabilities
|
|
465
522
|
}
|
|
466
523
|
|
|
524
|
+
/**
|
|
525
|
+
* Who a model is offered under — exactly one of:
|
|
526
|
+
*
|
|
527
|
+
* - `maker`: the company that made it (see {@link MODEL_MAKERS}). Every model
|
|
528
|
+
* names one unless it is marked `ownLabel`, so a new model cannot ship
|
|
529
|
+
* without saying whose it is; every model of a `family` names the same maker.
|
|
530
|
+
* - `ownLabel: true`: the model is offered under the deployment's own label and
|
|
531
|
+
* names no maker (decided 2026-11-11). `GET /v1/models` leaves `maker` out
|
|
532
|
+
* for it and returns `logoUrl: null`; MCP `list_models` leaves `maker` out (it
|
|
533
|
+
* never carries `logoUrl`); a client shows no maker. Such a model may not
|
|
534
|
+
* carry a `maker` (`model-makers.test.ts`).
|
|
535
|
+
*/
|
|
536
|
+
export type ModelCatalogEntry = ModelCatalogEntryFields & (
|
|
537
|
+
| { maker: ModelMakerId; ownLabel?: never }
|
|
538
|
+
| { ownLabel: true; maker?: never }
|
|
539
|
+
)
|
|
540
|
+
|
|
467
541
|
/**
|
|
468
542
|
* Editorial recommendations — short "best for X" picks Claude can echo back
|
|
469
543
|
* to the user when they don't know which model to use. Surfaces as a "Quick
|
|
@@ -485,6 +559,7 @@ export const MODEL_RECOMMENDATIONS: readonly ModelRecommendation[] = [
|
|
|
485
559
|
{ intent: "highest fidelity image", modelIds: ["gpt-image-2", "gpt-image-2-6-sunburst", "imagen4-ultra"], note: "GPT Image 2 for characters and identity; GPT Image 2.6 Sunburst for wide or in-between ratios GPT Image 2 can't draw." },
|
|
486
560
|
{ intent: "image edit / restyle", modelIds: ["gpt-image-2-6-flare-i2i", "gpt-image-2-i2i", "seedream-5-pro-i2i"], note: "GPT Image 2.6 Flare changes what you ask and keeps the rest; GPT Image 2 i2i for identity-critical edits; Seedream 5 Pro for instruction-based edits." },
|
|
487
561
|
{ intent: "highest-resolution image", modelIds: ["topaz-image-upscale", "gpt-image-2", "gpt-image-2-6-sunburst"], note: "Generate at the model's top tier, then Topaz upscale 4x (Topaz's only lever is the 1x/2x/4x factor)." },
|
|
562
|
+
{ intent: "upscale an image with text, labels or logos", modelIds: ["nodaro-image-upscale"], note: "Keeps lettering exactly as written. 1x enhances at the same size; up to 8x. Priced by the output's size, so a small picture costs little." },
|
|
488
563
|
{ intent: "background removal / cutout", modelIds: ["recraft-remove-bg"], note: "Cheap, no prompt needed." },
|
|
489
564
|
// video
|
|
490
565
|
{ intent: "best cinematic video", modelIds: ["veo3", "kling-3.0", "seedance-2"], note: "VEO 3.1 Quality for premium narrative; Kling 3.0 for music-synced motion; Seedance 2 for reference-driven consistency." },
|
|
@@ -550,6 +625,26 @@ const GPT_IMAGE_2_6_RATIOS = [
|
|
|
550
625
|
"2:1", "1:2", "21:9", "9:21", "3:1", "1:3",
|
|
551
626
|
] as const
|
|
552
627
|
const GPT_IMAGE_2_6_ECONOMY_RATIOS = ["auto", "1:1", "16:9", "9:16", "3:2", "2:3", "21:9", "4:3"] as const
|
|
628
|
+
// What GPT Image 2.6 Flare and Sunburst render at each ratio and size, for a
|
|
629
|
+
// PNG, JPEG or WebP (the `resolution` table of docs.kie.ai/market/gpt/
|
|
630
|
+
// gpt-image-2-6-{flare,sunburst}-image-to-image, fetched 2026-11-11).
|
|
631
|
+
const GPT_IMAGE_2_6_OUTPUT_SIZES = {
|
|
632
|
+
"1:1": { "1K": [1024, 1024], "2K": [2048, 2048], "4K": [2880, 2880] },
|
|
633
|
+
"3:2": { "1K": [1536, 1024], "2K": [2048, 1360], "4K": [3520, 2336] },
|
|
634
|
+
"2:3": { "1K": [1024, 1536], "2K": [1360, 2048], "4K": [2336, 3520] },
|
|
635
|
+
"4:3": { "1K": [1024, 768], "2K": [2048, 1536], "4K": [3312, 2480] },
|
|
636
|
+
"3:4": { "1K": [768, 1024], "2K": [1536, 2048], "4K": [2480, 3312] },
|
|
637
|
+
"5:4": { "1K": [1280, 1024], "2K": [2560, 2048], "4K": [3216, 2576] },
|
|
638
|
+
"4:5": { "1K": [1024, 1280], "2K": [2048, 2560], "4K": [2576, 3216] },
|
|
639
|
+
"16:9": { "1K": [1536, 864], "2K": [2048, 1152], "4K": [3840, 2160] },
|
|
640
|
+
"9:16": { "1K": [864, 1536], "2K": [1152, 2048], "4K": [2160, 3840] },
|
|
641
|
+
"2:1": { "1K": [2048, 1024], "2K": [2688, 1344], "4K": [3840, 1920] },
|
|
642
|
+
"1:2": { "1K": [1024, 2048], "2K": [1344, 2688], "4K": [1920, 3840] },
|
|
643
|
+
"21:9": { "1K": [2016, 864], "2K": [2688, 1152], "4K": [3840, 1648] },
|
|
644
|
+
"9:21": { "1K": [864, 2016], "2K": [1152, 2688], "4K": [1648, 3840] },
|
|
645
|
+
"3:1": { "1K": [1536, 512], "2K": [3072, 1024], "4K": [3840, 1280] },
|
|
646
|
+
"1:3": { "1K": [512, 1536], "2K": [1024, 3072], "4K": [1280, 3840] },
|
|
647
|
+
} as const satisfies Record<string, Record<string, readonly [number, number]>>
|
|
553
648
|
const GPT_IMAGE_2_6_VALUE_LABELS = {
|
|
554
649
|
"3:2": "3:2 (Landscape)", "2:3": "2:3 (Portrait)",
|
|
555
650
|
"5:4": "5:4 (Near-square)", "4:5": "4:5 (Near-square)",
|
|
@@ -575,6 +670,21 @@ const GPT_IMAGE_2_6_SVG_LEVELS = ["standard", "detailed", "max"] as const
|
|
|
575
670
|
const IMAGEN4_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
576
671
|
const IDEOGRAM_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
577
672
|
const SEEDREAM_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "21:9"] as const
|
|
673
|
+
// MiniMax H3 Image: ten fixed ratios at every size, and "auto" — listed last, so
|
|
674
|
+
// a fallback that takes the first ratio never lands on it
|
|
675
|
+
// (docs.kie.ai/market/minimax-h3/text-to-image + image-edit).
|
|
676
|
+
const MINIMAX_H3_IMAGE_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5", "21:9", "auto"] as const
|
|
677
|
+
// Seedream 5.5 (docs.kie.ai/market/seedream/5-5-{text,image}-to-image): the
|
|
678
|
+
// text-to-image endpoint REQUIRES a real ratio, the eight above; the edit
|
|
679
|
+
// endpoint takes the same eight plus `auto`, its own default (listed first, as
|
|
680
|
+
// on the GPT Image edits, so a stale ratio on an edit falls back to keeping the
|
|
681
|
+
// photo's shape rather than to a fixed one).
|
|
682
|
+
const SEEDREAM_5_5_I2I_RATIOS = ["auto", ...SEEDREAM_RATIOS] as const
|
|
683
|
+
// Its sizes (KIE's `size`), the default being 2K (`SEEDREAM_5_5_DEFAULT_RESOLUTION`),
|
|
684
|
+
// a background setting (transparent only with PNG: TRANSPARENT_OUTPUT_FORMATS
|
|
685
|
+
// moves it to auto with JPEG), and PNG (its default) or JPEG.
|
|
686
|
+
const SEEDREAM_5_5_BACKGROUNDS = ["auto", "opaque", "transparent"] as const
|
|
687
|
+
const SEEDREAM_5_5_FORMATS = ["png", "jpeg"] as const
|
|
578
688
|
const Z_IMAGE_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
579
689
|
|
|
580
690
|
const VIDEO_RATIOS_HV = ["16:9", "9:16"] as const
|
|
@@ -1175,11 +1285,13 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1175
1285
|
maker: "openai",
|
|
1176
1286
|
label: "GPT Image 2.6 Flare (I2I)",
|
|
1177
1287
|
series: "GPT Image",
|
|
1178
|
-
description: "Fast GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Pick it while iterating.",
|
|
1179
|
-
useCases: ["edit", "high-res"],
|
|
1180
|
-
features: ["reference-image"],
|
|
1288
|
+
description: "Fast GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Takes an inpainting mask (PNG, JPEG or WebP; the rest of the picture is kept as it was). Pick it while iterating.",
|
|
1289
|
+
useCases: ["edit", "inpaint", "high-res"],
|
|
1290
|
+
features: ["reference-image", "mask"],
|
|
1181
1291
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
1182
1292
|
autoAspectFromSourceImage: true,
|
|
1293
|
+
outputSizes: GPT_IMAGE_2_6_OUTPUT_SIZES,
|
|
1294
|
+
maskEditMatchesSource: true,
|
|
1183
1295
|
resolutions: ["1K", "2K", "4K"],
|
|
1184
1296
|
qualities: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
1185
1297
|
defaultQuality: "medium",
|
|
@@ -1283,11 +1395,13 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1283
1395
|
maker: "openai",
|
|
1284
1396
|
label: "GPT Image 2.6 Sunburst (I2I)",
|
|
1285
1397
|
series: "GPT Image",
|
|
1286
|
-
description: "Precision GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Pick it for finished, detail-critical edits.",
|
|
1287
|
-
useCases: ["edit", "high-res"],
|
|
1288
|
-
features: ["reference-image"],
|
|
1398
|
+
description: "Precision GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Takes an inpainting mask (PNG, JPEG or WebP; the rest of the picture is kept as it was). Pick it for finished, detail-critical edits.",
|
|
1399
|
+
useCases: ["edit", "inpaint", "high-res"],
|
|
1400
|
+
features: ["reference-image", "mask"],
|
|
1289
1401
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
1290
1402
|
autoAspectFromSourceImage: true,
|
|
1403
|
+
outputSizes: GPT_IMAGE_2_6_OUTPUT_SIZES,
|
|
1404
|
+
maskEditMatchesSource: true,
|
|
1291
1405
|
resolutions: ["1K", "2K", "4K"],
|
|
1292
1406
|
qualities: ["auto", "low", "medium", "high", "xhigh", "max"],
|
|
1293
1407
|
defaultQuality: "medium",
|
|
@@ -1612,6 +1726,121 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1612
1726
|
resolutions: ["1K", "2K"],
|
|
1613
1727
|
pricing: [{ identifier: "seedream-5-flash-i2i", credits: 10, note: "1K / 2K flat" }],
|
|
1614
1728
|
},
|
|
1729
|
+
// Seedream 5.5 — a different model from Seedream 5 Lite, Pro and Flash, priced
|
|
1730
|
+
// by its size (1K and 1.5K the same, 2K dearer) and, on an edit, by each input
|
|
1731
|
+
// image (the rows are `ee/billing/seedream-5-5-pricing.ts`).
|
|
1732
|
+
// See: docs.kie.ai/market/seedream/5-5-text-to-image.md
|
|
1733
|
+
// docs.kie.ai/market/seedream/5-5-image-to-image.md
|
|
1734
|
+
"seedream-5-5": {
|
|
1735
|
+
id: "seedream-5-5",
|
|
1736
|
+
kind: "image",
|
|
1737
|
+
modes: ["t2i"] as const,
|
|
1738
|
+
family: "Bytedance",
|
|
1739
|
+
maker: "bytedance",
|
|
1740
|
+
label: "Seedream 5.5",
|
|
1741
|
+
series: "Seedream",
|
|
1742
|
+
description: "Seedream 5.5 - more natural light, materials and skin, and dense small text that stays readable. A transparent background in one step, PNG or JPEG, at 1K, 1.5K or 2K (the default); 1K and 1.5K cost the same.",
|
|
1743
|
+
useCases: ["realistic", "typography", "product", "transparent"],
|
|
1744
|
+
features: ["reference-image"],
|
|
1745
|
+
aspectRatios: SEEDREAM_RATIOS,
|
|
1746
|
+
strictAspectRatios: true,
|
|
1747
|
+
resolutions: SEEDREAM_5_5_RESOLUTIONS,
|
|
1748
|
+
defaultResolution: SEEDREAM_5_5_DEFAULT_RESOLUTION,
|
|
1749
|
+
backgrounds: SEEDREAM_5_5_BACKGROUNDS,
|
|
1750
|
+
outputFormats: SEEDREAM_5_5_FORMATS,
|
|
1751
|
+
pricing: [
|
|
1752
|
+
{ identifier: "seedream-5-5", credits: 16, note: "2K default" },
|
|
1753
|
+
{ identifier: "seedream-5-5:1K", credits: 9, note: "1K" },
|
|
1754
|
+
{ identifier: "seedream-5-5:1.5K", credits: 9, note: "1.5K, the same as 1K" },
|
|
1755
|
+
{ identifier: "seedream-5-5:2K", credits: 16, note: "2K" },
|
|
1756
|
+
],
|
|
1757
|
+
},
|
|
1758
|
+
"seedream-5-5-i2i": {
|
|
1759
|
+
id: "seedream-5-5-i2i",
|
|
1760
|
+
kind: "image",
|
|
1761
|
+
modes: ["i2i"] as const,
|
|
1762
|
+
family: "Bytedance",
|
|
1763
|
+
maker: "bytedance",
|
|
1764
|
+
label: "Seedream 5.5 (I2I)",
|
|
1765
|
+
series: "Seedream",
|
|
1766
|
+
description: "Seedream 5.5 edits - change what you ask, round after round, and the rest of the picture stays as it was. Up to 10 input images, priced per image; a transparent background, PNG or JPEG, at 1K, 1.5K or 2K (the default).",
|
|
1767
|
+
useCases: ["edit", "iteration", "transparent"],
|
|
1768
|
+
features: ["reference-image"],
|
|
1769
|
+
aspectRatios: SEEDREAM_5_5_I2I_RATIOS,
|
|
1770
|
+
strictAspectRatios: true,
|
|
1771
|
+
resolutions: SEEDREAM_5_5_RESOLUTIONS,
|
|
1772
|
+
defaultResolution: SEEDREAM_5_5_DEFAULT_RESOLUTION,
|
|
1773
|
+
backgrounds: SEEDREAM_5_5_BACKGROUNDS,
|
|
1774
|
+
outputFormats: SEEDREAM_5_5_FORMATS,
|
|
1775
|
+
pricing: [
|
|
1776
|
+
{ identifier: "seedream-5-5-i2i", credits: 20, note: "2K, one input image (the default)" },
|
|
1777
|
+
{ identifier: "seedream-5-5-i2i:1K:1ref", credits: 13, note: "1K, one input image (the least)" },
|
|
1778
|
+
{ identifier: "seedream-5-5-i2i:1.5K:1ref", credits: 13, note: "1.5K, one input image" },
|
|
1779
|
+
{ identifier: "seedream-5-5-i2i:2K:1ref", credits: 20, note: "2K, one input image" },
|
|
1780
|
+
{ identifier: "seedream-5-5-i2i:1K:10ref", credits: 45, note: "1K, ten input images" },
|
|
1781
|
+
{ identifier: "seedream-5-5-i2i:2K:10ref", credits: 52, note: "2K, ten input images (the most)" },
|
|
1782
|
+
],
|
|
1783
|
+
},
|
|
1784
|
+
|
|
1785
|
+
// ── MiniMax H3 Image ──
|
|
1786
|
+
// MiniMax's H3 image model (KIE `minimax-h3/text-to-image` and
|
|
1787
|
+
// `minimax-h3/image-edit`). Not the H3 video model `minimax-h3`. A prompt
|
|
1788
|
+
// runs the text-to-image id; with reference images the run moves to the
|
|
1789
|
+
// edit id (`T2I_TO_I2I_VARIANT`). Priced by size, 1K and 2K the same, and an
|
|
1790
|
+
// edit by its reference images (`minimaxH3ImageCreditId`). "auto" is listed
|
|
1791
|
+
// LAST so a fallback that takes the first ratio lands on a real one: from a
|
|
1792
|
+
// prompt KIE's rewriter picks the ratio, in an edit it follows the first
|
|
1793
|
+
// reference image. KIE's prompt expansion is left on and its custom
|
|
1794
|
+
// width/height is not offered.
|
|
1795
|
+
// See: docs.kie.ai/market/minimax-h3/text-to-image.md
|
|
1796
|
+
// docs.kie.ai/market/minimax-h3/image-edit.md
|
|
1797
|
+
"minimax-h3-image": {
|
|
1798
|
+
id: "minimax-h3-image",
|
|
1799
|
+
kind: "image",
|
|
1800
|
+
modes: ["t2i"] as const,
|
|
1801
|
+
family: "MiniMax",
|
|
1802
|
+
maker: "minimax",
|
|
1803
|
+
label: "MiniMax H3 Image",
|
|
1804
|
+
series: "MiniMax Image",
|
|
1805
|
+
description: "MiniMax H3 Image: detailed pictures up to about 16 MP at 4K, with readable text inside the picture. Ten shapes plus auto, the same price at 1K and 2K (2K by default), PNG or JPEG.",
|
|
1806
|
+
useCases: ["typography", "high-res", "general"],
|
|
1807
|
+
features: ["reference-image"],
|
|
1808
|
+
aspectRatios: MINIMAX_H3_IMAGE_RATIOS,
|
|
1809
|
+
resolutions: MINIMAX_H3_IMAGE_RESOLUTIONS,
|
|
1810
|
+
defaultResolution: MINIMAX_H3_IMAGE_DEFAULT_RESOLUTION,
|
|
1811
|
+
outputFormats: ["png", "jpeg"],
|
|
1812
|
+
pricing: [
|
|
1813
|
+
{ identifier: "minimax-h3-image", credits: 5, note: "2K default" },
|
|
1814
|
+
{ identifier: "minimax-h3-image:1K", credits: 5, note: "1K" },
|
|
1815
|
+
{ identifier: "minimax-h3-image:2K", credits: 5, note: "2K" },
|
|
1816
|
+
{ identifier: "minimax-h3-image:4K", credits: 14, note: "4K" },
|
|
1817
|
+
],
|
|
1818
|
+
},
|
|
1819
|
+
"minimax-h3-image-i2i": {
|
|
1820
|
+
id: "minimax-h3-image-i2i",
|
|
1821
|
+
kind: "image",
|
|
1822
|
+
modes: ["i2i"] as const,
|
|
1823
|
+
family: "MiniMax",
|
|
1824
|
+
maker: "minimax",
|
|
1825
|
+
label: "MiniMax H3 Image (I2I)",
|
|
1826
|
+
series: "MiniMax Image",
|
|
1827
|
+
description: "MiniMax H3 Image edits: change or combine up to 16 reference images in one edit, with readable text, up to about 16 MP at 4K. Priced by size and by reference image; auto keeps the first image's shape.",
|
|
1828
|
+
useCases: ["edit", "typography", "multi-reference"],
|
|
1829
|
+
features: ["reference-image"],
|
|
1830
|
+
aspectRatios: MINIMAX_H3_IMAGE_RATIOS,
|
|
1831
|
+
resolutions: MINIMAX_H3_IMAGE_RESOLUTIONS,
|
|
1832
|
+
defaultResolution: MINIMAX_H3_IMAGE_DEFAULT_RESOLUTION,
|
|
1833
|
+
outputFormats: ["png", "jpeg"],
|
|
1834
|
+
pricing: [
|
|
1835
|
+
{ identifier: "minimax-h3-image-i2i", credits: 6, note: "2K, one reference image" },
|
|
1836
|
+
{ identifier: "minimax-h3-image-i2i:1K:1ref", credits: 6, note: "1K, one reference image (the least)" },
|
|
1837
|
+
{ identifier: "minimax-h3-image-i2i:2K:1ref", credits: 6, note: "2K, one reference image" },
|
|
1838
|
+
{ identifier: "minimax-h3-image-i2i:2K:4ref", credits: 10, note: "2K, four reference images" },
|
|
1839
|
+
{ identifier: "minimax-h3-image-i2i:4K:1ref", credits: 15, note: "4K, one reference image" },
|
|
1840
|
+
{ identifier: "minimax-h3-image-i2i:2K:16ref", credits: 25, note: "2K, sixteen reference images" },
|
|
1841
|
+
{ identifier: "minimax-h3-image-i2i:4K:16ref", credits: 34, note: "4K, sixteen reference images (the most)" },
|
|
1842
|
+
],
|
|
1843
|
+
},
|
|
1615
1844
|
|
|
1616
1845
|
// ── Alibaba Qwen ──
|
|
1617
1846
|
"qwen": {
|
|
@@ -1820,6 +2049,28 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1820
2049
|
{ identifier: "topaz-image-upscale:4K", credits: 50, note: "4x (legacy identifier)" },
|
|
1821
2050
|
],
|
|
1822
2051
|
},
|
|
2052
|
+
"nodaro-image-upscale": {
|
|
2053
|
+
id: "nodaro-image-upscale",
|
|
2054
|
+
kind: "image",
|
|
2055
|
+
modes: ["upscale"] as const,
|
|
2056
|
+
family: "Nodaro Upscale",
|
|
2057
|
+
ownLabel: true,
|
|
2058
|
+
label: "Nodaro Image Upscale",
|
|
2059
|
+
series: "Nodaro Upscale",
|
|
2060
|
+
description: "Image upscale at 1x (enhance only), 2x, 4x or 8x. Restores detail and keeps lettering exactly as written; the output is the input times the factor, nothing cropped. Priced by the output's size.",
|
|
2061
|
+
useCases: ["upscale", "high-res", "typography", "utility"],
|
|
2062
|
+
features: ["reference-image"],
|
|
2063
|
+
// No `resolutions`: the one lever is the upscale factor (`NODARO_IMAGE_UPSCALE_FACTORS`).
|
|
2064
|
+
// The price follows the OUTPUT's total pixels (`@nodaro/render-rules`
|
|
2065
|
+
// nodaro-image-upscale-pricing.ts); the bare id is the hold when the image's size
|
|
2066
|
+
// cannot be read before the run, settled to the delivered output's tier.
|
|
2067
|
+
pricing: [
|
|
2068
|
+
{ identifier: "nodaro-image-upscale:2K", credits: 4, note: "output up to 4,194,304 pixels (2048 × 2048)" },
|
|
2069
|
+
{ identifier: "nodaro-image-upscale:4K", credits: 10, note: "output up to 16,777,216 pixels (4096 × 4096)" },
|
|
2070
|
+
{ identifier: "nodaro-image-upscale:8K", credits: 30, note: "output up to 67,108,864 pixels (8192 × 8192)" },
|
|
2071
|
+
{ identifier: "nodaro-image-upscale", credits: 30, note: "held when the image's size cannot be read before the run; the output's tier is charged" },
|
|
2072
|
+
],
|
|
2073
|
+
},
|
|
1823
2074
|
}
|
|
1824
2075
|
|
|
1825
2076
|
// =============================================================================
|
|
@@ -2286,6 +2537,49 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2286
2537
|
{ identifier: "kling-4-keyframes:30s:1080p", credits: 3190, note: "30s 1080p (max)" },
|
|
2287
2538
|
],
|
|
2288
2539
|
},
|
|
2540
|
+
// Kling 4.0 Flash — ONE id over KIE's two Flash endpoints, picked by what is
|
|
2541
|
+
// wired (backend kie/kling4.ts): a start frame alone runs on
|
|
2542
|
+
// docs.kie.ai/market/kling/v4-flash-keyframe-to-video, where it is the exact
|
|
2543
|
+
// opening frame; everything else (text, reference images, videos,
|
|
2544
|
+
// characters, or a start frame beside any of them) runs on
|
|
2545
|
+
// docs.kie.ai/market/kling/v4-flash-reference-to-video, where a start frame
|
|
2546
|
+
// joins the reference images as on kling-4. Reference: up to 10 images, 5
|
|
2547
|
+
// videos (2-20s together) and 7 characters (15 in all). No standalone voices:
|
|
2548
|
+
// audio clip N becomes wired character N's voice when that character has 2-4
|
|
2549
|
+
// images (otherwise the clip is dropped). No end
|
|
2550
|
+
// frame, no 1080p, no seed. 3-20s, 720p, native audio always on. Per-second
|
|
2551
|
+
// billing; a reference-video run bills its input seconds too.
|
|
2552
|
+
"kling-4-flash": {
|
|
2553
|
+
id: "kling-4-flash",
|
|
2554
|
+
kind: "video",
|
|
2555
|
+
modes: ["i2v", "t2v"] as const,
|
|
2556
|
+
family: "Kuaishou",
|
|
2557
|
+
maker: "kuaishou",
|
|
2558
|
+
label: "Kling 4.0 Flash",
|
|
2559
|
+
series: "Kling",
|
|
2560
|
+
description: "Kling 4.0 Flash — the faster, lower-cost Kling 4.0 at 720p, up to 20s with native audio; a start frame, reference images, videos and characters (each can carry a voice clip), or plain text.",
|
|
2561
|
+
useCases: ["fast", "cheap", "narrative", "reference"],
|
|
2562
|
+
// No `voices` array on Flash: a reference audio clip is a character's voice
|
|
2563
|
+
// (`voice-references` names that input "Voice Refs"). No `audio-soundtrack`
|
|
2564
|
+
// (the clips are voices, never a soundtrack), no `end-frame`, no
|
|
2565
|
+
// `video-reference` (the generate-video-pro extend chain is unwired, as on
|
|
2566
|
+
// kling-4).
|
|
2567
|
+
features: ["audio", "reference-image", "reference-to-video", "character-subjects", "voice-references"],
|
|
2568
|
+
aspectRatios: VIDEO_RATIOS_KLING_4,
|
|
2569
|
+
durations: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
|
2570
|
+
defaultDuration: 5,
|
|
2571
|
+
resolutions: ["720p"],
|
|
2572
|
+
unlistedResolutionRendersAs: "720p",
|
|
2573
|
+
noSeed: true, // neither Flash schema has a `seed` (additionalProperties: false)
|
|
2574
|
+
pricing: [
|
|
2575
|
+
{ identifier: "kling-4-flash", credits: 220, note: "default 5s 720p — see :Ns:720p variants for exact" },
|
|
2576
|
+
{ identifier: "kling-4-flash:5s:720p", credits: 220, note: "5s 720p (the default tier)" },
|
|
2577
|
+
{ identifier: "kling-4-flash:3s:720p", credits: 130, note: "3s 720p (min)" },
|
|
2578
|
+
{ identifier: "kling-4-flash:10s:720p", credits: 430, note: "10s 720p" },
|
|
2579
|
+
{ identifier: "kling-4-flash:20s:720p", credits: 850, note: "20s 720p (max)" },
|
|
2580
|
+
{ identifier: "kling-4-flash:8s:720p-ref", credits: 230, note: "per-second anchor with a reference video: billed × (output + max(output, input seconds)) ÷ 8" },
|
|
2581
|
+
],
|
|
2582
|
+
},
|
|
2289
2583
|
|
|
2290
2584
|
// ── xAI Grok video ──
|
|
2291
2585
|
"grok-i2v": {
|
|
@@ -2310,35 +2604,49 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2310
2604
|
{ identifier: "grok-i2v:15s", credits: 100 },
|
|
2311
2605
|
],
|
|
2312
2606
|
},
|
|
2313
|
-
// xAI Grok Imagine Video 1.5 — KIE image-to-video
|
|
2314
|
-
//
|
|
2315
|
-
//
|
|
2316
|
-
// the
|
|
2607
|
+
// xAI Grok Imagine Video 1.5 — KIE image-to-video
|
|
2608
|
+
// (docs.kie.ai/market/grok-imagine/1-5-preview), built by the backend's
|
|
2609
|
+
// bespoke runner (kie/grok-video-15.ts). The start frame is the exact first
|
|
2610
|
+
// frame and an end frame the exact last frame; one picture wired as both is a
|
|
2611
|
+
// seamless loop (KIE `loop_url`). The Image References are up to 4
|
|
2612
|
+
// in-between frames (KIE `keyframes`), spread evenly over the clip at whole
|
|
2613
|
+
// seconds — frames only, never loose references, so `keyframes` is declared
|
|
2614
|
+
// (it also keeps the model out of generate-video-pro, whose segments would
|
|
2615
|
+
// send cast references as frames). modes:["i2v"] and no `reference-to-video`:
|
|
2616
|
+
// every run needs its start image, in-between frames included. It is also
|
|
2617
|
+
// surfaced in the text-to-video dropdown for the unified node, where the t2v
|
|
2618
|
+
// route returns a clean "requires an input image" 400. Per-second billing by
|
|
2619
|
+
// resolution, with no per-image part.
|
|
2317
2620
|
"grok-imagine-video-1.5": {
|
|
2318
2621
|
id: "grok-imagine-video-1.5",
|
|
2319
2622
|
kind: "video",
|
|
2320
2623
|
modes: ["i2v"] as const,
|
|
2321
|
-
|
|
2322
|
-
// audit): KIE's grok-imagine endpoint accepts a single image_url (the i2v
|
|
2323
|
-
// start frame) only — there is no reference transport, so advertising the
|
|
2324
|
-
// feature let the editor attach refs that were silently dropped at the
|
|
2325
|
-
// provider. Also kept OUT of VIDEO_REF_LIMITS_BY_PROVIDER for the same reason.
|
|
2624
|
+
features: ["end-frame", "reference-image", "keyframes"],
|
|
2326
2625
|
family: "xAI",
|
|
2327
2626
|
maker: "xai",
|
|
2328
2627
|
label: "Grok Imagine Video 1.5",
|
|
2329
2628
|
series: "Grok",
|
|
2330
|
-
description: "Grok Imagine 1.5
|
|
2629
|
+
description: "Grok Imagine Video 1.5 — 1–15s at 480p, 720p or 1080p, per-second pricing. An exact first and last frame (the same image as both makes a seamless loop) and up to 4 in-between frames. Requires an input image.",
|
|
2331
2630
|
useCases: ["stylized", "motion"],
|
|
2332
2631
|
aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],
|
|
2333
2632
|
durations: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
2334
2633
|
defaultDuration: 8,
|
|
2335
|
-
resolutions: ["480p", "720p"],
|
|
2634
|
+
resolutions: ["480p", "720p", "1080p"],
|
|
2635
|
+
// normalizeGrokVideo15Resolution sends 480p for anything off the list.
|
|
2636
|
+
unlistedResolutionRendersAs: "480p",
|
|
2637
|
+
// KIE refuses 1080p beside anything but a lone start frame ("1080p is only
|
|
2638
|
+
// supported for text-to-video or a single image used as the first frame",
|
|
2639
|
+
// a staging run 2026-11-12): no end frame, loop or in-between frames.
|
|
2640
|
+
startFrameOnlyResolutions: ["1080p"],
|
|
2641
|
+
noSeed: true, // the KIE schema has no `seed` (additionalProperties: false)
|
|
2336
2642
|
pricing: [
|
|
2337
|
-
{ identifier: "grok-imagine-video-1.5", credits:
|
|
2338
|
-
{ identifier: "grok-imagine-video-1.5:8s:480p", credits:
|
|
2339
|
-
{ identifier: "grok-imagine-video-1.5:8s:720p", credits:
|
|
2340
|
-
{ identifier: "grok-imagine-video-1.5:
|
|
2341
|
-
{ identifier: "grok-imagine-video-1.5:15s:
|
|
2643
|
+
{ identifier: "grok-imagine-video-1.5", credits: 50, note: "default 8s 480p — see :Ns:res variants" },
|
|
2644
|
+
{ identifier: "grok-imagine-video-1.5:8s:480p", credits: 50, note: "8s 480p" },
|
|
2645
|
+
{ identifier: "grok-imagine-video-1.5:8s:720p", credits: 90, note: "8s 720p" },
|
|
2646
|
+
{ identifier: "grok-imagine-video-1.5:8s:1080p", credits: 160, note: "8s 1080p" },
|
|
2647
|
+
{ identifier: "grok-imagine-video-1.5:15s:480p", credits: 90, note: "15s 480p (max)" },
|
|
2648
|
+
{ identifier: "grok-imagine-video-1.5:15s:720p", credits: 170, note: "15s 720p (max)" },
|
|
2649
|
+
{ identifier: "grok-imagine-video-1.5:15s:1080p", credits: 300, note: "15s 1080p (max)" },
|
|
2342
2650
|
],
|
|
2343
2651
|
},
|
|
2344
2652
|
|
|
@@ -2446,6 +2754,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2446
2754
|
durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
|
|
2447
2755
|
defaultDuration: 8,
|
|
2448
2756
|
autoDuration: true,
|
|
2757
|
+
referenceTaskTypes: ["reference", "edit", "extend"],
|
|
2449
2758
|
resolutions: ["480p", "720p", "1080p"],
|
|
2450
2759
|
// KIE refuses a seed on Seedance 2.5 (422) — the provider config omits it.
|
|
2451
2760
|
noSeed: true,
|
|
@@ -3003,24 +3312,45 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3003
3312
|
useCases: ["extend"],
|
|
3004
3313
|
pricing: [{ identifier: "runway-extend", credits: 320 }],
|
|
3005
3314
|
},
|
|
3006
|
-
|
|
3007
|
-
|
|
3315
|
+
// Seedance extends ANY video, one provider per model. Each is priced on its
|
|
3316
|
+
// own rows (`seedanceExtendCreditId`), one per second added and resolution.
|
|
3317
|
+
// The earlier single id `seedance-2-extend` is retired and runs as Seedance 2.5.
|
|
3318
|
+
"seedance-2-5-extend": {
|
|
3319
|
+
id: "seedance-2-5-extend",
|
|
3320
|
+
kind: "video",
|
|
3321
|
+
modes: ["extend"] as const,
|
|
3322
|
+
family: "Bytedance",
|
|
3323
|
+
maker: "bytedance",
|
|
3324
|
+
label: "Seedance 2.5 Extend",
|
|
3325
|
+
series: "Seedance",
|
|
3326
|
+
description: "Extend ANY video with Seedance 2.5: 4–30s continuation (audio included), stitched into one seamless clip.",
|
|
3327
|
+
useCases: ["extend"],
|
|
3328
|
+
durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
|
|
3329
|
+
defaultDuration: 8,
|
|
3330
|
+
resolutions: ["480p", "720p", "1080p"],
|
|
3331
|
+
pricing: [
|
|
3332
|
+
{ identifier: "seedance-2-5-extend:8s:720p", credits: 950, note: "default 8s 720p — see :Ns:res variants for exact" },
|
|
3333
|
+
{ identifier: "seedance-2-5-extend:8s:480p", credits: 425, note: "8s 480p" },
|
|
3334
|
+
{ identifier: "seedance-2-5-extend:8s:1080p", credits: 2375, note: "8s 1080p" },
|
|
3335
|
+
],
|
|
3336
|
+
},
|
|
3337
|
+
"seedance-2-0-extend": {
|
|
3338
|
+
id: "seedance-2-0-extend",
|
|
3008
3339
|
kind: "video",
|
|
3009
3340
|
modes: ["extend"] as const,
|
|
3010
3341
|
family: "Bytedance",
|
|
3011
3342
|
maker: "bytedance",
|
|
3012
|
-
label: "Seedance 2 Extend",
|
|
3343
|
+
label: "Seedance 2.0 Extend",
|
|
3013
3344
|
series: "Seedance",
|
|
3014
|
-
description: "Extend ANY video:
|
|
3345
|
+
description: "Extend ANY video with Seedance 2.0: 4–15s continuation (audio included), stitched into one seamless clip.",
|
|
3015
3346
|
useCases: ["extend"],
|
|
3016
3347
|
durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
3017
3348
|
defaultDuration: 8,
|
|
3018
3349
|
resolutions: ["480p", "720p", "1080p"],
|
|
3019
3350
|
pricing: [
|
|
3020
|
-
{ identifier: "seedance-2-extend", credits:
|
|
3021
|
-
{ identifier: "seedance-2-extend:8s:480p", credits:
|
|
3022
|
-
{ identifier: "seedance-2-extend:8s:
|
|
3023
|
-
{ identifier: "seedance-2-extend:8s:1080p", credits: 780, note: "8s 1080p (75+3)" },
|
|
3351
|
+
{ identifier: "seedance-2-0-extend:8s:720p", credits: 625, note: "default 8s 720p — see :Ns:res variants for exact" },
|
|
3352
|
+
{ identifier: "seedance-2-0-extend:8s:480p", credits: 288, note: "8s 480p" },
|
|
3353
|
+
{ identifier: "seedance-2-0-extend:8s:1080p", credits: 1550, note: "8s 1080p" },
|
|
3024
3354
|
],
|
|
3025
3355
|
},
|
|
3026
3356
|
"veo-1080p": {
|
|
@@ -4183,8 +4513,80 @@ export interface ModelInputContext {
|
|
|
4183
4513
|
* resolve "auto" on a model without a native auto, or whose own auto does
|
|
4184
4514
|
* not keep the photo's shape (`autoAspectFromSourceImage`); absent or
|
|
4185
4515
|
* unusable means the size is unknown and "auto" snaps the way it always has.
|
|
4516
|
+
* Also read by a masked edit on a model whose result follows its photo
|
|
4517
|
+
* (`maskEditMatchesSource`): it decides the ratio and the size.
|
|
4186
4518
|
*/
|
|
4187
4519
|
sourceImage?: SourceImageSize
|
|
4520
|
+
/** The request carries an inpainting mask (`maskUrl`). */
|
|
4521
|
+
masked?: boolean
|
|
4522
|
+
}
|
|
4523
|
+
|
|
4524
|
+
/**
|
|
4525
|
+
* True when a masked request on `modelId` follows its photo
|
|
4526
|
+
* (`maskEditMatchesSource`): its ratio and size come from the photo's size.
|
|
4527
|
+
*/
|
|
4528
|
+
export function maskEditMatchesSource(modelId: string | undefined, masked: unknown): boolean {
|
|
4529
|
+
return masked === true && !!modelId && MODEL_CATALOG[modelId]?.maskEditMatchesSource === true
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4532
|
+
/**
|
|
4533
|
+
* True when the photo's size can change what a request on `modelId` sends:
|
|
4534
|
+
* "auto" that keeps the photo's shape (`autoAspectNeedsSourceImage`), or a
|
|
4535
|
+
* masked edit that follows its photo (`maskEditMatchesSource`). A caller that
|
|
4536
|
+
* has to fetch the size asks this first.
|
|
4537
|
+
*/
|
|
4538
|
+
export function sourceImageSizeNeeded(modelId: string | undefined, aspectRatio: unknown, masked: unknown): boolean {
|
|
4539
|
+
return autoAspectNeedsSourceImage(modelId, aspectRatio) || maskEditMatchesSource(modelId, masked)
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
/**
|
|
4543
|
+
* The size a MASKED request on `modelId` runs, and is priced, at once its
|
|
4544
|
+
* photo's size is known — what `normalizeModelInput` sends for it. For an
|
|
4545
|
+
* estimate that knows the photo's size (the editor's badge, a workflow
|
|
4546
|
+
* estimate). `undefined` when the model does not follow its photo
|
|
4547
|
+
* (`maskEditMatchesSource`) or the size is unusable: the caller keeps its own.
|
|
4548
|
+
*/
|
|
4549
|
+
export function maskedEditResolution(
|
|
4550
|
+
modelId: string,
|
|
4551
|
+
levers: { aspectRatio?: unknown; resolution?: unknown; background?: unknown; outputFormat?: unknown },
|
|
4552
|
+
sourceImage: SourceImageSize | undefined,
|
|
4553
|
+
): string | undefined {
|
|
4554
|
+
if (!maskEditMatchesSource(modelId, true) || !usableSize(sourceImage)) return undefined
|
|
4555
|
+
const str = (v: unknown): string | undefined => (typeof v === "string" && v.length > 0 ? v : undefined)
|
|
4556
|
+
return normalizeModelInput(
|
|
4557
|
+
modelId,
|
|
4558
|
+
{ aspectRatio: str(levers.aspectRatio), resolution: str(levers.resolution), background: str(levers.background), outputFormat: str(levers.outputFormat) },
|
|
4559
|
+
{ sourceImage, masked: true },
|
|
4560
|
+
).resolution
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
/**
|
|
4564
|
+
* The size of `modelId` whose rendered long side, at `aspectRatio`, is nearest
|
|
4565
|
+
* the photo's long side (`outputSizes`; nearest by ratio, so 1500 px is nearer
|
|
4566
|
+
* 2048 than 1024; a tie goes to the larger size). `undefined` when the model
|
|
4567
|
+
* has no size table for that ratio or the photo's size is unusable.
|
|
4568
|
+
*/
|
|
4569
|
+
export function resolutionNearestSource(
|
|
4570
|
+
modelId: string,
|
|
4571
|
+
aspectRatio: unknown,
|
|
4572
|
+
source: SourceImageSize | undefined,
|
|
4573
|
+
): string | undefined {
|
|
4574
|
+
const m = MODEL_CATALOG[modelId]
|
|
4575
|
+
const table = m?.outputSizes
|
|
4576
|
+
if (!table || typeof aspectRatio !== "string" || !usableSize(source)) return undefined
|
|
4577
|
+
// Own keys only: a ratio such as "constructor" must not read the prototype.
|
|
4578
|
+
if (!Object.prototype.hasOwnProperty.call(table, aspectRatio)) return undefined
|
|
4579
|
+
const sizes = table[aspectRatio]!
|
|
4580
|
+
const long = Math.max(source.width, source.height)
|
|
4581
|
+
let best: string | undefined
|
|
4582
|
+
let bestDist = Infinity
|
|
4583
|
+
for (const resolution of m.resolutions ?? Object.keys(sizes)) {
|
|
4584
|
+
const px = Object.prototype.hasOwnProperty.call(sizes, resolution) ? sizes[resolution] : undefined
|
|
4585
|
+
if (!px) continue
|
|
4586
|
+
const dist = Math.abs(Math.log(Math.max(px[0], px[1]) / long))
|
|
4587
|
+
if (dist <= bestDist + ASPECT_TIE_EPSILON) { bestDist = dist; best = resolution }
|
|
4588
|
+
}
|
|
4589
|
+
return best
|
|
4188
4590
|
}
|
|
4189
4591
|
|
|
4190
4592
|
/** True for the "auto" aspect token in any case or padding. */
|
|
@@ -4192,6 +4594,31 @@ export function isAutoAspectToken(value: unknown): boolean {
|
|
|
4192
4594
|
return typeof value === "string" && value.trim().toLowerCase() === "auto"
|
|
4193
4595
|
}
|
|
4194
4596
|
|
|
4597
|
+
/**
|
|
4598
|
+
* True for the video request's "Auto" ratio — the unified node's
|
|
4599
|
+
* provider-agnostic token — in exactly the spellings a video provider adapter
|
|
4600
|
+
* receives it as (`"Auto"`, `"auto"`). Narrower than {@link isAutoAspectToken}
|
|
4601
|
+
* on purpose: it is the wire rule's own match, so a reader of it agrees with
|
|
4602
|
+
* what is sent.
|
|
4603
|
+
*/
|
|
4604
|
+
export function isVideoAutoAspectToken(value: string | undefined): boolean {
|
|
4605
|
+
return value === "Auto" || value === "auto"
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
/**
|
|
4609
|
+
* The ratio a video model runs the "Auto" token ({@link isVideoAutoAspectToken})
|
|
4610
|
+
* at: `"adaptive"` (match the input) when the request has a visual input to
|
|
4611
|
+
* match — a frame, a reference image or a reference video — and the model's
|
|
4612
|
+
* catalog lists `"adaptive"`; otherwise `undefined`, and the provider adapter
|
|
4613
|
+
* sends its own fixed default. The ONE mapping: the KIE adapter sends what it
|
|
4614
|
+
* says, and the Seedance reference task type resolver reads it to tell a ratio
|
|
4615
|
+
* it would replace from one that already runs at the ratio it forces.
|
|
4616
|
+
*/
|
|
4617
|
+
export function videoAutoAspectRunsAt(modelId: string | undefined, hasVisualInput: boolean): "adaptive" | undefined {
|
|
4618
|
+
if (!hasVisualInput || !modelId) return undefined
|
|
4619
|
+
return MODEL_CATALOG[modelId]?.aspectRatios?.includes("adaptive") ? "adaptive" : undefined
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4195
4622
|
function usableSize(size: SourceImageSize | undefined): size is SourceImageSize {
|
|
4196
4623
|
return (
|
|
4197
4624
|
size !== undefined &&
|
|
@@ -4392,12 +4819,31 @@ export function normalizeModelInput(
|
|
|
4392
4819
|
out.gifFrameDurationMs = format.levers.gifFrameDurationMs
|
|
4393
4820
|
out.svgLevel = format.levers.svgLevel
|
|
4394
4821
|
const gif = format.levers.outputFormat === "gif"
|
|
4822
|
+
// A masked edit that follows its photo runs at "auto" whatever ratio it
|
|
4823
|
+
// names, and at the size nearest the photo (`maskEditMatchesSource`).
|
|
4824
|
+
const followsSource = !gif && maskEditMatchesSource(modelId, context.masked)
|
|
4825
|
+
const askedRatio = followsSource ? "auto" : input.aspectRatio
|
|
4395
4826
|
|
|
4396
4827
|
const sourceRatio =
|
|
4397
|
-
!gif && autoAspectNeedsSourceImage(modelId,
|
|
4828
|
+
!gif && autoAspectNeedsSourceImage(modelId, askedRatio) && usableSize(context.sourceImage)
|
|
4398
4829
|
? nearestCatalogAspectRatio(context.sourceImage.width, context.sourceImage.height, m.aspectRatios ?? [])
|
|
4399
4830
|
: undefined
|
|
4400
|
-
if (
|
|
4831
|
+
if (followsSource && input.aspectRatio !== undefined && !isAutoAspectToken(input.aspectRatio)) {
|
|
4832
|
+
const to = sourceRatio ?? "auto"
|
|
4833
|
+
if (to !== input.aspectRatio) {
|
|
4834
|
+
adjustments.push({
|
|
4835
|
+
field: "aspectRatio",
|
|
4836
|
+
from: input.aspectRatio,
|
|
4837
|
+
to,
|
|
4838
|
+
reason: sourceRatio !== undefined
|
|
4839
|
+
? `A masked edit on ${m.label} keeps the photo's shape — using "${sourceRatio}", the supported ratio closest to the source image (${context.sourceImage!.width}x${context.sourceImage!.height}).`
|
|
4840
|
+
: `A masked edit on ${m.label} keeps the photo's shape — using "auto".`,
|
|
4841
|
+
})
|
|
4842
|
+
}
|
|
4843
|
+
out.aspectRatio = to
|
|
4844
|
+
} else if (followsSource && input.aspectRatio === undefined) {
|
|
4845
|
+
out.aspectRatio = sourceRatio ?? "auto"
|
|
4846
|
+
} else if (gif) {
|
|
4401
4847
|
// A GIF is square, IMAGE_GIF_FRAME_SIZE a frame: neither lever applies.
|
|
4402
4848
|
// "auto" leaves the shape to the model, and square is its answer.
|
|
4403
4849
|
if (input.aspectRatio !== undefined && input.aspectRatio !== "1:1" && !isAutoAspectToken(input.aspectRatio)) {
|
|
@@ -4409,14 +4855,14 @@ export function normalizeModelInput(
|
|
|
4409
4855
|
})
|
|
4410
4856
|
}
|
|
4411
4857
|
out.aspectRatio = input.aspectRatio === undefined ? undefined : "1:1"
|
|
4412
|
-
} else if (sourceRatio !== undefined &&
|
|
4858
|
+
} else if (sourceRatio !== undefined && askedRatio !== undefined) {
|
|
4413
4859
|
const { width, height } = context.sourceImage!
|
|
4414
4860
|
const why = m.autoAspectFromSourceImage === true
|
|
4415
4861
|
? `${m.label}'s own "auto" does not keep the photo's shape`
|
|
4416
4862
|
: `${m.label} has no "auto" aspect ratio`
|
|
4417
4863
|
adjustments.push({
|
|
4418
4864
|
field: "aspectRatio",
|
|
4419
|
-
from: input.aspectRatio,
|
|
4865
|
+
from: input.aspectRatio ?? askedRatio,
|
|
4420
4866
|
to: sourceRatio,
|
|
4421
4867
|
reason: `${why} — using "${sourceRatio}", the supported ratio closest to the source image's shape (${width}x${height}).`,
|
|
4422
4868
|
})
|
|
@@ -4424,7 +4870,23 @@ export function normalizeModelInput(
|
|
|
4424
4870
|
} else {
|
|
4425
4871
|
out.aspectRatio = snap("aspectRatio", input.aspectRatio, m.aspectRatios)
|
|
4426
4872
|
}
|
|
4427
|
-
if (
|
|
4873
|
+
if (followsSource) {
|
|
4874
|
+
// The size whose long side is nearest the photo's: the result is the
|
|
4875
|
+
// photo's own size, so the run is rendered, and priced, near it.
|
|
4876
|
+
const asked = snap("resolution", input.resolution, m.resolutions, defaultResolutionFor(modelId))
|
|
4877
|
+
const nearest = resolutionNearestSource(modelId, out.aspectRatio, context.sourceImage)
|
|
4878
|
+
const from = asked ?? m.defaultResolution ?? m.resolutions?.[0]
|
|
4879
|
+
if (nearest !== undefined && from !== undefined && nearest !== from) {
|
|
4880
|
+
const { width, height } = context.sourceImage!
|
|
4881
|
+
adjustments.push({
|
|
4882
|
+
field: "resolution",
|
|
4883
|
+
from,
|
|
4884
|
+
to: nearest,
|
|
4885
|
+
reason: `A masked edit on ${m.label} is delivered at the photo's own size (${width}x${height}) — rendering at ${nearest}, the size nearest it.`,
|
|
4886
|
+
})
|
|
4887
|
+
}
|
|
4888
|
+
out.resolution = nearest ?? asked
|
|
4889
|
+
} else if (gif) {
|
|
4428
4890
|
if (input.resolution !== undefined) {
|
|
4429
4891
|
adjustments.push({
|
|
4430
4892
|
field: "resolution",
|
|
@@ -4859,6 +5321,8 @@ const MODEL_VALUE_LABELS: Record<string, string> = {
|
|
|
4859
5321
|
"adaptive": "Adaptive",
|
|
4860
5322
|
// image resolutions
|
|
4861
5323
|
"1K": "1K (Standard)",
|
|
5324
|
+
// Only Seedream 5.5 lists it.
|
|
5325
|
+
"1.5K": "1.5K (Medium)",
|
|
4862
5326
|
"2K": "2K (High)",
|
|
4863
5327
|
"4K": "4K (Ultra)",
|
|
4864
5328
|
"4k": "4K",
|