@@ -343,6 +343,39 @@ describe("AnthropicHandler", () => {
343343 expect ( model . info . inputPrice ) . toBe ( 6.0 )
344344 expect ( model . info . outputPrice ) . toBe ( 22.5 )
345345 } )
346+
347+ it ( "should pass through custom/unknown model IDs instead of falling back to default" , ( ) => {
348+ const handler = new AnthropicHandler ( {
349+ apiKey : "test-api-key" ,
350+ apiModelId : "qwen/qwen3.6-plus" ,
351+ } )
352+ const model = handler . getModel ( )
353+ expect ( model . id ) . toBe ( "qwen/qwen3.6-plus" )
354+ // Should use default model info as fallback for unknown models
355+ expect ( model . info ) . toBeDefined ( )
356+ expect ( model . info . contextWindow ) . toBeDefined ( )
357+ } )
358+
359+ it ( "should use default model ID when no model ID is provided at all" , ( ) => {
360+ const handler = new AnthropicHandler ( {
361+ apiKey : "test-api-key" ,
362+ apiModelId : undefined ,
363+ } )
364+ const model = handler . getModel ( )
365+ expect ( model . id ) . toBeDefined ( )
366+ // Should fall back to anthropicDefaultModelId, not an empty string
367+ expect ( model . id ) . not . toBe ( "" )
368+ } )
369+
370+ it ( "should preserve custom model ID when using custom base URL" , ( ) => {
371+ const handler = new AnthropicHandler ( {
372+ apiKey : "test-api-key" ,
373+ anthropicBaseUrl : "http://localhost:3000/api" ,
374+ apiModelId : "my-custom-model" ,
375+ } )
376+ const model = handler . getModel ( )
377+ expect ( model . id ) . toBe ( "my-custom-model" )
378+ } )
346379 } )
347380
348381 describe ( "reasoning block filtering" , ( ) => {
0 commit comments