Skip to content

Commit 518c558

Browse files
authored
Fix rounding of max tokens (#6808)
1 parent 2122977 commit 518c558

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shared/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const getModelMaxOutputTokens = ({
9292

9393
// If model has explicit maxTokens, clamp it to 20% of the context window
9494
if (model.maxTokens) {
95-
return Math.min(model.maxTokens, model.contextWindow * 0.2)
95+
return Math.min(model.maxTokens, Math.ceil(model.contextWindow * 0.2))
9696
}
9797

9898
// For non-Anthropic formats without explicit maxTokens, return undefined

0 commit comments

Comments
 (0)