@@ -11,6 +11,7 @@ import {
1111 internationalZAiModels ,
1212 mainlandZAiModels ,
1313 ZAI_DEFAULT_TEMPERATURE ,
14+ getZAiModels ,
1415} from "@roo-code/types"
1516
1617import { ZAiHandler } from "../zai"
@@ -141,6 +142,30 @@ describe("ZAiHandler", () => {
141142 expect ( model . info . cacheReadsPrice ) . toBe ( 0.26 )
142143 } )
143144
145+ it ( "should expose GLM-5.3 for the international Coding Plan with provisional GLM-5.2 pricing" , ( ) => {
146+ const handlerWithModel = new ZAiHandler ( {
147+ apiModelId : "glm-5.3" ,
148+ zaiApiKey : "test-zai-api-key" ,
149+ zaiApiLine : "international_coding" ,
150+ } )
151+ const model = handlerWithModel . getModel ( )
152+ expect ( model . id ) . toBe ( "glm-5.3" )
153+ expect ( model . info ) . toMatchObject ( {
154+ contextWindow : 1_000_000 ,
155+ maxTokens : 131_072 ,
156+ supportsImages : false ,
157+ supportsPromptCache : true ,
158+ supportsMaxTokens : true ,
159+ supportsReasoningEffort : [ "low" , "high" , "max" ] ,
160+ requiredReasoningEffort : true ,
161+ reasoningEffort : "max" ,
162+ preserveReasoning : true ,
163+ } )
164+ expect ( model . info . inputPrice ) . toBe ( 1.4 )
165+ expect ( model . info . outputPrice ) . toBe ( 4.4 )
166+ expect ( model . info . cacheReadsPrice ) . toBe ( 0.26 )
167+ } )
168+
144169 it ( "should return GLM-5-Turbo international model with thinking support" , ( ) => {
145170 const testModelId : InternationalZAiModelId = "glm-5-turbo"
146171 const handlerWithModel = new ZAiHandler ( {
@@ -277,6 +302,22 @@ describe("ZAiHandler", () => {
277302 expect ( model . info . cacheReadsPrice ) . toBe ( 0.13 )
278303 } )
279304
305+ it ( "should expose GLM-5.3 for the China Coding Plan" , ( ) => {
306+ const handlerWithModel = new ZAiHandler ( {
307+ apiModelId : "glm-5.3" ,
308+ zaiApiKey : "test-zai-api-key" ,
309+ zaiApiLine : "china_coding" ,
310+ } )
311+ const model = handlerWithModel . getModel ( )
312+ expect ( model . id ) . toBe ( "glm-5.3" )
313+ expect ( model . info . supportsReasoningEffort ) . toEqual ( [ "low" , "high" , "max" ] )
314+ expect ( model . info . requiredReasoningEffort ) . toBe ( true )
315+ expect ( model . info . reasoningEffort ) . toBe ( "max" )
316+ expect ( model . info . inputPrice ) . toBe ( 0.68 )
317+ expect ( model . info . outputPrice ) . toBe ( 2.28 )
318+ expect ( model . info . cacheReadsPrice ) . toBe ( 0.13 )
319+ } )
320+
280321 it ( "should return GLM-4.7 China model with thinking support" , ( ) => {
281322 const testModelId : MainlandZAiModelId = "glm-4.7"
282323 const handlerWithModel = new ZAiHandler ( {
@@ -348,6 +389,16 @@ describe("ZAiHandler", () => {
348389 expect ( model . id ) . toBe ( testModelId )
349390 expect ( model . info ) . toEqual ( internationalZAiModels [ testModelId ] )
350391 } )
392+
393+ it ( "should not expose Coding Plan-only models" , ( ) => {
394+ expect ( getZAiModels ( "international_api" ) ) . not . toHaveProperty ( "glm-5.3" )
395+ const handlerWithModel = new ZAiHandler ( {
396+ apiModelId : "glm-5.3" ,
397+ zaiApiKey : "test-zai-api-key" ,
398+ zaiApiLine : "international_api" ,
399+ } )
400+ expect ( handlerWithModel . getModel ( ) . id ) . toBe ( internationalZAiDefaultModelId )
401+ } )
351402 } )
352403
353404 describe ( "China API" , ( ) => {
@@ -387,6 +438,10 @@ describe("ZAiHandler", () => {
387438 expect ( model . id ) . toBe ( testModelId )
388439 expect ( model . info ) . toEqual ( mainlandZAiModels [ testModelId ] )
389440 } )
441+
442+ it ( "should not expose Coding Plan-only models" , ( ) => {
443+ expect ( getZAiModels ( "china_api" ) ) . not . toHaveProperty ( "glm-5.3" )
444+ } )
390445 } )
391446
392447 describe ( "Default behavior" , ( ) => {
@@ -613,6 +668,50 @@ describe("ZAiHandler", () => {
613668 )
614669 } )
615670
671+ it ( "should keep GLM-5.3 reasoning enabled when a persisted setting requests disable" , async ( ) => {
672+ const handlerWithModel = new ZAiHandler ( {
673+ apiModelId : "glm-5.3" ,
674+ zaiApiKey : "test-zai-api-key" ,
675+ zaiApiLine : "international_coding" ,
676+ reasoningEffort : "disable" ,
677+ } )
678+
679+ mockCreate . mockImplementationOnce ( ( ) => asyncStreamFrom ( [ ] ) )
680+
681+ const messageGenerator = handlerWithModel . createMessage ( "system prompt" , [ ] )
682+ await messageGenerator . next ( )
683+
684+ expect ( mockCreate ) . toHaveBeenCalledWith (
685+ expect . objectContaining ( {
686+ model : "glm-5.3" ,
687+ thinking : { type : "enabled" } ,
688+ reasoning_effort : "max" ,
689+ } ) ,
690+ )
691+ } )
692+
693+ it ( "should keep GLM-5.3 reasoning enabled when the master reasoning setting is disabled" , async ( ) => {
694+ const handlerWithModel = new ZAiHandler ( {
695+ apiModelId : "glm-5.3" ,
696+ zaiApiKey : "test-zai-api-key" ,
697+ zaiApiLine : "international_coding" ,
698+ enableReasoningEffort : false ,
699+ } )
700+
701+ mockCreate . mockImplementationOnce ( ( ) => asyncStreamFrom ( [ ] ) )
702+
703+ const messageGenerator = handlerWithModel . createMessage ( "system prompt" , [ ] )
704+ await messageGenerator . next ( )
705+
706+ expect ( mockCreate ) . toHaveBeenCalledWith (
707+ expect . objectContaining ( {
708+ model : "glm-5.3" ,
709+ thinking : { type : "enabled" } ,
710+ reasoning_effort : "max" ,
711+ } ) ,
712+ )
713+ } )
714+
616715 it ( "should omit reasoning_effort for GLM-5.2 when reasoningEffort is set to disable" , async ( ) => {
617716 const handlerWithModel = new ZAiHandler ( {
618717 apiModelId : "glm-5.2" ,
0 commit comments