feat: add Seedance 2.0 models

This commit is contained in:
saturn
2026-04-02 19:16:00 +08:00
parent 9703714b69
commit 71ef6ff818
21 changed files with 811 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ import {
calcLipSync,
calcText,
calcVideo,
calcVideoByTokens,
calcVoice,
calcVoiceDesign,
} from '@/lib/billing/cost'
@@ -87,6 +88,37 @@ describe('billing/cost', () => {
})).toThrow('Unsupported video capability pricing')
})
it('estimates Seedance 2.0 video pricing from official token formula', () => {
const cost = calcVideo('doubao-seedance-2-0-260128', '720p', 1, {
resolution: '720p',
duration: 5,
aspectRatio: '16:9',
containsVideoInput: false,
})
expect(cost).toBeCloseTo(4.968, 8)
})
it('applies Seedance 2.0 video-input token floor for quoted pricing', () => {
const cost = calcVideo('doubao-seedance-2-0-fast-260128', '720p', 1, {
resolution: '720p',
duration: 5,
aspectRatio: '16:9',
containsVideoInput: true,
inputVideoSeconds: 2,
})
expect(cost).toBeCloseTo(4.2768, 8)
})
it('settles Seedance 2.0 videos from exact usage tokens', () => {
const cost = calcVideoByTokens('doubao-seedance-2-0-260128', 120_000, {
containsVideoInput: false,
})
expect(cost).toBeCloseTo(5.52, 8)
})
it('supports minimax capability-aware video pricing', () => {
const hailuoNormal = calcVideo('minimax-hailuo-2.3', '768p', 1, {
generationMode: 'normal',