@@ -146,6 +146,7 @@ describe("AwsBedrockHandler", () => {
146146 [ "anthropic.claude-opus-4-8" , 128_000 ] ,
147147 [ "anthropic.claude-opus-5" , 128_000 ] ,
148148 [ "anthropic.claude-opus-5-5" , 128_000 ] ,
149+ [ "anthropic.claude-haiku-5-5" , 128_000 ] ,
149150 ] as const ) ( "exposes %s output ceiling without raising request defaults" , async ( apiModelId , ceiling ) => {
150151 for ( const enableReasoningEffort of [ true , false ] ) {
151152 for ( const modelMaxTokens of [ undefined , ceiling ] ) {
@@ -1047,6 +1048,72 @@ describe("AwsBedrockHandler", () => {
10471048 const model = handler . getModel ( )
10481049 expect ( model . id ) . toBe ( "global.anthropic.claude-opus-5-5" )
10491050 } )
1051+
1052+ it ( "should return Claude Haiku 5.5 model info" , ( ) => {
1053+ const handler = new AwsBedrockHandler ( {
1054+ apiModelId : "anthropic.claude-haiku-5-5" ,
1055+ awsAccessKey : "" ,
1056+ awsSecretKey : "" ,
1057+ awsRegion : "us-east-1" ,
1058+ } )
1059+
1060+ const model = handler . getModel ( )
1061+ expect ( model . id ) . toBe ( "anthropic.claude-haiku-5-5" )
1062+ expect ( model . info . maxTokens ) . toBe ( 128_000 )
1063+ expect ( model . info . contextWindow ) . toBe ( 1_000_000 )
1064+ expect ( model . info . inputPrice ) . toBe ( 0.1 )
1065+ expect ( model . info . outputPrice ) . toBe ( 0.5 )
1066+ expect ( model . info . cacheWritesPrice ) . toBe ( 0.125 )
1067+ expect ( model . info . cacheReadsPrice ) . toBe ( 0.01 )
1068+ expect ( model . info . minTokensPerCachePoint ) . toBe ( 512 )
1069+ expect ( model . info . maxCachePoints ) . toBe ( 4 )
1070+ expect ( model . info . supportsPromptCache ) . toBe ( true )
1071+ expect ( model . info . supportsReasoningBinary ) . toBe ( true )
1072+ expect ( model . info . supportsReasoningBudget ) . toBe ( true )
1073+ expect ( model . info . supportsTemperature ) . toBe ( false )
1074+ expect ( model . maxTokens ) . toBe ( 8192 )
1075+ } )
1076+
1077+ it . each ( [
1078+ {
1079+ label : "regional (us.)" ,
1080+ option : { awsUseCrossRegionInference : true } ,
1081+ expectedId : "us.anthropic.claude-haiku-5-5" ,
1082+ } ,
1083+ {
1084+ label : "global" ,
1085+ option : { awsUseGlobalInference : true } ,
1086+ expectedId : "global.anthropic.claude-haiku-5-5" ,
1087+ } ,
1088+ ] ) ( "should apply the $label inference profile prefix for Claude Haiku 5.5" , ( { option, expectedId } ) => {
1089+ // The user-verified invocation path: regional and global prefixes
1090+ // must keep the known catalog entry's prompt-cache capability.
1091+ const handler = new AwsBedrockHandler ( {
1092+ apiModelId : "anthropic.claude-haiku-5-5" ,
1093+ awsAccessKey : "" ,
1094+ awsSecretKey : "" ,
1095+ awsRegion : "us-east-1" ,
1096+ ...option ,
1097+ } )
1098+
1099+ const model = handler . getModel ( )
1100+ expect ( model . id ) . toBe ( expectedId )
1101+ expect ( model . info . supportsPromptCache ) . toBe ( true )
1102+ expect ( model . info . minTokensPerCachePoint ) . toBe ( 512 )
1103+ } )
1104+
1105+ it ( "should resolve a stored us.-prefixed Claude Haiku 5.5 id to catalog info" , ( ) => {
1106+ const handler = new AwsBedrockHandler ( {
1107+ apiModelId : "us.anthropic.claude-haiku-5-5" ,
1108+ awsAccessKey : "" ,
1109+ awsSecretKey : "" ,
1110+ awsRegion : "us-east-1" ,
1111+ } )
1112+
1113+ const model = handler . getModel ( )
1114+ expect ( model . info . supportsPromptCache ) . toBe ( true )
1115+ expect ( model . info . inputPrice ) . toBe ( 0.1 )
1116+ } )
10501117 } )
10511118
10521119 describe ( "1M context beta feature" , ( ) => {
@@ -1805,6 +1872,34 @@ describe("AwsBedrockHandler", () => {
18051872 expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
18061873 } )
18071874
1875+ it ( "should send adaptive thinking and omit temperature for Claude Haiku 5.5 when reasoning is enabled" , async ( ) => {
1876+ // Haiku 5.5 shares the Sonnet 5 / Opus 5 adaptive-thinking contract:
1877+ // budget_tokens causes a 400, so thinking.type must be "adaptive".
1878+ // effort and display are handler-internal defaults, not part of this
1879+ // scenario, so only the thinking type is pinned here.
1880+ const haiku55Handler = new AwsBedrockHandler ( {
1881+ apiModelId : "anthropic.claude-haiku-5-5" ,
1882+ awsAccessKey : "test-access-key" ,
1883+ awsSecretKey : "test-secret-key" ,
1884+ awsRegion : "us-east-1" ,
1885+ enableReasoningEffort : true ,
1886+ } )
1887+
1888+ const generator = haiku55Handler . createMessage ( "System prompt" , messages )
1889+ await generator . next ( )
1890+
1891+ expect ( mockConverseStreamCommand ) . toHaveBeenCalled ( )
1892+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ]
1893+
1894+ expect ( commandArg . additionalModelRequestFields ) . toEqual (
1895+ expect . objectContaining ( {
1896+ thinking : expect . objectContaining ( { type : "adaptive" } ) ,
1897+ } ) ,
1898+ )
1899+ // Haiku 5.5 rejects sampling parameters: temperature must be omitted.
1900+ expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
1901+ } )
1902+
18081903 it ( "should omit thinking and temperature for Claude Opus 4.8 when reasoning is disabled" , async ( ) => {
18091904 const provider = new AwsBedrockHandler ( {
18101905 apiModelId : "anthropic.claude-opus-4-8" ,
@@ -1817,23 +1912,26 @@ describe("AwsBedrockHandler", () => {
18171912 expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
18181913 } )
18191914
1820- it . each ( [ "anthropic.claude-sonnet-5" , "anthropic.claude-opus-5" , "us.anthropic.claude-opus-5" ] ) (
1821- "explicitly disables thinking for %s when reasoning is disabled" ,
1822- async ( apiModelId ) => {
1823- const provider = new AwsBedrockHandler ( {
1824- apiModelId,
1825- enableReasoningEffort : false ,
1826- modelMaxTokens : 32_000 ,
1827- } )
1828- await collectStream ( provider . createMessage ( "System prompt" , messages ) )
1915+ it . each ( [
1916+ "anthropic.claude-sonnet-5" ,
1917+ "anthropic.claude-opus-5" ,
1918+ "us.anthropic.claude-opus-5" ,
1919+ "anthropic.claude-haiku-5-5" ,
1920+ "us.anthropic.claude-haiku-5-5" ,
1921+ ] ) ( "explicitly disables thinking for %s when reasoning is disabled" , async ( apiModelId ) => {
1922+ const provider = new AwsBedrockHandler ( {
1923+ apiModelId,
1924+ enableReasoningEffort : false ,
1925+ modelMaxTokens : 32_000 ,
1926+ } )
1927+ await collectStream ( provider . createMessage ( "System prompt" , messages ) )
18291928
1830- const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ]
1831- expect ( commandArg . additionalModelRequestFields ) . toEqual (
1832- expect . objectContaining ( { thinking : { type : "disabled" } } ) ,
1833- )
1834- expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
1835- } ,
1836- )
1929+ const commandArg = mockConverseStreamCommand . mock . calls [ 0 ] [ 0 ]
1930+ expect ( commandArg . additionalModelRequestFields ) . toEqual (
1931+ expect . objectContaining ( { thinking : { type : "disabled" } } ) ,
1932+ )
1933+ expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
1934+ } )
18371935
18381936 it . each ( [
18391937 "anthropic.claude-fable-5" ,
@@ -1927,6 +2025,28 @@ describe("AwsBedrockHandler", () => {
19272025 expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
19282026 } )
19292027
2028+ it ( "completePrompt should omit temperature for Claude Haiku 5.5 (non-stream path)" , async ( ) => {
2029+ // Regression guard for the non-stream path: completePrompt must guard
2030+ // temperature the same way createMessage does, otherwise adaptive-thinking
2031+ // models like Haiku 5.5 return a 400 from Bedrock.
2032+ const mockConverseCommand = vi . mocked ( ConverseCommand )
2033+
2034+ const haiku55Handler = new AwsBedrockHandler ( {
2035+ apiModelId : "anthropic.claude-haiku-5-5" ,
2036+ awsAccessKey : "test-access-key" ,
2037+ awsSecretKey : "test-secret-key" ,
2038+ awsRegion : "us-east-1" ,
2039+ } )
2040+
2041+ await haiku55Handler . completePrompt ( "Test prompt" )
2042+
2043+ expect ( mockConverseCommand ) . toHaveBeenCalled ( )
2044+ const commandArg = mockConverseCommand . mock . calls [ 0 ] [ 0 ]
2045+
2046+ // Haiku 5.5 must NOT receive temperature in the non-stream inferenceConfig.
2047+ expect ( commandArg . inferenceConfig ?. temperature ) . toBeUndefined ( )
2048+ } )
2049+
19302050 it ( "completePrompt should still send temperature for older Claude Opus 4.6 (non-stream path)" , async ( ) => {
19312051 // 4.6 and earlier still accept sampling parameters, so completePrompt must
19322052 // continue to send temperature for them.
@@ -2135,6 +2255,7 @@ describe("AwsBedrockHandler", () => {
21352255 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-5" ) ) . toBe ( true )
21362256 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-5" ) ) . toBe ( true )
21372257 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-5-5" ) ) . toBe ( true )
2258+ expect ( isAdaptiveThinkingModel ( "anthropic.claude-haiku-5-5" ) ) . toBe ( true )
21382259 // Future-proof Sonnet patterns — guarded even before a registry entry exists.
21392260 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
21402261 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-8" ) ) . toBe ( true )
@@ -2146,6 +2267,7 @@ describe("AwsBedrockHandler", () => {
21462267 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-sonnet-5" ) ) . toBe ( true )
21472268 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-5" ) ) . toBe ( true )
21482269 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-5-5" ) ) . toBe ( true )
2270+ expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-haiku-5-5" ) ) . toBe ( true )
21492271 expect ( isAdaptiveThinkingModel ( "eu.anthropic.claude-sonnet-4-7" ) ) . toBe ( true )
21502272 expect ( isAdaptiveThinkingModel ( "global.anthropic.claude-opus-4-8" ) ) . toBe ( true )
21512273 } )
@@ -2155,6 +2277,7 @@ describe("AwsBedrockHandler", () => {
21552277 expect ( isAdaptiveThinkingModel ( "anthropic.claude-opus-4-5-20251101-v1:0" ) ) . toBe ( false )
21562278 expect ( isAdaptiveThinkingModel ( "anthropic.claude-sonnet-4-6" ) ) . toBe ( false )
21572279 expect ( isAdaptiveThinkingModel ( "anthropic.claude-3-5-sonnet-20241022-v2:0" ) ) . toBe ( false )
2280+ expect ( isAdaptiveThinkingModel ( "anthropic.claude-haiku-4-5-20251001-v1:0" ) ) . toBe ( false )
21582281 expect ( isAdaptiveThinkingModel ( "amazon.nova-lite-v1:0" ) ) . toBe ( false )
21592282 } )
21602283 } )
0 commit comments