Skip to content

Commit 5befd00

Browse files
add pricing for new ByteDance node (#5481) (#5483)
Co-authored-by: Alexander Piskun <[email protected]>
1 parent 75e5089 commit 5befd00

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

src/composables/node/useNodePricing.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,32 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
15021502
return 'Token-based'
15031503
}
15041504
},
1505+
ByteDanceSeedreamNode: {
1506+
displayPrice: (node: LGraphNode): string => {
1507+
const sequentialGenerationWidget = node.widgets?.find(
1508+
(w) => w.name === 'sequential_image_generation'
1509+
) as IComboWidget
1510+
const maxImagesWidget = node.widgets?.find(
1511+
(w) => w.name === 'max_images'
1512+
) as IComboWidget
1513+
1514+
if (!sequentialGenerationWidget || !maxImagesWidget)
1515+
return '$0.03/Run ($0.03 for one output image)'
1516+
1517+
if (
1518+
String(sequentialGenerationWidget.value).toLowerCase() === 'disabled'
1519+
) {
1520+
return '$0.03/Run'
1521+
}
1522+
1523+
const maxImages = Number(maxImagesWidget.value)
1524+
if (maxImages === 1) {
1525+
return '$0.03/Run'
1526+
}
1527+
const cost = (0.03 * maxImages).toFixed(2)
1528+
return `$${cost}/Run ($0.03 for one output image)`
1529+
}
1530+
},
15051531
ByteDanceTextToVideoNode: {
15061532
displayPrice: byteDanceVideoPricingCalculator
15071533
},
@@ -1604,6 +1630,11 @@ export const useNodePricing = () => {
16041630
// ByteDance
16051631
ByteDanceImageNode: ['model'],
16061632
ByteDanceImageEditNode: ['model'],
1633+
ByteDanceSeedreamNode: [
1634+
'model',
1635+
'sequential_image_generation',
1636+
'max_images'
1637+
],
16071638
ByteDanceTextToVideoNode: ['model', 'duration', 'resolution'],
16081639
ByteDanceImageToVideoNode: ['model', 'duration', 'resolution'],
16091640
ByteDanceFirstLastFrameNode: ['model', 'duration', 'resolution'],

tests-ui/tests/composables/node/useNodePricing.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,38 @@ describe('useNodePricing', () => {
17811781
})
17821782
})
17831783

1784+
describe('dynamic pricing - ByteDanceSeedreamNode', () => {
1785+
it('should return fallback when widgets are missing', () => {
1786+
const { getNodeDisplayPrice } = useNodePricing()
1787+
const node = createMockNode('ByteDanceSeedreamNode', [])
1788+
1789+
const price = getNodeDisplayPrice(node)
1790+
expect(price).toBe('$0.03/Run ($0.03 for one output image)')
1791+
})
1792+
1793+
it('should return $0.03/Run when sequential generation is disabled', () => {
1794+
const { getNodeDisplayPrice } = useNodePricing()
1795+
const node = createMockNode('ByteDanceSeedreamNode', [
1796+
{ name: 'sequential_image_generation', value: 'disabled' },
1797+
{ name: 'max_images', value: 5 }
1798+
])
1799+
1800+
const price = getNodeDisplayPrice(node)
1801+
expect(price).toBe('$0.03/Run')
1802+
})
1803+
1804+
it('should multiply by max_images when sequential generation is enabled', () => {
1805+
const { getNodeDisplayPrice } = useNodePricing()
1806+
const node = createMockNode('ByteDanceSeedreamNode', [
1807+
{ name: 'sequential_image_generation', value: 'enabled' },
1808+
{ name: 'max_images', value: 4 }
1809+
])
1810+
1811+
const price = getNodeDisplayPrice(node)
1812+
expect(price).toBe('$0.12/Run ($0.03 for one output image)')
1813+
})
1814+
})
1815+
17841816
describe('dynamic pricing - ByteDance Seedance video nodes', () => {
17851817
it('should return base 10s range for PRO 1080p on ByteDanceTextToVideoNode', () => {
17861818
const { getNodeDisplayPrice } = useNodePricing()

0 commit comments

Comments
 (0)