@@ -34,17 +34,8 @@ export interface ModelCapabilities {
3434 toolUsageControl ?: boolean
3535 computerUse ?: boolean
3636 nativeStructuredOutputs ?: boolean
37- /**
38- * Max output tokens configuration for Anthropic SDK's streaming timeout workaround.
39- * The Anthropic SDK throws an error for non-streaming requests that may take >10 minutes.
40- * This only applies to direct Anthropic API calls, not Bedrock (which uses AWS SDK).
41- */
42- maxOutputTokens ?: {
43- /** Maximum supported output tokens (used for streaming requests) */
44- max : number
45- /** Conservative default when user doesn't specify maxTokens (controls cost/latency) */
46- default : number
47- }
37+ /** Maximum supported output tokens for this model */
38+ maxOutputTokens ?: number
4839 reasoningEffort ?: {
4940 values : string [ ]
5041 }
@@ -339,7 +330,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
339330 capabilities : {
340331 temperature : { min : 0 , max : 1 } ,
341332 nativeStructuredOutputs : true ,
342- maxOutputTokens : { max : 128000 , default : 8192 } ,
333+ maxOutputTokens : 128000 ,
343334 thinking : {
344335 levels : [ 'low' , 'medium' , 'high' , 'max' ] ,
345336 default : 'high' ,
@@ -358,7 +349,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
358349 capabilities : {
359350 temperature : { min : 0 , max : 1 } ,
360351 nativeStructuredOutputs : true ,
361- maxOutputTokens : { max : 64000 , default : 8192 } ,
352+ maxOutputTokens : 64000 ,
362353 thinking : {
363354 levels : [ 'low' , 'medium' , 'high' ] ,
364355 default : 'high' ,
@@ -377,7 +368,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
377368 capabilities : {
378369 temperature : { min : 0 , max : 1 } ,
379370 nativeStructuredOutputs : true ,
380- maxOutputTokens : { max : 64000 , default : 8192 } ,
371+ maxOutputTokens : 64000 ,
381372 thinking : {
382373 levels : [ 'low' , 'medium' , 'high' ] ,
383374 default : 'high' ,
@@ -395,7 +386,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
395386 } ,
396387 capabilities : {
397388 temperature : { min : 0 , max : 1 } ,
398- maxOutputTokens : { max : 64000 , default : 8192 } ,
389+ maxOutputTokens : 64000 ,
399390 thinking : {
400391 levels : [ 'low' , 'medium' , 'high' ] ,
401392 default : 'high' ,
@@ -414,7 +405,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
414405 capabilities : {
415406 temperature : { min : 0 , max : 1 } ,
416407 nativeStructuredOutputs : true ,
417- maxOutputTokens : { max : 64000 , default : 8192 } ,
408+ maxOutputTokens : 64000 ,
418409 thinking : {
419410 levels : [ 'low' , 'medium' , 'high' ] ,
420411 default : 'high' ,
@@ -432,7 +423,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
432423 } ,
433424 capabilities : {
434425 temperature : { min : 0 , max : 1 } ,
435- maxOutputTokens : { max : 64000 , default : 8192 } ,
426+ maxOutputTokens : 64000 ,
436427 thinking : {
437428 levels : [ 'low' , 'medium' , 'high' ] ,
438429 default : 'high' ,
@@ -451,7 +442,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
451442 capabilities : {
452443 temperature : { min : 0 , max : 1 } ,
453444 nativeStructuredOutputs : true ,
454- maxOutputTokens : { max : 64000 , default : 8192 } ,
445+ maxOutputTokens : 64000 ,
455446 thinking : {
456447 levels : [ 'low' , 'medium' , 'high' ] ,
457448 default : 'high' ,
@@ -469,7 +460,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
469460 } ,
470461 capabilities : {
471462 temperature : { min : 0 , max : 1 } ,
472- maxOutputTokens : { max : 4096 , default : 4096 } ,
463+ maxOutputTokens : 4096 ,
473464 } ,
474465 contextWindow : 200000 ,
475466 } ,
@@ -484,7 +475,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
484475 capabilities : {
485476 temperature : { min : 0 , max : 1 } ,
486477 computerUse : true ,
487- maxOutputTokens : { max : 64000 , default : 8192 } ,
478+ maxOutputTokens : 64000 ,
488479 thinking : {
489480 levels : [ 'low' , 'medium' , 'high' ] ,
490481 default : 'high' ,
@@ -743,7 +734,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
743734 capabilities : {
744735 temperature : { min : 0 , max : 1 } ,
745736 nativeStructuredOutputs : true ,
746- maxOutputTokens : { max : 128000 , default : 8192 } ,
737+ maxOutputTokens : 128000 ,
747738 thinking : {
748739 levels : [ 'low' , 'medium' , 'high' , 'max' ] ,
749740 default : 'high' ,
@@ -762,7 +753,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
762753 capabilities : {
763754 temperature : { min : 0 , max : 1 } ,
764755 nativeStructuredOutputs : true ,
765- maxOutputTokens : { max : 64000 , default : 8192 } ,
756+ maxOutputTokens : 64000 ,
766757 thinking : {
767758 levels : [ 'low' , 'medium' , 'high' ] ,
768759 default : 'high' ,
@@ -781,7 +772,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
781772 capabilities : {
782773 temperature : { min : 0 , max : 1 } ,
783774 nativeStructuredOutputs : true ,
784- maxOutputTokens : { max : 64000 , default : 8192 } ,
775+ maxOutputTokens : 64000 ,
785776 thinking : {
786777 levels : [ 'low' , 'medium' , 'high' ] ,
787778 default : 'high' ,
@@ -800,7 +791,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
800791 capabilities : {
801792 temperature : { min : 0 , max : 1 } ,
802793 nativeStructuredOutputs : true ,
803- maxOutputTokens : { max : 64000 , default : 8192 } ,
794+ maxOutputTokens : 64000 ,
804795 thinking : {
805796 levels : [ 'low' , 'medium' , 'high' ] ,
806797 default : 'high' ,
@@ -819,7 +810,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
819810 capabilities : {
820811 temperature : { min : 0 , max : 1 } ,
821812 nativeStructuredOutputs : true ,
822- maxOutputTokens : { max : 64000 , default : 8192 } ,
813+ maxOutputTokens : 64000 ,
823814 thinking : {
824815 levels : [ 'low' , 'medium' , 'high' ] ,
825816 default : 'high' ,
@@ -2490,26 +2481,19 @@ export function getThinkingLevelsForModel(modelId: string): string[] | null {
24902481}
24912482
24922483/**
2493- * Get the max output tokens for a specific model
2494- * Returns the model's max capacity for streaming requests,
2495- * or the model's safe default for non-streaming requests to avoid timeout issues.
2484+ * Get the max output tokens for a specific model.
24962485 *
24972486 * @param modelId - The model ID
2498- * @param streaming - Whether the request is streaming (default: false)
24992487 */
2500- export function getMaxOutputTokensForModel ( modelId : string , streaming = false ) : number {
2488+ export function getMaxOutputTokensForModel ( modelId : string ) : number {
25012489 const normalizedModelId = modelId . toLowerCase ( )
25022490 const STANDARD_MAX_OUTPUT_TOKENS = 4096
25032491
25042492 for ( const provider of Object . values ( PROVIDER_DEFINITIONS ) ) {
25052493 for ( const model of provider . models ) {
25062494 const baseModelId = model . id . toLowerCase ( )
25072495 if ( normalizedModelId === baseModelId || normalizedModelId . startsWith ( `${ baseModelId } -` ) ) {
2508- const outputTokens = model . capabilities . maxOutputTokens
2509- if ( outputTokens ) {
2510- return streaming ? outputTokens . max : outputTokens . default
2511- }
2512- return STANDARD_MAX_OUTPUT_TOKENS
2496+ return model . capabilities . maxOutputTokens || STANDARD_MAX_OUTPUT_TOKENS
25132497 }
25142498 }
25152499 }
0 commit comments