@@ -2895,6 +2895,102 @@ describe("ProviderTransform.variants", () => {
28952895 expect ( result ) . toEqual ( { } )
28962896 } )
28972897
2898+ test ( "glm-5.2 returns native effort variants for openai-compatible providers" , ( ) => {
2899+ const model = createMockModel ( {
2900+ id : "zhipuai/glm-5.2" ,
2901+ providerID : "zhipuai" ,
2902+ api : {
2903+ id : "glm-5.2" ,
2904+ url : "https://open.bigmodel.cn/api/paas/v4" ,
2905+ npm : "@ai-sdk/openai-compatible" ,
2906+ } ,
2907+ } )
2908+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2909+ high : { reasoningEffort : "high" } ,
2910+ max : { reasoningEffort : "max" } ,
2911+ } )
2912+ } )
2913+
2914+ test ( "recognizes GLM-5.2 provider model IDs" , ( ) => {
2915+ for ( const id of [ "accounts/fireworks/models/glm-5p2" , "zai-org-glm-5-2" , "umans-glm-5.2" ] ) {
2916+ const model = createMockModel ( {
2917+ id : `test/${ id } ` ,
2918+ api : {
2919+ id,
2920+ url : "https://api.test.com" ,
2921+ npm : "@ai-sdk/openai-compatible" ,
2922+ } ,
2923+ } )
2924+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2925+ high : { reasoningEffort : "high" } ,
2926+ max : { reasoningEffort : "max" } ,
2927+ } )
2928+ }
2929+ } )
2930+
2931+ test ( "recognizes GLM-5.2 from the API ID when the configured model ID is an alias" , ( ) => {
2932+ const model = createMockModel ( {
2933+ id : "custom/my-glm" ,
2934+ api : {
2935+ id : "accounts/fireworks/models/glm-5p2" ,
2936+ url : "https://api.fireworks.ai/inference/v1" ,
2937+ npm : "@ai-sdk/openai-compatible" ,
2938+ } ,
2939+ } )
2940+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2941+ high : { reasoningEffort : "high" } ,
2942+ max : { reasoningEffort : "max" } ,
2943+ } )
2944+ } )
2945+
2946+ test ( "glm-5.2 returns openrouter effort variants for openrouter" , ( ) => {
2947+ const model = createMockModel ( {
2948+ id : "openrouter/z-ai/glm-5.2" ,
2949+ providerID : "openrouter" ,
2950+ api : {
2951+ id : "z-ai/glm-5.2" ,
2952+ url : "https://openrouter.ai/api/v1" ,
2953+ npm : "@openrouter/ai-sdk-provider" ,
2954+ } ,
2955+ } )
2956+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2957+ high : { reasoning : { effort : "high" } } ,
2958+ xhigh : { reasoning : { effort : "xhigh" } } ,
2959+ } )
2960+ } )
2961+
2962+ test ( "glm-5.2 returns effort variants for anthropic-compatible providers" , ( ) => {
2963+ const model = createMockModel ( {
2964+ id : "zai-coding-plan/glm-5.2" ,
2965+ providerID : "zai-coding-plan" ,
2966+ api : {
2967+ id : "glm-5.2" ,
2968+ url : "https://api.z.ai/api/anthropic" ,
2969+ npm : "@ai-sdk/anthropic" ,
2970+ } ,
2971+ } )
2972+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2973+ high : { effort : "high" } ,
2974+ max : { effort : "max" } ,
2975+ } )
2976+ } )
2977+
2978+ test ( "glm-5.2 falls back to provider defaults for other packages" , ( ) => {
2979+ const model = createMockModel ( {
2980+ id : "test/glm-5.2" ,
2981+ api : {
2982+ id : "glm-5.2" ,
2983+ url : "https://api.test.com" ,
2984+ npm : "@ai-sdk/amazon-bedrock" ,
2985+ } ,
2986+ } )
2987+ expect ( ProviderTransform . variants ( model ) ) . toEqual ( {
2988+ low : { reasoningConfig : { type : "enabled" , maxReasoningEffort : "low" } } ,
2989+ medium : { reasoningConfig : { type : "enabled" , maxReasoningEffort : "medium" } } ,
2990+ high : { reasoningConfig : { type : "enabled" , maxReasoningEffort : "high" } } ,
2991+ } )
2992+ } )
2993+
28982994 test ( "mistral models with reasoning support return variants" , ( ) => {
28992995 const model = createMockModel ( {
29002996 id : "mistral/mistral-small-latest" ,
0 commit comments