@@ -206,12 +206,12 @@ suite("Z.ai GLM provider", function () {
206206
207207 assert . ok ( completionMessage , "Task should complete with the expected Z.ai GLM response" )
208208
209- // Verify max_tokens is the model's documented limit (131_072), not the 20%-of- context
210- // heuristic cap (40_000) that guards against inaccurate OpenRouter dynamic metadata .
209+ // Verify max_tokens uses the restored default clamp ( 20% of context window)
210+ // unless the user explicitly overrides it via modelMaxTokens .
211211 assert . strictEqual (
212212 requestCapture . maxTokens ,
213- 131_072 ,
214- `max_tokens should be the documented glm-5.1 limit (131_072 ) but was ${ requestCapture . maxTokens } ` ,
213+ 40_000 ,
214+ `max_tokens should default to the glm-5.1 clamp (40_000 ) but was ${ requestCapture . maxTokens } ` ,
215215 )
216216 } )
217217
@@ -245,12 +245,12 @@ suite("Z.ai GLM provider", function () {
245245
246246 assert . ok ( completionMessage , "Task should complete with the expected Z.ai GLM-5-Turbo response" )
247247
248- // Verify max_tokens is the model's documented limit (131_072), not the 20%-of- context
249- // heuristic cap (40_000) that guards against inaccurate OpenRouter dynamic metadata .
248+ // Verify max_tokens uses the restored default clamp ( 20% of context window)
249+ // unless the user explicitly overrides it via modelMaxTokens .
250250 assert . strictEqual (
251251 requestCapture . maxTokens ,
252- 131_072 ,
253- `max_tokens should be the documented glm-5-turbo limit (131_072 ) but was ${ requestCapture . maxTokens } ` ,
252+ 40_551 ,
253+ `max_tokens should default to the glm-5-turbo clamp (40_551 ) but was ${ requestCapture . maxTokens } ` ,
254254 )
255255 } )
256256} )
0 commit comments