api_nodes: added prices for ByteDance Image nodes (#5152)

This commit is contained in:
Alexander Piskun
2025-08-22 21:05:25 +03:00
committed by GitHub
parent 882506dfb1
commit aebdda3063
2 changed files with 60 additions and 1 deletions

View File

@@ -1383,6 +1383,38 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
}, },
ViduStartEndToVideoNode: { ViduStartEndToVideoNode: {
displayPrice: '$0.4/Run' displayPrice: '$0.4/Run'
},
ByteDanceImageNode: {
displayPrice: (node: LGraphNode): string => {
const modelWidget = node.widgets?.find(
(w) => w.name === 'model'
) as IComboWidget
if (!modelWidget) return 'Token-based'
const model = String(modelWidget.value)
if (model.includes('seedream-3-0-t2i')) {
return '$0.03/Run'
}
return 'Token-based'
}
},
ByteDanceImageEditNode: {
displayPrice: (node: LGraphNode): string => {
const modelWidget = node.widgets?.find(
(w) => w.name === 'model'
) as IComboWidget
if (!modelWidget) return 'Token-based'
const model = String(modelWidget.value)
if (model.includes('seededit-3-0-i2i')) {
return '$0.03/Run'
}
return 'Token-based'
}
} }
} }
@@ -1470,7 +1502,10 @@ export const useNodePricing = () => {
// Google/Gemini nodes // Google/Gemini nodes
GeminiNode: ['model'], GeminiNode: ['model'],
// OpenAI nodes // OpenAI nodes
OpenAIChatNode: ['model'] OpenAIChatNode: ['model'],
// ByteDance
ByteDanceImageNode: ['model'],
ByteDanceImageEditNode: ['model']
} }
return widgetMap[nodeType] || [] return widgetMap[nodeType] || []
} }

View File

@@ -1694,6 +1694,30 @@ describe('useNodePricing', () => {
'$0.1-0.4/Run (varies with quad, style, texture & quality)' '$0.1-0.4/Run (varies with quad, style, texture & quality)'
) )
}) })
it('should return correct pricing for exposed ByteDance models', () => {
const { getNodeDisplayPrice } = useNodePricing()
const testCases = [
{
node_name: 'ByteDanceImageNode',
model: 'seedream-3-0-t2i-250415',
expected: '$0.03/Run'
},
{
node_name: 'ByteDanceImageEditNode',
model: 'seededit-3-0-i2i-250628',
expected: '$0.03/Run'
}
]
testCases.forEach(({ node_name, model, expected }) => {
const node = createMockNode(node_name, [
{ name: 'model', value: model }
])
expect(getNodeDisplayPrice(node)).toBe(expected)
})
})
}) })
}) })
}) })