Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/composables/node/useNodePricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const modelValue = String(modelWidget.value)

// Same pricing matrix as KlingTextToVideoNode
if (
if (modelValue.includes('v2-5-turbo')) {
if (durationValue.includes('10')) {
return '$0.70/Run'
}
return '$0.35/Run' // 5s default
} else if (
modelValue.includes('v2-1-master') ||
modelValue.includes('v2-master')
) {
Expand Down Expand Up @@ -505,7 +510,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const modeValue = String(modeWidget.value)

// Pricing matrix from CSV data based on mode string content
if (modeValue.includes('v2-1-master')) {
if (modeValue.includes('v2-5-turbo')) {
if (modeValue.includes('10')) {
return '$0.70/Run'
}
return '$0.35/Run' // 5s default
} else if (modeValue.includes('v2-1-master')) {
if (modeValue.includes('10s')) {
return '$2.80/Run' // price is the same as for v2-master model
}
Expand Down
32 changes: 32 additions & 0 deletions tests-ui/tests/composables/node/useNodePricing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ describe('useNodePricing', () => {
expect(price).toBe('$1.40/Run')
})

it('should return low price for kling-v2-turbo model', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('KlingTextToVideoNode', [
{ name: 'mode', value: 'pro / 5s / v2-5-turbo' }
])

const price = getNodeDisplayPrice(node)
expect(price).toBe('$0.35/Run')
})

it('should return high price for kling-v2-turbo model', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('KlingTextToVideoNode', [
{ name: 'mode', value: 'pro / 10s / v2-5-turbo' }
])

const price = getNodeDisplayPrice(node)
expect(price).toBe('$0.70/Run')
})

it('should return standard price for kling-v1-6 model', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('KlingTextToVideoNode', [
Expand Down Expand Up @@ -155,6 +175,18 @@ describe('useNodePricing', () => {
expect(price).toBe('$1.40/Run')
})

it('should return high price for kling-v2-5-turbo model', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('KlingImage2VideoNode', [
{ name: 'model_name', value: 'v2-5-turbo' },
{ name: 'mode', value: 'pro mode / 10s duration / kling-v2-5-turbo' },
{ name: 'duration', value: '10' }
])

const price = getNodeDisplayPrice(node)
expect(price).toBe('$0.70/Run')
})

it('should return standard price for kling-v1-6 model', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('KlingImage2VideoNode', [
Expand Down