Skip to content

Commit 441eab2

Browse files
committed
add pricing for new Kling 2.5 Turbo model
1 parent 706ff95 commit 441eab2

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/composables/node/useNodePricing.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
355355
const modelValue = String(modelWidget.value)
356356

357357
// Same pricing matrix as KlingTextToVideoNode
358-
if (
358+
if (modelValue.includes('v2-5-turbo')) {
359+
if (durationValue.includes('10')) {
360+
return '$0.7/Run'
361+
}
362+
return '$0.35/Run' // 5s default
363+
} else if (
359364
modelValue.includes('v2-1-master') ||
360365
modelValue.includes('v2-master')
361366
) {
@@ -505,7 +510,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
505510
const modeValue = String(modeWidget.value)
506511

507512
// Pricing matrix from CSV data based on mode string content
508-
if (modeValue.includes('v2-1-master')) {
513+
if (modeValue.includes('v2-5-turbo')) {
514+
if (modeValue.includes('10')) {
515+
return '$0.7/Run'
516+
}
517+
return '$0.35/Run' // 5s default
518+
} else if (modeValue.includes('v2-1-master')) {
509519
if (modeValue.includes('10s')) {
510520
return '$2.80/Run' // price is the same as for v2-master model
511521
}

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,26 @@ describe('useNodePricing', () => {
115115
expect(price).toBe('$1.40/Run')
116116
})
117117

118+
it('should return low price for kling-v2-turbo model', () => {
119+
const { getNodeDisplayPrice } = useNodePricing()
120+
const node = createMockNode('KlingTextToVideoNode', [
121+
{ name: 'mode', value: 'pro / 5s / v2-5-turbo' }
122+
])
123+
124+
const price = getNodeDisplayPrice(node)
125+
expect(price).toBe('$0.35/Run')
126+
})
127+
128+
it('should return high price for kling-v2-turbo model', () => {
129+
const { getNodeDisplayPrice } = useNodePricing()
130+
const node = createMockNode('KlingTextToVideoNode', [
131+
{ name: 'mode', value: 'pro / 10s / v2-5-turbo' }
132+
])
133+
134+
const price = getNodeDisplayPrice(node)
135+
expect(price).toBe('$0.7/Run')
136+
})
137+
118138
it('should return standard price for kling-v1-6 model', () => {
119139
const { getNodeDisplayPrice } = useNodePricing()
120140
const node = createMockNode('KlingTextToVideoNode', [
@@ -155,6 +175,18 @@ describe('useNodePricing', () => {
155175
expect(price).toBe('$1.40/Run')
156176
})
157177

178+
it('should return high price for kling-v2-5-turbo model', () => {
179+
const { getNodeDisplayPrice } = useNodePricing()
180+
const node = createMockNode('KlingImage2VideoNode', [
181+
{ name: 'model_name', value: 'v2-5-turbo' },
182+
{ name: 'mode', value: 'pro mode / 10s duration / kling-v2-5-turbo' },
183+
{ name: 'duration', value: '10' }
184+
])
185+
186+
const price = getNodeDisplayPrice(node)
187+
expect(price).toBe('$0.7/Run')
188+
})
189+
158190
it('should return standard price for kling-v1-6 model', () => {
159191
const { getNodeDisplayPrice } = useNodePricing()
160192
const node = createMockNode('KlingImage2VideoNode', [

0 commit comments

Comments
 (0)