@@ -25,13 +25,13 @@ describe("getModelMaxOutputTokens", () => {
2525 expect ( result ) . toBe ( 16384 )
2626 } )
2727
28- test ( "should return model maxTokens when not using claude-code provider and maxTokens is within 20 % of context window" , ( ) => {
28+ test ( "should return model maxTokens when not using claude-code provider and maxTokens is within 80 % of context window" , ( ) => {
2929 const settings : ProviderSettings = {
3030 apiProvider : "anthropic" ,
3131 }
3232
3333 // mockModel has maxTokens: 8192 and contextWindow: 200000
34- // 8192 is 4.096% of 200000, which is <= 20 %, so it should use model.maxTokens
34+ // 8192 is 4.096% of 200000, which is <= 80 %, so it should use model.maxTokens
3535 const result = getModelMaxOutputTokens ( {
3636 modelId : "claude-3-5-sonnet-20241022" ,
3737 model : mockModel ,
@@ -117,7 +117,7 @@ describe("getModelMaxOutputTokens", () => {
117117 contextWindow : 1_048_576 ,
118118 supportsPromptCache : false ,
119119 supportsReasoningBudget : true ,
120- maxTokens : 65_535 , // 65_535 is ~6.25% of 1_048_576, which is <= 20 %
120+ maxTokens : 65_535 , // 65_535 is ~6.25% of 1_048_576, which is <= 80 %
121121 }
122122
123123 const settings : ProviderSettings = {
@@ -126,14 +126,14 @@ describe("getModelMaxOutputTokens", () => {
126126 }
127127
128128 const result = getModelMaxOutputTokens ( { modelId : geminiModelId , model, settings } )
129- expect ( result ) . toBe ( 65_535 ) // Should use model.maxTokens since it's within 20 % threshold
129+ expect ( result ) . toBe ( 65_535 ) // Should use model.maxTokens since it's within 80 % threshold
130130 } )
131131
132- test ( "should clamp maxTokens to 20 % of context window when maxTokens exceeds threshold" , ( ) => {
132+ test ( "should clamp maxTokens to 80 % of context window when maxTokens exceeds threshold" , ( ) => {
133133 const model : ModelInfo = {
134134 contextWindow : 100_000 ,
135135 supportsPromptCache : false ,
136- maxTokens : 50_000 , // 50 % of context window, exceeds 20 % threshold
136+ maxTokens : 90_000 , // 90 % of context window, exceeds 80 % threshold
137137 }
138138
139139 const settings : ProviderSettings = {
@@ -146,15 +146,15 @@ describe("getModelMaxOutputTokens", () => {
146146 settings,
147147 format : "openai" ,
148148 } )
149- // Should clamp to 20 % of context window: 100_000 * 0.2 = 20_000
150- expect ( result ) . toBe ( 20_000 )
149+ // Should clamp to 80 % of context window: 100_000 * 0.8 = 80_000
150+ expect ( result ) . toBe ( 80_000 )
151151 } )
152152
153- test ( "should clamp maxTokens to 20 % of context window for Anthropic models when maxTokens exceeds threshold" , ( ) => {
153+ test ( "should clamp maxTokens to 80 % of context window for Anthropic models when maxTokens exceeds threshold" , ( ) => {
154154 const model : ModelInfo = {
155155 contextWindow : 100_000 ,
156156 supportsPromptCache : true ,
157- maxTokens : 50_000 , // 50 % of context window, exceeds 20 % threshold
157+ maxTokens : 90_000 , // 90 % of context window, exceeds 80 % threshold
158158 }
159159
160160 const settings : ProviderSettings = {
@@ -166,15 +166,15 @@ describe("getModelMaxOutputTokens", () => {
166166 model,
167167 settings,
168168 } )
169- // Should clamp to 20 % of context window: 100_000 * 0.2 = 20_000
170- expect ( result ) . toBe ( 20_000 )
169+ // Should clamp to 80 % of context window: 100_000 * 0.8 = 80_000
170+ expect ( result ) . toBe ( 80_000 )
171171 } )
172172
173- test ( "should use model.maxTokens when exactly at 20 % threshold" , ( ) => {
173+ test ( "should use model.maxTokens when at or below 80 % threshold" , ( ) => {
174174 const model : ModelInfo = {
175175 contextWindow : 100_000 ,
176176 supportsPromptCache : false ,
177- maxTokens : 20_000 , // Exactly 20 % of context window
177+ maxTokens : 80_000 , // Exactly 80 % of context window
178178 }
179179
180180 const settings : ProviderSettings = {
@@ -187,7 +187,7 @@ describe("getModelMaxOutputTokens", () => {
187187 settings,
188188 format : "openai" ,
189189 } )
190- expect ( result ) . toBe ( 20_000 ) // Should use model.maxTokens since it's exactly at 20 %
190+ expect ( result ) . toBe ( 80_000 ) // Should use model.maxTokens since it's at 80 %
191191 } )
192192
193193 test ( "should return modelMaxTokens from settings when reasoning budget is required" , ( ) => {
0 commit comments