fix(llms): skip reasoning_effort patch for *-chat-latest models

normalizeModelName reduces gpt-5.2-chat-latest to gpt-52-chat-latest,
which matches the gpt-52 prefix and gets reasoning_effort='none'.
But chat-latest models don't support reasoning_effort, causing
HTTP 400.

Fix: check for 'chat-latest' before applying reasoning_effort patches.

Fixes #563
This commit is contained in:
artboy
2026-06-23 14:26:45 +08:00
parent fb4b8fd067
commit 57f64347ac
+4 -1
View File
@@ -79,7 +79,10 @@ export function modelPatch(body: Record<string, any>) {
debug('Applying GPT patch: set verbosity to low') debug('Applying GPT patch: set verbosity to low')
body.verbosity = 'low' body.verbosity = 'low'
if (modelName.startsWith('gpt-52')) { // *-chat-latest models don't support reasoning_effort — skip patches that set it
if (modelName.includes('chat-latest')) {
debug('Skipping reasoning_effort patch for chat-latest model')
} else if (modelName.startsWith('gpt-52')) {
debug('Applying GPT-52 patch: disable reasoning') debug('Applying GPT-52 patch: disable reasoning')
body.reasoning_effort = 'none' body.reasoning_effort = 'none'
} else if (modelName.startsWith('gpt-51')) { } else if (modelName.startsWith('gpt-51')) {