Skip to content

Commit 33bb389

Browse files
committed
feat(api-nodes): add pricing for seedream4.5
1 parent 3443c8f commit 33bb389

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/composables/node/useNodePricing.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,28 +1768,41 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
17681768
},
17691769
ByteDanceSeedreamNode: {
17701770
displayPrice: (node: LGraphNode): string => {
1771+
const modelWidget = node.widgets?.find(
1772+
(w) => w.name === 'model'
1773+
) as IComboWidget
17711774
const sequentialGenerationWidget = node.widgets?.find(
17721775
(w) => w.name === 'sequential_image_generation'
17731776
) as IComboWidget
17741777
const maxImagesWidget = node.widgets?.find(
17751778
(w) => w.name === 'max_images'
17761779
) as IComboWidget
17771780

1778-
if (!sequentialGenerationWidget || !maxImagesWidget)
1779-
return '$0.03/Run ($0.03 for one output image)'
1781+
const model = String(modelWidget?.value ?? '').toLowerCase()
1782+
let pricePerImage = 0.03 // default for seedream-4-0-250828 and fallback
1783+
if (model.includes('seedream-4-5-251128')) {
1784+
pricePerImage = 0.04
1785+
} else if (model.includes('seedream-4-0-250828')) {
1786+
pricePerImage = 0.03
1787+
}
17801788

1781-
if (
1782-
String(sequentialGenerationWidget.value).toLowerCase() === 'disabled'
1783-
) {
1784-
return '$0.03/Run'
1789+
if (!sequentialGenerationWidget || !maxImagesWidget) {
1790+
return `$${pricePerImage}/Run ($${pricePerImage} for one output image)`
17851791
}
17861792

1787-
const maxImages = Number(maxImagesWidget.value)
1793+
const seqMode = String(sequentialGenerationWidget.value).toLowerCase()
1794+
if (seqMode === 'disabled') {
1795+
return `$${pricePerImage}/Run`
1796+
}
1797+
1798+
const maxImagesRaw = Number(maxImagesWidget.value)
1799+
const maxImages =
1800+
Number.isFinite(maxImagesRaw) && maxImagesRaw > 0 ? maxImagesRaw : 1
17881801
if (maxImages === 1) {
1789-
return '$0.03/Run'
1802+
return `$${pricePerImage}/Run`
17901803
}
1791-
const cost = (0.03 * maxImages).toFixed(2)
1792-
return `$${cost}/Run ($0.03 for one output image)`
1804+
const totalCost = (pricePerImage * maxImages).toFixed(2)
1805+
return `$${totalCost}/Run ($${pricePerImage} for one output image)`
17931806
}
17941807
},
17951808
ByteDanceTextToVideoNode: {

0 commit comments

Comments
 (0)