diff --git a/packages/core/src/core/tokenLimits.test.ts b/packages/core/src/core/tokenLimits.test.ts index 97c664f..1e49fce 100644 --- a/packages/core/src/core/tokenLimits.test.ts +++ b/packages/core/src/core/tokenLimits.test.ts @@ -190,6 +190,22 @@ describe('tokenLimit', () => { }); }); + describe('MiniMax', () => { + it('should return the correct limit for MiniMax-M3', () => { + expect(tokenLimit('MiniMax-M3')).toBe(1_000_000); + expect(tokenLimit('minimax-m3')).toBe(1_000_000); + expect(tokenLimit('minimax-m3-20250101')).toBe(1_000_000); + }); + it('should return the correct limit for MiniMax-M2.7', () => { + expect(tokenLimit('MiniMax-M2.7')).toBe(204_800); + expect(tokenLimit('minimax-m2.7')).toBe(204_800); + }); + it('should not fall back to the default for MiniMax models', () => { + expect(tokenLimit('MiniMax-M3')).not.toBe(DEFAULT_TOKEN_LIMIT); + expect(tokenLimit('MiniMax-M2.7')).not.toBe(DEFAULT_TOKEN_LIMIT); + }); + }); + describe('Other models', () => { it('should return the correct limit for deepseek-r1', () => { expect(tokenLimit('deepseek-r1')).toBe(131072); diff --git a/packages/core/src/core/tokenLimits.ts b/packages/core/src/core/tokenLimits.ts index b19fc37..c61d877 100644 --- a/packages/core/src/core/tokenLimits.ts +++ b/packages/core/src/core/tokenLimits.ts @@ -26,6 +26,9 @@ const LIMITS = { '1m': 1_048_576, '2m': 2_097_152, '10m': 10_485_760, // 10 million tokens + // MiniMax vendor-declared exact context windows (decimal, not power-of-two) + 'minimax-m3': 1_000_000, // MiniMax-M3: 1,000,000 tokens (1M decimal) + 'minimax-m2.7': 204_800, // MiniMax-M2.7: 204,800 tokens // Output token limits (typically much smaller than input limits) '4k': 4_096, '8k': 8_192, @@ -141,6 +144,13 @@ const PATTERNS: Array<[RegExp, TokenCount]> = [ // Generic vision-model: same as qwen-vl-max (128K token context) [/^vision-model$/, LIMITS['128k']], + // ------------------- + // MiniMax + // ------------------- + // MiniMax-M3: 1,000,000-token context window (vendor-declared decimal). + [/^minimax-m2\.7.*$/, LIMITS['minimax-m2.7']], // more specific (dotted) first + [/^minimax-m3.*$/, LIMITS['minimax-m3']], + // ------------------- // ByteDance Seed-OSS (512K) // -------------------