@@ -26,9 +26,9 @@ import {combineAbortSignals} from '../utils/abort-signal.js';
2626
2727const SUPPORTED_MODELS = [
2828 'claude-opus-4.1-no-thinking' ,
29- 'claude-opus-4.1-with-thinking' ,
29+ 'claude-opus-4.1-with-thinking-16k ' ,
3030 'claude-sonnet-4.5-no-thinking' ,
31- 'claude-sonnet-4.5-with-thinking' ,
31+ 'claude-sonnet-4.5-with-thinking-16k ' ,
3232 'gemini-2.5-flash-lite' ,
3333 'gemini-2.5-flash' ,
3434 'gemini-2.5-pro' ,
@@ -44,6 +44,7 @@ const SUPPORTED_MODELS = [
4444// even if it involves many exponential backoff-waiting.
4545const DEFAULT_MAX_RETRIES = 100000 ;
4646
47+ const claude16kThinkingTokenBudget = 16_000 ;
4748export class AiSDKRunner implements LlmRunner {
4849 displayName = 'AI SDK' ;
4950 id = 'ai-sdk' ;
@@ -158,27 +159,33 @@ export class AiSDKRunner implements LlmRunner {
158159 const modelName = request . model as ( typeof SUPPORTED_MODELS ) [ number ] ;
159160 switch ( modelName ) {
160161 case 'claude-opus-4.1-no-thinking' :
161- case 'claude-opus-4.1-with-thinking' : {
162- const thinkingEnabled = request . model . endsWith ( ' with-thinking') ;
162+ case 'claude-opus-4.1-with-thinking-16k ' : {
163+ const thinkingEnabled = modelName . includes ( '- with-thinking') ;
163164 return {
164165 model : anthropic ( 'claude-opus-4-1' ) ,
165166 providerOptions : {
166167 anthropic : {
167168 sendReasoning : thinkingEnabled ,
168- thinking : { type : thinkingEnabled ? 'enabled' : 'disabled' } ,
169+ thinking : {
170+ type : thinkingEnabled ? 'enabled' : 'disabled' ,
171+ budgetTokens : thinkingEnabled ? claude16kThinkingTokenBudget : undefined ,
172+ } ,
169173 } satisfies AnthropicProviderOptions ,
170174 } ,
171175 } ;
172176 }
173177 case 'claude-sonnet-4.5-no-thinking' :
174- case 'claude-sonnet-4.5-with-thinking' : {
175- const thinkingEnabled = request . model . endsWith ( ' with-thinking') ;
178+ case 'claude-sonnet-4.5-with-thinking-16k ' : {
179+ const thinkingEnabled = modelName . includes ( '- with-thinking') ;
176180 return {
177181 model : anthropic ( 'claude-sonnet-4-5' ) ,
178182 providerOptions : {
179183 anthropic : {
180184 sendReasoning : thinkingEnabled ,
181- thinking : { type : thinkingEnabled ? 'enabled' : 'disabled' } ,
185+ thinking : {
186+ type : thinkingEnabled ? 'enabled' : 'disabled' ,
187+ budgetTokens : thinkingEnabled ? claude16kThinkingTokenBudget : undefined ,
188+ } ,
182189 } satisfies AnthropicProviderOptions ,
183190 } ,
184191 } ;
0 commit comments