Skip to content

Commit 65fa44a

Browse files
[feat] Add dynamic pricing for new API nodes (#4367)
1 parent 141403b commit 65fa44a

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

src/composables/node/useNodePricing.ts

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,60 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
947947

948948
return '$0.0172/Run'
949949
}
950+
},
951+
MoonvalleyTxt2VideoNode: {
952+
displayPrice: (node: LGraphNode): string => {
953+
const lengthWidget = node.widgets?.find(
954+
(w) => w.name === 'length'
955+
) as IComboWidget
956+
957+
if (!lengthWidget) return '$1.50-3.00/Run (varies with length)'
958+
959+
const length = String(lengthWidget.value)
960+
if (length === '5s') {
961+
return '$1.50/Run'
962+
} else if (length === '10s') {
963+
return '$3.00/Run'
964+
}
965+
966+
return '$1.50/Run'
967+
}
968+
},
969+
MoonvalleyImg2VideoNode: {
970+
displayPrice: (node: LGraphNode): string => {
971+
const lengthWidget = node.widgets?.find(
972+
(w) => w.name === 'length'
973+
) as IComboWidget
974+
975+
if (!lengthWidget) return '$1.50-3.00/Run (varies with length)'
976+
977+
const length = String(lengthWidget.value)
978+
if (length === '5s') {
979+
return '$1.50/Run'
980+
} else if (length === '10s') {
981+
return '$3.00/Run'
982+
}
983+
984+
return '$1.50/Run'
985+
}
986+
},
987+
MoonvalleyVideo2VideoNode: {
988+
displayPrice: (node: LGraphNode): string => {
989+
const lengthWidget = node.widgets?.find(
990+
(w) => w.name === 'length'
991+
) as IComboWidget
992+
993+
if (!lengthWidget) return '$2.00-4.00/Run (varies with length)'
994+
995+
const length = String(lengthWidget.value)
996+
if (length === '5s') {
997+
return '$2.00/Run'
998+
} else if (length === '10s') {
999+
return '$4.00/Run'
1000+
}
1001+
1002+
return '$2.00/Run'
1003+
}
9501004
}
9511005
}
9521006

@@ -1015,7 +1069,10 @@ export const useNodePricing = () => {
10151069
RecraftVectorizeImageNode: ['n'],
10161070
RecraftGenerateColorFromImageNode: ['n'],
10171071
RecraftGenerateImageNode: ['n'],
1018-
RecraftGenerateVectorImageNode: ['n']
1072+
RecraftGenerateVectorImageNode: ['n'],
1073+
MoonvalleyTxt2VideoNode: ['length'],
1074+
MoonvalleyImg2VideoNode: ['length'],
1075+
MoonvalleyVideo2VideoNode: ['length']
10191076
}
10201077
return widgetMap[nodeType] || []
10211078
}

0 commit comments

Comments
 (0)