Skip to content

Commit cca12d8

Browse files
[backport cloud/1.32] feat(api-nodes-pricing): add Nano-Banana-2 prices (#6850)
Backport of #6781 to `cloud/1.32` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6850-backport-cloud-1-32-feat-api-nodes-pricing-add-Nano-Banana-2-prices-2b46d73d365081e08333c9e4534f2fbd) by [Unito](https://www.unito.io) Co-authored-by: Alexander Piskun <13381981+bigcat88@users.noreply.github.com>
1 parent ccccd0f commit cca12d8

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/composables/node/useNodePricing.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,26 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
15451545
}
15461546
},
15471547
GeminiImageNode: {
1548-
displayPrice: '$0.03 per 1K tokens'
1548+
displayPrice: '~$0.039/Image (1K)'
1549+
},
1550+
GeminiImage2Node: {
1551+
displayPrice: (node: LGraphNode): string => {
1552+
const resolutionWidget = node.widgets?.find(
1553+
(w) => w.name === 'resolution'
1554+
) as IComboWidget
1555+
1556+
if (!resolutionWidget) return 'Token-based'
1557+
1558+
const resolution = String(resolutionWidget.value)
1559+
if (resolution.includes('1K')) {
1560+
return '~$0.134/Image'
1561+
} else if (resolution.includes('2K')) {
1562+
return '~$0.134/Image'
1563+
} else if (resolution.includes('4K')) {
1564+
return '~$0.24/Image'
1565+
}
1566+
return 'Token-based'
1567+
}
15491568
},
15501569
// OpenAI nodes
15511570
OpenAIChatNode: {
@@ -1829,6 +1848,7 @@ export const useNodePricing = () => {
18291848
TripoTextureNode: ['texture_quality'],
18301849
// Google/Gemini nodes
18311850
GeminiNode: ['model'],
1851+
GeminiImage2Node: ['resolution'],
18321852
// OpenAI nodes
18331853
OpenAIChatNode: ['model'],
18341854
// ByteDance

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ describe('useNodePricing', () => {
17631763
const node = createMockNode('GeminiImageNode')
17641764

17651765
const price = getNodeDisplayPrice(node)
1766-
expect(price).toBe('$0.03 per 1K tokens')
1766+
expect(price).toBe('~$0.039/Image (1K)')
17671767
})
17681768
})
17691769

0 commit comments

Comments
 (0)