Skip to content

[fix] Correct API node pricing discrepancies #4381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 8, 2025
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
35 changes: 19 additions & 16 deletions src/composables/node/useNodePricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =

const renderingSpeed = String(renderingSpeedWidget.value)
if (renderingSpeed.toLowerCase().includes('quality')) {
basePrice = 0.08
basePrice = 0.09
} else if (renderingSpeed.toLowerCase().includes('balanced')) {
basePrice = 0.06
} else if (renderingSpeed.toLowerCase().includes('turbo')) {
Expand Down Expand Up @@ -322,15 +322,15 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
const effectScene = String(effectSceneWidget.value)
if (
effectScene.includes('fuzzyfuzzy') ||
effectScene.includes('squish') ||
effectScene.includes('expansion')
effectScene.includes('squish')
) {
return '$0.28/Run'
} else if (
effectScene.includes('dizzydizzy') ||
effectScene.includes('bloombloom')
) {
} else if (effectScene.includes('dizzydizzy')) {
return '$0.49/Run'
} else if (effectScene.includes('bloombloom')) {
return '$0.49/Run'
} else if (effectScene.includes('expansion')) {
return '$0.28/Run'
}

return '$0.28/Run'
Expand Down Expand Up @@ -448,12 +448,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
} else if (model.includes('ray-2')) {
if (duration.includes('5s')) {
if (resolution.includes('4k')) return '$6.37/Run'
if (resolution.includes('1080p')) return '$2.30/Run'
if (resolution.includes('1080p')) return '$1.59/Run'
if (resolution.includes('720p')) return '$0.71/Run'
if (resolution.includes('540p')) return '$0.40/Run'
} else if (duration.includes('9s')) {
if (resolution.includes('4k')) return '$11.47/Run'
if (resolution.includes('1080p')) return '$4.14/Run'
if (resolution.includes('1080p')) return '$2.87/Run'
if (resolution.includes('720p')) return '$1.28/Run'
if (resolution.includes('540p')) return '$0.72/Run'
}
Expand Down Expand Up @@ -499,12 +499,12 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
} else if (model.includes('ray-2')) {
if (duration.includes('5s')) {
if (resolution.includes('4k')) return '$6.37/Run'
if (resolution.includes('1080p')) return '$2.30/Run'
if (resolution.includes('1080p')) return '$1.59/Run'
if (resolution.includes('720p')) return '$0.71/Run'
if (resolution.includes('540p')) return '$0.40/Run'
} else if (duration.includes('9s')) {
if (resolution.includes('4k')) return '$11.47/Run'
if (resolution.includes('1080p')) return '$4.14/Run'
if (resolution.includes('1080p')) return '$2.87/Run'
if (resolution.includes('720p')) return '$1.28/Run'
if (resolution.includes('540p')) return '$0.72/Run'
}
Expand Down Expand Up @@ -954,7 +954,8 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
(w) => w.name === 'length'
) as IComboWidget

if (!lengthWidget) return '$1.50-3.00/Run (varies with length)'
// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$1.50/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
Expand All @@ -972,7 +973,8 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
(w) => w.name === 'length'
) as IComboWidget

if (!lengthWidget) return '$1.50-3.00/Run (varies with length)'
// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$1.50/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
Expand All @@ -990,16 +992,17 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
(w) => w.name === 'length'
) as IComboWidget

if (!lengthWidget) return '$2.00-4.00/Run (varies with length)'
// If no length widget exists, default to 5s pricing
if (!lengthWidget) return '$2.25/Run'

const length = String(lengthWidget.value)
if (length === '5s') {
return '$2.00/Run'
return '$2.25/Run'
} else if (length === '10s') {
return '$4.00/Run'
}

return '$2.00/Run'
return '$2.25/Run'
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests-ui/tests/composables/node/useNodePricing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@ describe('useNodePricing', () => {
})

describe('dynamic pricing - IdeogramV3', () => {
it('should return $0.08 for Quality rendering speed', () => {
it('should return $0.09 for Quality rendering speed', () => {
const { getNodeDisplayPrice } = useNodePricing()
const node = createMockNode('IdeogramV3', [
{ name: 'rendering_speed', value: 'Quality' }
])

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

it('should return $0.06 for Balanced rendering speed', () => {
Expand Down Expand Up @@ -348,7 +348,7 @@ describe('useNodePricing', () => {
])

const price = getNodeDisplayPrice(node)
expect(price).toBe('$0.24/Run') // 0.08 * 3
expect(price).toBe('$0.27/Run') // 0.09 * 3
})

it('should multiply price by num_images for Turbo rendering speed', () => {
Expand Down
Loading