@@ -275,30 +275,33 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
275275 const modelWidget = node . widgets ?. find (
276276 ( w ) => w . name === 'model_name'
277277 ) as IComboWidget
278+ const nWidget = node . widgets ?. find (
279+ ( w ) => w . name === 'n'
280+ ) as IComboWidget
278281
279282 if ( ! modelWidget )
280- return '$0.0035-0.028/Run (varies with modality & model)'
283+ return '$0.0035-0.028 x n /Run (varies with modality & model)'
281284
282285 const model = String ( modelWidget . value )
286+ const n = Number ( nWidget ?. value ) || 1
287+ let basePrice = 0.014 // default
283288
284289 if ( modality . includes ( 'text to image' ) ) {
285- if ( model . includes ( 'kling-v1' ) ) {
286- return '$0.0035/Run'
287- } else if (
288- model . includes ( 'kling-v1-5' ) ||
289- model . includes ( 'kling-v2' )
290- ) {
291- return '$0.014/Run'
290+ if ( model . includes ( 'kling-v1-5' ) || model . includes ( 'kling-v2' ) ) {
291+ basePrice = 0.014
292+ } else if ( model . includes ( 'kling-v1' ) ) {
293+ basePrice = 0.0035
292294 }
293295 } else if ( modality . includes ( 'image to image' ) ) {
294- if ( model . includes ( 'kling-v1' ) ) {
295- return '$0.0035/Run'
296- } else if ( model . includes ( 'kling-v1-5 ' ) ) {
297- return '$0.028/Run'
296+ if ( model . includes ( 'kling-v1-5 ' ) ) {
297+ basePrice = 0.028
298+ } else if ( model . includes ( 'kling-v1' ) ) {
299+ basePrice = 0.0035
298300 }
299301 }
300302
301- return '$0.014/Run'
303+ const totalCost = ( basePrice * n ) . toFixed ( 4 )
304+ return `$${ totalCost } /Run`
302305 }
303306 } ,
304307 KlingLipSyncAudioToVideoNode : {
@@ -523,19 +526,26 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
523526 const sizeWidget = node . widgets ?. find (
524527 ( w ) => w . name === 'size'
525528 ) as IComboWidget
529+ const nWidget = node . widgets ?. find (
530+ ( w ) => w . name === 'n'
531+ ) as IComboWidget
526532
527- if ( ! sizeWidget ) return '$0.016-0.02/Run (varies with size)'
533+ if ( ! sizeWidget ) return '$0.016-0.02 x n /Run (varies with size & n )'
528534
529535 const size = String ( sizeWidget . value )
536+ const n = Number ( nWidget ?. value ) || 1
537+ let basePrice = 0.02 // default
538+
530539 if ( size . includes ( '1024x1024' ) ) {
531- return '$ 0.02/Run'
540+ basePrice = 0.02
532541 } else if ( size . includes ( '512x512' ) ) {
533- return '$ 0.018/Run'
542+ basePrice = 0.018
534543 } else if ( size . includes ( '256x256' ) ) {
535- return '$ 0.016/Run'
544+ basePrice = 0.016
536545 }
537546
538- return '$0.02/Run'
547+ const totalCost = ( basePrice * n ) . toFixed ( 3 )
548+ return `$${ totalCost } /Run`
539549 }
540550 } ,
541551 OpenAIDalle3 : {
@@ -570,19 +580,30 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
570580 const qualityWidget = node . widgets ?. find (
571581 ( w ) => w . name === 'quality'
572582 ) as IComboWidget
583+ const nWidget = node . widgets ?. find (
584+ ( w ) => w . name === 'n'
585+ ) as IComboWidget
573586
574- if ( ! qualityWidget ) return '$0.011-0.30/Run (varies with quality)'
587+ if ( ! qualityWidget )
588+ return '$0.011-0.30 x n/Run (varies with quality & n)'
575589
576590 const quality = String ( qualityWidget . value )
591+ const n = Number ( nWidget ?. value ) || 1
592+ let basePriceRange = '$0.046-0.07' // default medium
593+
577594 if ( quality . includes ( 'high' ) ) {
578- return '$0.167-0.30/Run '
595+ basePriceRange = '$0.167-0.30'
579596 } else if ( quality . includes ( 'medium' ) ) {
580- return '$0.046-0.07/Run '
597+ basePriceRange = '$0.046-0.07'
581598 } else if ( quality . includes ( 'low' ) ) {
582- return '$0.011-0.02/Run '
599+ basePriceRange = '$0.011-0.02'
583600 }
584601
585- return '$0.046-0.07/Run'
602+ if ( n === 1 ) {
603+ return `${ basePriceRange } /Run`
604+ } else {
605+ return `${ basePriceRange } x ${ n } /Run`
606+ }
586607 }
587608 } ,
588609 PikaImageToVideoNode2_2 : {
@@ -717,6 +738,42 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
717738 RecraftCrispUpscaleNode : {
718739 displayPrice : '$0.004/Run'
719740 } ,
741+ RecraftGenerateColorFromImageNode : {
742+ displayPrice : ( node : LGraphNode ) : string => {
743+ const nWidget = node . widgets ?. find (
744+ ( w ) => w . name === 'n'
745+ ) as IComboWidget
746+ if ( ! nWidget ) return '$0.04 x n/Run'
747+
748+ const n = Number ( nWidget . value ) || 1
749+ const cost = ( 0.04 * n ) . toFixed ( 2 )
750+ return `$${ cost } /Run`
751+ }
752+ } ,
753+ RecraftGenerateImageNode : {
754+ displayPrice : ( node : LGraphNode ) : string => {
755+ const nWidget = node . widgets ?. find (
756+ ( w ) => w . name === 'n'
757+ ) as IComboWidget
758+ if ( ! nWidget ) return '$0.04 x n/Run'
759+
760+ const n = Number ( nWidget . value ) || 1
761+ const cost = ( 0.04 * n ) . toFixed ( 2 )
762+ return `$${ cost } /Run`
763+ }
764+ } ,
765+ RecraftGenerateVectorImageNode : {
766+ displayPrice : ( node : LGraphNode ) : string => {
767+ const nWidget = node . widgets ?. find (
768+ ( w ) => w . name === 'n'
769+ ) as IComboWidget
770+ if ( ! nWidget ) return '$0.08 x n/Run'
771+
772+ const n = Number ( nWidget . value ) || 1
773+ const cost = ( 0.08 * n ) . toFixed ( 2 )
774+ return `$${ cost } /Run`
775+ }
776+ } ,
720777 RecraftImageInpaintingNode : {
721778 displayPrice : ( node : LGraphNode ) : string => {
722779 const nWidget = node . widgets ?. find (
@@ -772,7 +829,16 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
772829 }
773830 } ,
774831 RecraftVectorizeImageNode : {
775- displayPrice : '$0.01/Run'
832+ displayPrice : ( node : LGraphNode ) : string => {
833+ const nWidget = node . widgets ?. find (
834+ ( w ) => w . name === 'n'
835+ ) as IComboWidget
836+ if ( ! nWidget ) return '$0.01 x n/Run'
837+
838+ const n = Number ( nWidget . value ) || 1
839+ const cost = ( 0.01 * n ) . toFixed ( 2 )
840+ return `$${ cost } /Run`
841+ }
776842 } ,
777843 StabilityStableImageSD_3_5Node : {
778844 displayPrice : ( node : LGraphNode ) : string => {
@@ -915,13 +981,13 @@ export const useNodePricing = () => {
915981 const widgetMap : Record < string , string [ ] > = {
916982 KlingTextToVideoNode : [ 'mode' , 'model_name' , 'duration' ] ,
917983 KlingImage2VideoNode : [ 'mode' , 'model_name' , 'duration' ] ,
918- KlingImageGenerationNode : [ 'modality' , 'model_name' ] ,
984+ KlingImageGenerationNode : [ 'modality' , 'model_name' , 'n' ] ,
919985 KlingDualCharacterVideoEffectNode : [ 'mode' , 'model_name' , 'duration' ] ,
920986 KlingSingleImageVideoEffectNode : [ 'effect_scene' ] ,
921987 KlingStartEndFrameNode : [ 'mode' , 'model_name' , 'duration' ] ,
922988 OpenAIDalle3 : [ 'size' , 'quality' ] ,
923- OpenAIDalle2 : [ 'size' ] ,
924- OpenAIGPTImage1 : [ 'quality' ] ,
989+ OpenAIDalle2 : [ 'size' , 'n' ] ,
990+ OpenAIGPTImage1 : [ 'quality' , 'n' ] ,
925991 IdeogramV1 : [ 'num_images' ] ,
926992 IdeogramV2 : [ 'num_images' ] ,
927993 IdeogramV3 : [ 'rendering_speed' , 'num_images' ] ,
@@ -945,7 +1011,11 @@ export const useNodePricing = () => {
9451011 RecraftTextToImageNode : [ 'n' ] ,
9461012 RecraftImageToImageNode : [ 'n' ] ,
9471013 RecraftImageInpaintingNode : [ 'n' ] ,
948- RecraftTextToVectorNode : [ 'n' ]
1014+ RecraftTextToVectorNode : [ 'n' ] ,
1015+ RecraftVectorizeImageNode : [ 'n' ] ,
1016+ RecraftGenerateColorFromImageNode : [ 'n' ] ,
1017+ RecraftGenerateImageNode : [ 'n' ] ,
1018+ RecraftGenerateVectorImageNode : [ 'n' ]
9491019 }
9501020 return widgetMap [ nodeType ] || [ ]
9511021 }
0 commit comments