Skip to content

Commit a13c193

Browse files
authored
Merge pull request #120 from getagentseal/feat/add-minimax-pricing
feat: add MiniMax-M2.7 model pricing
2 parents 8ee84b0 + 81b5cda commit a13c193

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

src/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const FALLBACK_PRICING: Record<string, ModelCosts> = {
4949
'gpt-4.1-nano': { inputCostPerToken: 0.1e-6, outputCostPerToken: 0.4e-6, cacheWriteCostPerToken: 0.1e-6, cacheReadCostPerToken: 0.025e-6, webSearchCostPerRequest: WEB_SEARCH_COST, fastMultiplier: 1 },
5050
'o3': { inputCostPerToken: 10e-6, outputCostPerToken: 40e-6, cacheWriteCostPerToken: 10e-6, cacheReadCostPerToken: 2.5e-6, webSearchCostPerRequest: WEB_SEARCH_COST, fastMultiplier: 1 },
5151
'o4-mini': { inputCostPerToken: 1.1e-6, outputCostPerToken: 4.4e-6, cacheWriteCostPerToken: 1.1e-6, cacheReadCostPerToken: 0.275e-6, webSearchCostPerRequest: WEB_SEARCH_COST, fastMultiplier: 1 },
52+
'MiniMax-M2.7-highspeed': { inputCostPerToken: 0.6e-6, outputCostPerToken: 2.4e-6, cacheWriteCostPerToken: 0.375e-6, cacheReadCostPerToken: 0.06e-6, webSearchCostPerRequest: WEB_SEARCH_COST, fastMultiplier: 1 },
53+
'MiniMax-M2.7': { inputCostPerToken: 0.3e-6, outputCostPerToken: 1.2e-6, cacheWriteCostPerToken: 0.375e-6, cacheReadCostPerToken: 0.06e-6, webSearchCostPerRequest: WEB_SEARCH_COST, fastMultiplier: 1 },
5254
}
5355

5456
let pricingCache: Map<string, ModelCosts> | null = null
@@ -201,6 +203,8 @@ export function getShortModelName(model: string): string {
201203
'gemini-2.5-pro': 'Gemini 2.5 Pro',
202204
'o4-mini': 'o4-mini',
203205
'o3': 'o3',
206+
'MiniMax-M2.7-highspeed': 'MiniMax M2.7 Highspeed',
207+
'MiniMax-M2.7': 'MiniMax M2.7',
204208
}
205209
for (const [key, name] of Object.entries(shortNames)) {
206210
if (canonical.startsWith(key)) return name

tests/minimax.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { describe, it, expect } from 'vitest'
2+
3+
import { getModelCosts, getShortModelName } from '../src/models.js'
4+
5+
// Verifies MiniMax pricing loaded from FALLBACK_PRICING (no network call).
6+
// pricingCache stays null until loadPricing() runs, so getModelCosts falls
7+
// through to FALLBACK_PRICING which is what we want to validate here.
8+
9+
describe('MiniMax model pricing', () => {
10+
it('returns pricing for MiniMax-M2.7', () => {
11+
const costs = getModelCosts('MiniMax-M2.7')
12+
expect(costs).not.toBeNull()
13+
expect(costs!.inputCostPerToken).toBe(0.3e-6)
14+
expect(costs!.outputCostPerToken).toBe(1.2e-6)
15+
expect(costs!.cacheReadCostPerToken).toBe(0.06e-6)
16+
expect(costs!.cacheWriteCostPerToken).toBe(0.375e-6)
17+
expect(costs!.fastMultiplier).toBe(1)
18+
})
19+
20+
it('returns pricing for MiniMax-M2.7-highspeed', () => {
21+
const costs = getModelCosts('MiniMax-M2.7-highspeed')
22+
expect(costs).not.toBeNull()
23+
expect(costs!.inputCostPerToken).toBe(0.6e-6)
24+
expect(costs!.outputCostPerToken).toBe(2.4e-6)
25+
expect(costs!.cacheReadCostPerToken).toBe(0.06e-6)
26+
expect(costs!.cacheWriteCostPerToken).toBe(0.375e-6)
27+
expect(costs!.fastMultiplier).toBe(1)
28+
})
29+
30+
it('highspeed pricing is distinct from base model pricing', () => {
31+
const base = getModelCosts('MiniMax-M2.7')
32+
const fast = getModelCosts('MiniMax-M2.7-highspeed')
33+
expect(fast!.inputCostPerToken).toBeGreaterThan(base!.inputCostPerToken)
34+
expect(fast!.outputCostPerToken).toBeGreaterThan(base!.outputCostPerToken)
35+
})
36+
37+
it('returns short name for MiniMax-M2.7', () => {
38+
expect(getShortModelName('MiniMax-M2.7')).toBe('MiniMax M2.7')
39+
})
40+
41+
it('returns short name for MiniMax-M2.7-highspeed', () => {
42+
expect(getShortModelName('MiniMax-M2.7-highspeed')).toBe('MiniMax M2.7 Highspeed')
43+
})
44+
45+
it('handles MiniMax model ID with date suffix', () => {
46+
expect(getShortModelName('MiniMax-M2.7-20260101')).toBe('MiniMax M2.7')
47+
})
48+
})

0 commit comments

Comments
 (0)