@@ -346,6 +346,37 @@ describe("zai provider plugin", () => {
346346 expect ( capturedPayload ?. thinking ) . toEqual ( { type : "disabled" } ) ;
347347 } ) ;
348348
349+ it ( "keeps minimal thinking enabled for binary GLM models" , async ( ) => {
350+ const provider = await registerSingleProviderPlugin ( plugin ) ;
351+ let capturedPayload : Record < string , unknown > | undefined ;
352+ const baseStreamFn : StreamFn = ( model , _context , options ) => {
353+ const payload : Record < string , unknown > = { } ;
354+ options ?. onPayload ?.( payload as never , model as never ) ;
355+ capturedPayload = payload ;
356+ return { } as ReturnType < StreamFn > ;
357+ } ;
358+
359+ const wrapped = provider . wrapStreamFn ?.( {
360+ provider : "zai" ,
361+ modelId : "glm-5.1" ,
362+ extraParams : { } ,
363+ thinkingLevel : "minimal" ,
364+ streamFn : baseStreamFn ,
365+ } as never ) ;
366+
367+ void wrapped ?.(
368+ {
369+ api : "openai-completions" ,
370+ provider : "zai" ,
371+ id : "glm-5.1" ,
372+ } as Model < "openai-completions" > ,
373+ { messages : [ ] } as Context ,
374+ { } ,
375+ ) ;
376+
377+ expect ( capturedPayload ) . not . toHaveProperty ( "thinking" ) ;
378+ } ) ;
379+
349380 it ( "maps GLM-5.2 thinking levels to Z.AI reasoning effort" , async ( ) => {
350381 const provider = await registerSingleProviderPlugin ( plugin ) ;
351382 const baseStreamFn : StreamFn = ( model , _context , options ) => {
0 commit comments