From c636d247376056e378be4c051f44e1d2c415ba5e Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 7 Aug 2025 10:03:10 -0400 Subject: [PATCH] Fix rounding of max tokens --- src/shared/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/api.ts b/src/shared/api.ts index 4cd2459f70..014b903453 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -92,7 +92,7 @@ export const getModelMaxOutputTokens = ({ // If model has explicit maxTokens, clamp it to 20% of the context window if (model.maxTokens) { - return Math.min(model.maxTokens, model.contextWindow * 0.2) + return Math.min(model.maxTokens, Math.ceil(model.contextWindow * 0.2)) } // For non-Anthropic formats without explicit maxTokens, return undefined