@@ -3213,6 +3213,7 @@ describe("ProviderTransform.reasoningVariants", () => {
32133213 { thinking : { type : "adaptive" , display : "summarized" } , effort : "high" } ,
32143214 "claude-opus-4-7" ,
32153215 ] ,
3216+ [ "@ai-sdk/anthropic" , { thinking : { type : "adaptive" , display : "summarized" } , effort : "high" } , "claude-opus-5" ] ,
32163217 [ "@ai-sdk/google" , { thinkingConfig : { includeThoughts : true , thinkingLevel : "high" } } ] ,
32173218 [ "@ai-sdk/google-vertex" , { thinkingConfig : { includeThoughts : true , thinkingLevel : "high" } } ] ,
32183219 [
@@ -3264,13 +3265,18 @@ describe("ProviderTransform.reasoningVariants", () => {
32643265 )
32653266 } )
32663267
3267- test ( "uses bare effort for Claude Opus 4.5" , ( ) => {
3268+ test ( "combines effort with extended thinking for Claude Opus 4.5" , ( ) => {
32683269 expect (
32693270 ProviderTransform . reasoningVariants (
32703271 model ( [ { type : "effort" , values : [ "high" ] } ] ) ,
32713272 target ( "@ai-sdk/anthropic" , "claude-opus-4-5" ) ,
32723273 ) ,
3273- ) . toEqual ( { high : { effort : "high" } } )
3274+ ) . toEqual ( {
3275+ high : {
3276+ thinking : { type : "enabled" , budgetTokens : 16_000 } ,
3277+ effort : "high" ,
3278+ } ,
3279+ } )
32743280 } )
32753281
32763282 test ( "uses explicit effort metadata for Anthropic-compatible models" , ( ) => {
@@ -3319,6 +3325,38 @@ describe("ProviderTransform.reasoningVariants", () => {
33193325 } )
33203326 } )
33213327
3328+ test ( "uses adaptive reasoning config for Claude Opus 5 on Bedrock" , ( ) => {
3329+ const result = ProviderTransform . reasoningVariants (
3330+ model ( [ { type : "effort" , values : [ "low" , "medium" , "high" , "xhigh" , "max" ] } ] ) ,
3331+ target ( "@ai-sdk/amazon-bedrock" , "us.anthropic.claude-opus-5" ) ,
3332+ )
3333+ expect ( Object . keys ( result ?? { } ) ) . toEqual ( [ "low" , "medium" , "high" , "xhigh" , "max" ] )
3334+ expect ( result ?. high ) . toEqual ( {
3335+ reasoningConfig : {
3336+ type : "adaptive" ,
3337+ maxReasoningEffort : "high" ,
3338+ display : "summarized" ,
3339+ } ,
3340+ } )
3341+ } )
3342+
3343+ test ( "combines effort with extended thinking for Claude Opus 4.5 on Bedrock" , ( ) => {
3344+ expect (
3345+ ProviderTransform . reasoningVariants (
3346+ model ( [ { type : "effort" , values : [ "high" ] } ] ) ,
3347+ target ( "@ai-sdk/amazon-bedrock" , "us.anthropic.claude-opus-4-5-20251101-v1:0" ) ,
3348+ ) ,
3349+ ) . toEqual ( {
3350+ high : {
3351+ reasoningConfig : {
3352+ type : "enabled" ,
3353+ budgetTokens : 16_000 ,
3354+ maxReasoningEffort : "high" ,
3355+ } ,
3356+ } ,
3357+ } )
3358+ } )
3359+
33223360 test ( "does not replace unsupported Anthropic Bedrock effort options with token budgets" , ( ) => {
33233361 expect (
33243362 ProviderTransform . reasoningVariants (
@@ -4617,11 +4655,17 @@ describe("ProviderTransform.variants", () => {
46174655
46184656 describe ( "@ai-sdk/anthropic" , ( ) => {
46194657 for ( const testCase of [
4658+ {
4659+ name : "opus 4 dated" ,
4660+ apiIds : [ "claude-opus-4-20250514" ] ,
4661+ efforts : [ "high" , "max" ] ,
4662+ expectedHigh : { thinking : { type : "enabled" , budgetTokens : 16000 } } ,
4663+ } ,
46204664 {
46214665 name : "opus 4.5" ,
46224666 apiIds : [ "claude-opus-4-5-20251101" , "claude-opus-4.5-20251101" ] ,
46234667 efforts : [ "low" , "medium" , "high" ] ,
4624- expectedHigh : { effort : "high" } ,
4668+ expectedHigh : { thinking : { type : "enabled" , budgetTokens : 16000 } , effort : "high" } ,
46254669 } ,
46264670 {
46274671 name : "sonnet 4.6" ,
@@ -4653,6 +4697,18 @@ describe("ProviderTransform.variants", () => {
46534697 efforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] ,
46544698 expectedHigh : { thinking : { type : "adaptive" , display : "summarized" } , effort : "high" } ,
46554699 } ,
4700+ {
4701+ name : "opus 5" ,
4702+ apiIds : [ "claude-opus-5" , "claude-opus-5-20260724" ] ,
4703+ efforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] ,
4704+ expectedHigh : { thinking : { type : "adaptive" , display : "summarized" } , effort : "high" } ,
4705+ } ,
4706+ {
4707+ name : "unversioned future model" ,
4708+ apiIds : [ "claude-future" ] ,
4709+ efforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] ,
4710+ expectedHigh : { thinking : { type : "adaptive" , display : "summarized" } , effort : "high" } ,
4711+ } ,
46564712 {
46574713 name : "fable 5" ,
46584714 apiIds : [ "claude-fable-5" ] ,
@@ -4772,6 +4828,28 @@ describe("ProviderTransform.variants", () => {
47724828 effort : "high" ,
47734829 } )
47744830 } )
4831+
4832+ test ( "opus 5 uses adaptive reasoning for Vertex model IDs" , ( ) => {
4833+ const result = ProviderTransform . variants (
4834+ createMockModel ( {
4835+ id : "google-vertex-anthropic/claude-opus-5@default" ,
4836+ providerID : "google-vertex-anthropic" ,
4837+ api : {
4838+ id : "claude-opus-5@default" ,
4839+ url : "https://us-central1-aiplatform.googleapis.com" ,
4840+ npm : "@ai-sdk/google-vertex/anthropic" ,
4841+ } ,
4842+ } ) ,
4843+ )
4844+ expect ( Object . keys ( result ) ) . toEqual ( [ "low" , "medium" , "high" , "xhigh" , "max" ] )
4845+ expect ( result . high ) . toEqual ( {
4846+ thinking : {
4847+ type : "adaptive" ,
4848+ display : "summarized" ,
4849+ } ,
4850+ effort : "high" ,
4851+ } )
4852+ } )
47754853 } )
47764854
47774855 describe ( "@ai-sdk/amazon-bedrock" , ( ) => {
@@ -4867,6 +4945,28 @@ describe("ProviderTransform.variants", () => {
48674945 } )
48684946 } )
48694947
4948+ test ( "anthropic opus 5 returns adaptive reasoning options with xhigh" , ( ) => {
4949+ const result = ProviderTransform . variants (
4950+ createMockModel ( {
4951+ id : "bedrock/anthropic-claude-opus-5" ,
4952+ providerID : "bedrock" ,
4953+ api : {
4954+ id : "us.anthropic.claude-opus-5-v1:0" ,
4955+ url : "https://bedrock.amazonaws.com" ,
4956+ npm : "@ai-sdk/amazon-bedrock" ,
4957+ } ,
4958+ } ) ,
4959+ )
4960+ expect ( Object . keys ( result ) ) . toEqual ( [ "low" , "medium" , "high" , "xhigh" , "max" ] )
4961+ expect ( result . high ) . toEqual ( {
4962+ reasoningConfig : {
4963+ type : "adaptive" ,
4964+ maxReasoningEffort : "high" ,
4965+ display : "summarized" ,
4966+ } ,
4967+ } )
4968+ } )
4969+
48704970 test ( "returns WIDELY_SUPPORTED_EFFORTS with reasoningConfig" , ( ) => {
48714971 const model = createMockModel ( {
48724972 id : "bedrock/llama-4" ,
@@ -5055,6 +5155,12 @@ describe("ProviderTransform.variants", () => {
50555155 efforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] ,
50565156 thinking : { type : "adaptive" , display : "summarized" } ,
50575157 } ,
5158+ {
5159+ name : "opus 5" ,
5160+ apiIds : [ "anthropic--claude-opus-5" , "anthropic--claude-5-opus" ] ,
5161+ efforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] ,
5162+ thinking : { type : "adaptive" , display : "summarized" } ,
5163+ } ,
50585164 ] ) {
50595165 for ( const apiId of testCase . apiIds ) {
50605166 test ( `${ testCase . name } ${ apiId } returns adaptive thinking variants under modelParams` , ( ) => {
0 commit comments