From e401bc2a17315cb578a14daf727e57a72ed79db4 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Tue, 23 Dec 2025 03:09:43 +0900 Subject: [PATCH] [backport cloud/1.35] add pricing badge for Flux2Max node (#7722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #7641 to `cloud/1.35` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7722-backport-cloud-1-35-add-pricing-badge-for-Flux2Max-node-2d16d73d3650819b8a17cb37ad9ee4c0) by [Unito](https://www.unito.io) Co-authored-by: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> --- src/composables/node/useNodePricing.ts | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/composables/node/useNodePricing.ts b/src/composables/node/useNodePricing.ts index 79590df24..acd084130 100644 --- a/src/composables/node/useNodePricing.ts +++ b/src/composables/node/useNodePricing.ts @@ -512,6 +512,46 @@ const apiNodeCosts: Record = return `$${parseFloat(outputCost.toFixed(3))}/Run` } }, + Flux2MaxImageNode: { + displayPrice: (node: LGraphNode): string => { + const widthW = node.widgets?.find( + (w) => w.name === 'width' + ) as IComboWidget + const heightW = node.widgets?.find( + (w) => w.name === 'height' + ) as IComboWidget + + const w = Number(widthW?.value) + const h = Number(heightW?.value) + if (!Number.isFinite(w) || !Number.isFinite(h) || w <= 0 || h <= 0) { + // global min/max for this node given schema bounds (1MP..4MP output) + return '$0.07–$0.35/Run' + } + + // Is the 'images' input connected? + const imagesInput = node.inputs?.find( + (i) => i.name === 'images' + ) as INodeInputSlot + const hasRefs = + typeof imagesInput?.link !== 'undefined' && imagesInput.link != null + + // Output cost: ceil((w*h)/MP); first MP $0.07, each additional $0.03 + const MP = 1024 * 1024 + const outMP = Math.max(1, Math.floor((w * h + MP - 1) / MP)) + const outputCost = 0.07 + 0.03 * Math.max(outMP - 1, 0) + + if (hasRefs) { + // Unknown ref count/size on the frontend: + // min extra is $0.03, max extra is $0.27 (8 MP cap / 8 refs) + const minTotal = outputCost + 0.03 + const maxTotal = outputCost + 0.24 + return `~$${parseFloat(minTotal.toFixed(3))}–$${parseFloat(maxTotal.toFixed(3))}/Run` + } + + // Precise text-to-image price + return `$${parseFloat(outputCost.toFixed(3))}/Run` + } + }, OpenAIVideoSora2: { displayPrice: sora2PricingCalculator }, @@ -2024,6 +2064,7 @@ export const useNodePricing = () => { FluxProKontextProNode: [], FluxProKontextMaxNode: [], Flux2ProImageNode: ['width', 'height', 'images'], + Flux2MaxImageNode: ['width', 'height', 'images'], VeoVideoGenerationNode: ['duration_seconds'], Veo3VideoGenerationNode: ['model', 'generate_audio'], Veo3FirstLastFrameNode: ['model', 'generate_audio', 'duration'],