Skip to content

Commit 362eeef

Browse files
bigcat88snomiao
authored andcommitted
add pricing for new ByteDance node (#5481)
1 parent 5df5cc5 commit 362eeef

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
@@ -1511,6 +1511,32 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
15111511
return 'Token-based'
15121512
}
15131513
},
1514+
ByteDanceSeedreamNode: {
1515+
displayPrice: (node: LGraphNode): string => {
1516+
const sequentialGenerationWidget = node.widgets?.find(
1517+
(w) => w.name === 'sequential_image_generation'
1518+
) as IComboWidget
1519+
const maxImagesWidget = node.widgets?.find(
1520+
(w) => w.name === 'max_images'
1521+
) as IComboWidget
1522+
1523+
if (!sequentialGenerationWidget || !maxImagesWidget)
1524+
return '$0.03/Run ($0.03 for one output image)'
1525+
1526+
if (
1527+
String(sequentialGenerationWidget.value).toLowerCase() === 'disabled'
1528+
) {
1529+
return '$0.03/Run'
1530+
}
1531+
1532+
const maxImages = Number(maxImagesWidget.value)
1533+
if (maxImages === 1) {
1534+
return '$0.03/Run'
1535+
}
1536+
const cost = (0.03 * maxImages).toFixed(2)
1537+
return `$${cost}/Run ($0.03 for one output image)`
1538+
}
1539+
},
15141540
ByteDanceTextToVideoNode: {
15151541
displayPrice: byteDanceVideoPricingCalculator
15161542
},
@@ -1613,6 +1639,11 @@ export const useNodePricing = () => {
16131639
// ByteDance
16141640
ByteDanceImageNode: ['model'],
16151641
ByteDanceImageEditNode: ['model'],
1642+
ByteDanceSeedreamNode: [
1643+
'model',
1644+
'sequential_image_generation',
1645+
'max_images'
1646+
],
16161647
ByteDanceTextToVideoNode: ['model', 'duration', 'resolution'],
16171648
ByteDanceImageToVideoNode: ['model', 'duration', 'resolution'],
16181649
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)