Skip to content

[Hotfix] Cherry-pick pricing fixes to core/1.23 #4383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 193 additions & 36 deletions src/composables/node/useNodePricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,55 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
displayPrice: '$0.06/Run'
},
IdeogramV1: {
displayPrice: '$0.06/Run'
displayPrice: (node: LGraphNode): string => {
const numImagesWidget = node.widgets?.find(
(w) => w.name === 'num_images'
) as IComboWidget
if (!numImagesWidget) return '$0.06 x num_images/Run'

const numImages = Number(numImagesWidget.value) || 1
const cost = (0.06 * numImages).toFixed(2)
return `$${cost}/Run`
}
},
IdeogramV2: {
displayPrice: '$0.08/Run'
displayPrice: (node: LGraphNode): string => {
const numImagesWidget = node.widgets?.find(
(w) => w.name === 'num_images'
) as IComboWidget
if (!numImagesWidget) return '$0.08 x num_images/Run'

const numImages = Number(numImagesWidget.value) || 1
const cost = (0.08 * numImages).toFixed(2)
return `$${cost}/Run`
}
},
IdeogramV3: {
displayPrice: (node: LGraphNode): string => {
const renderingSpeedWidget = node.widgets?.find(
(w) => w.name === 'rendering_speed'
) as IComboWidget
const numImagesWidget = node.widgets?.find(
(w) => w.name === 'num_images'
) as IComboWidget

if (!renderingSpeedWidget)
return '$0.03-0.08/Run (varies with rendering speed)'
return '$0.03-0.08 x num_images/Run (varies with rendering speed & num_images)'

const numImages = Number(numImagesWidget?.value) || 1
let basePrice = 0.06 // default balanced price

const renderingSpeed = String(renderingSpeedWidget.value)
if (renderingSpeed.toLowerCase().includes('quality')) {
return '$0.08/Run'
basePrice = 0.08
} else if (renderingSpeed.toLowerCase().includes('balanced')) {
return '$0.06/Run'
basePrice = 0.06
} else if (renderingSpeed.toLowerCase().includes('turbo')) {
return '$0.03/Run'
basePrice = 0.03
}

return '$0.06/Run'
const totalCost = (basePrice * numImages).toFixed(2)
return `$${totalCost}/Run`
}
},
KlingCameraControlI2VNode: {
Expand Down Expand Up @@ -250,30 +275,33 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const modelWidget = node.widgets?.find(
(w) => w.name === 'model_name'
) as IComboWidget
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget

if (!modelWidget)
return '$0.0035-0.028/Run (varies with modality & model)'
return '$0.0035-0.028 x n/Run (varies with modality & model)'

const model = String(modelWidget.value)
const n = Number(nWidget?.value) || 1
let basePrice = 0.014 // default

if (modality.includes('text to image')) {
if (model.includes('kling-v1')) {
return '$0.0035/Run'
} else if (
model.includes('kling-v1-5') ||
model.includes('kling-v2')
) {
return '$0.014/Run'
if (model.includes('kling-v1-5') || model.includes('kling-v2')) {
basePrice = 0.014
} else if (model.includes('kling-v1')) {
basePrice = 0.0035
}
} else if (modality.includes('image to image')) {
if (model.includes('kling-v1')) {
return '$0.0035/Run'
} else if (model.includes('kling-v1-5')) {
return '$0.028/Run'
if (model.includes('kling-v1-5')) {
basePrice = 0.028
} else if (model.includes('kling-v1')) {
basePrice = 0.0035
}
}

return '$0.014/Run'
const totalCost = (basePrice * n).toFixed(4)
return `$${totalCost}/Run`
}
},
KlingLipSyncAudioToVideoNode: {
Expand Down Expand Up @@ -498,19 +526,26 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const sizeWidget = node.widgets?.find(
(w) => w.name === 'size'
) as IComboWidget
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget

if (!sizeWidget) return '$0.016-0.02/Run (varies with size)'
if (!sizeWidget) return '$0.016-0.02 x n/Run (varies with size & n)'

const size = String(sizeWidget.value)
const n = Number(nWidget?.value) || 1
let basePrice = 0.02 // default

if (size.includes('1024x1024')) {
return '$0.02/Run'
basePrice = 0.02
} else if (size.includes('512x512')) {
return '$0.018/Run'
basePrice = 0.018
} else if (size.includes('256x256')) {
return '$0.016/Run'
basePrice = 0.016
}

return '$0.02/Run'
const totalCost = (basePrice * n).toFixed(3)
return `$${totalCost}/Run`
}
},
OpenAIDalle3: {
Expand Down Expand Up @@ -545,19 +580,30 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const qualityWidget = node.widgets?.find(
(w) => w.name === 'quality'
) as IComboWidget
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget

if (!qualityWidget) return '$0.011-0.30/Run (varies with quality)'
if (!qualityWidget)
return '$0.011-0.30 x n/Run (varies with quality & n)'

const quality = String(qualityWidget.value)
const n = Number(nWidget?.value) || 1
let basePriceRange = '$0.046-0.07' // default medium

if (quality.includes('high')) {
return '$0.167-0.30/Run'
basePriceRange = '$0.167-0.30'
} else if (quality.includes('medium')) {
return '$0.046-0.07/Run'
basePriceRange = '$0.046-0.07'
} else if (quality.includes('low')) {
return '$0.011-0.02/Run'
basePriceRange = '$0.011-0.02'
}

return '$0.046-0.07/Run'
if (n === 1) {
return `${basePriceRange}/Run`
} else {
return `${basePriceRange} x ${n}/Run`
}
}
},
PikaImageToVideoNode2_2: {
Expand Down Expand Up @@ -692,6 +738,42 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
RecraftCrispUpscaleNode: {
displayPrice: '$0.004/Run'
},
RecraftGenerateColorFromImageNode: {
displayPrice: (node: LGraphNode): string => {
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget
if (!nWidget) return '$0.04 x n/Run'

const n = Number(nWidget.value) || 1
const cost = (0.04 * n).toFixed(2)
return `$${cost}/Run`
}
},
RecraftGenerateImageNode: {
displayPrice: (node: LGraphNode): string => {
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget
if (!nWidget) return '$0.04 x n/Run'

const n = Number(nWidget.value) || 1
const cost = (0.04 * n).toFixed(2)
return `$${cost}/Run`
}
},
RecraftGenerateVectorImageNode: {
displayPrice: (node: LGraphNode): string => {
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget
if (!nWidget) return '$0.08 x n/Run'

const n = Number(nWidget.value) || 1
const cost = (0.08 * n).toFixed(2)
return `$${cost}/Run`
}
},
RecraftImageInpaintingNode: {
displayPrice: (node: LGraphNode): string => {
const nWidget = node.widgets?.find(
Expand Down Expand Up @@ -747,7 +829,16 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
}
},
RecraftVectorizeImageNode: {
displayPrice: '$0.01/Run'
displayPrice: (node: LGraphNode): string => {
const nWidget = node.widgets?.find(
(w) => w.name === 'n'
) as IComboWidget
if (!nWidget) return '$0.01 x n/Run'

const n = Number(nWidget.value) || 1
const cost = (0.01 * n).toFixed(2)
return `$${cost}/Run`
}
},
StabilityStableImageSD_3_5Node: {
displayPrice: (node: LGraphNode): string => {
Expand Down Expand Up @@ -856,6 +947,63 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =

return '$0.0172/Run'
}
},
MoonvalleyTxt2VideoNode: {
displayPrice: (node: LGraphNode): string => {
const lengthWidget = node.widgets?.find(
(w) => w.name === 'length'
) as IComboWidget

// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$1.50/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
return '$1.50/Run'
} else if (length === '10s') {
return '$3.00/Run'
}

return '$1.50/Run'
}
},
MoonvalleyImg2VideoNode: {
displayPrice: (node: LGraphNode): string => {
const lengthWidget = node.widgets?.find(
(w) => w.name === 'length'
) as IComboWidget

// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$1.50/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
return '$1.50/Run'
} else if (length === '10s') {
return '$3.00/Run'
}

return '$1.50/Run'
}
},
MoonvalleyVideo2VideoNode: {
displayPrice: (node: LGraphNode): string => {
const lengthWidget = node.widgets?.find(
(w) => w.name === 'length'
) as IComboWidget

// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$2.25/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
return '$2.25/Run'
} else if (length === '10s') {
return '$4.00/Run'
}

return '$2.25/Run'
}
}
}

Expand Down Expand Up @@ -890,14 +1038,16 @@ export const useNodePricing = () => {
const widgetMap: Record<string, string[]> = {
KlingTextToVideoNode: ['mode', 'model_name', 'duration'],
KlingImage2VideoNode: ['mode', 'model_name', 'duration'],
KlingImageGenerationNode: ['modality', 'model_name'],
KlingImageGenerationNode: ['modality', 'model_name', 'n'],
KlingDualCharacterVideoEffectNode: ['mode', 'model_name', 'duration'],
KlingSingleImageVideoEffectNode: ['effect_scene'],
KlingStartEndFrameNode: ['mode', 'model_name', 'duration'],
OpenAIDalle3: ['size', 'quality'],
OpenAIDalle2: ['size'],
OpenAIGPTImage1: ['quality'],
IdeogramV3: ['rendering_speed'],
OpenAIDalle2: ['size', 'n'],
OpenAIGPTImage1: ['quality', 'n'],
IdeogramV1: ['num_images'],
IdeogramV2: ['num_images'],
IdeogramV3: ['rendering_speed', 'num_images'],
VeoVideoGenerationNode: ['duration_seconds'],
LumaVideoNode: ['model', 'resolution', 'duration'],
LumaImageToVideoNode: ['model', 'resolution', 'duration'],
Expand All @@ -918,7 +1068,14 @@ export const useNodePricing = () => {
RecraftTextToImageNode: ['n'],
RecraftImageToImageNode: ['n'],
RecraftImageInpaintingNode: ['n'],
RecraftTextToVectorNode: ['n']
RecraftTextToVectorNode: ['n'],
RecraftVectorizeImageNode: ['n'],
RecraftGenerateColorFromImageNode: ['n'],
RecraftGenerateImageNode: ['n'],
RecraftGenerateVectorImageNode: ['n'],
MoonvalleyTxt2VideoNode: ['length'],
MoonvalleyImg2VideoNode: ['length'],
MoonvalleyVideo2VideoNode: ['length']
}
return widgetMap[nodeType] || []
}
Expand Down
Loading
Loading