Skip to content

Commit 445619e

Browse files
tiegebentleyclaude
andcommitted
fix(core): cap GPT-4o maxTokens to 16384
GPT-4o models have a 16384 output token limit, not 32000. The generic fallback caused silent truncation on long generations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2eb2319 commit 445619e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/core/src/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ function buildPiModel(
300300
input: supportsImageInput(wire, effectiveModelId) ? ['text', 'image'] : ['text'],
301301
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
302302
contextWindow: 200000,
303-
maxTokens: 32000,
303+
maxTokens: /^gpt-4o/i.test(effectiveModelId) ? 16384 : 32000,
304304
};
305305
const compat = openAIChatCompatForBaseUrl(wire, canonicalBase);
306306
if (compat !== undefined) out.compat = compat;

0 commit comments

Comments
 (0)