@@ -141,3 +141,116 @@ test('MiniMax-M2.5 and M2.1 use explicit provider-specific context and output ca
141141 upperLimit : 131_072 ,
142142 } )
143143} )
144+
145+ test ( 'DashScope qwen3.6-plus uses provider-specific context and output caps' , ( ) => {
146+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
147+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
148+
149+ expect ( getContextWindowForModel ( 'qwen3.6-plus' ) ) . toBe ( 1_000_000 )
150+ expect ( getModelMaxOutputTokens ( 'qwen3.6-plus' ) ) . toEqual ( {
151+ default : 65_536 ,
152+ upperLimit : 65_536 ,
153+ } )
154+ expect ( getMaxOutputTokensForModel ( 'qwen3.6-plus' ) ) . toBe ( 65_536 )
155+ } )
156+
157+ test ( 'DashScope qwen3.5-plus uses provider-specific context and output caps' , ( ) => {
158+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
159+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
160+
161+ expect ( getContextWindowForModel ( 'qwen3.5-plus' ) ) . toBe ( 1_000_000 )
162+ expect ( getModelMaxOutputTokens ( 'qwen3.5-plus' ) ) . toEqual ( {
163+ default : 65_536 ,
164+ upperLimit : 65_536 ,
165+ } )
166+ expect ( getMaxOutputTokensForModel ( 'qwen3.5-plus' ) ) . toBe ( 65_536 )
167+ } )
168+
169+ test ( 'DashScope qwen3-coder-plus uses provider-specific context and output caps' , ( ) => {
170+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
171+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
172+
173+ expect ( getContextWindowForModel ( 'qwen3-coder-plus' ) ) . toBe ( 1_000_000 )
174+ expect ( getModelMaxOutputTokens ( 'qwen3-coder-plus' ) ) . toEqual ( {
175+ default : 65_536 ,
176+ upperLimit : 65_536 ,
177+ } )
178+ } )
179+
180+ test ( 'DashScope qwen3-coder-next uses provider-specific context and output caps' , ( ) => {
181+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
182+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
183+
184+ expect ( getContextWindowForModel ( 'qwen3-coder-next' ) ) . toBe ( 262_144 )
185+ expect ( getModelMaxOutputTokens ( 'qwen3-coder-next' ) ) . toEqual ( {
186+ default : 65_536 ,
187+ upperLimit : 65_536 ,
188+ } )
189+ } )
190+
191+ test ( 'DashScope qwen3-max uses provider-specific context and output caps' , ( ) => {
192+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
193+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
194+
195+ expect ( getContextWindowForModel ( 'qwen3-max' ) ) . toBe ( 262_144 )
196+ expect ( getModelMaxOutputTokens ( 'qwen3-max' ) ) . toEqual ( {
197+ default : 32_768 ,
198+ upperLimit : 32_768 ,
199+ } )
200+ } )
201+
202+ test ( 'DashScope qwen3-max dated variant resolves to base entry via prefix match' , ( ) => {
203+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
204+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
205+
206+ expect ( getContextWindowForModel ( 'qwen3-max-2026-01-23' ) ) . toBe ( 262_144 )
207+ expect ( getModelMaxOutputTokens ( 'qwen3-max-2026-01-23' ) ) . toEqual ( {
208+ default : 32_768 ,
209+ upperLimit : 32_768 ,
210+ } )
211+ } )
212+
213+ test ( 'DashScope kimi-k2.5 uses provider-specific context and output caps' , ( ) => {
214+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
215+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
216+
217+ expect ( getContextWindowForModel ( 'kimi-k2.5' ) ) . toBe ( 262_144 )
218+ expect ( getModelMaxOutputTokens ( 'kimi-k2.5' ) ) . toEqual ( {
219+ default : 32_768 ,
220+ upperLimit : 32_768 ,
221+ } )
222+ } )
223+
224+ test ( 'DashScope glm-5 uses provider-specific context and output caps' , ( ) => {
225+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
226+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
227+
228+ expect ( getContextWindowForModel ( 'glm-5' ) ) . toBe ( 202_752 )
229+ expect ( getModelMaxOutputTokens ( 'glm-5' ) ) . toEqual ( {
230+ default : 16_384 ,
231+ upperLimit : 16_384 ,
232+ } )
233+ } )
234+
235+ test ( 'DashScope glm-4.7 uses provider-specific context and output caps' , ( ) => {
236+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
237+ delete process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS
238+
239+ expect ( getContextWindowForModel ( 'glm-4.7' ) ) . toBe ( 202_752 )
240+ expect ( getModelMaxOutputTokens ( 'glm-4.7' ) ) . toEqual ( {
241+ default : 16_384 ,
242+ upperLimit : 16_384 ,
243+ } )
244+ } )
245+
246+ test ( 'DashScope models clamp oversized max output overrides to the provider limit' , ( ) => {
247+ process . env . CLAUDE_CODE_USE_OPENAI = '1'
248+ process . env . CLAUDE_CODE_MAX_OUTPUT_TOKENS = '100000'
249+
250+ expect ( getMaxOutputTokensForModel ( 'qwen3.6-plus' ) ) . toBe ( 65_536 )
251+ expect ( getMaxOutputTokensForModel ( 'qwen3.5-plus' ) ) . toBe ( 65_536 )
252+ expect ( getMaxOutputTokensForModel ( 'qwen3-coder-next' ) ) . toBe ( 65_536 )
253+ expect ( getMaxOutputTokensForModel ( 'qwen3-max' ) ) . toBe ( 32_768 )
254+ expect ( getMaxOutputTokensForModel ( 'kimi-k2.5' ) ) . toBe ( 32_768 )
255+ expect ( getMaxOutputTokensForModel ( 'glm-5' ) ) . toBe ( 16_384 )
256+ } )
0 commit comments