From 3ca8c33264bff6f20e7ab71b90d5cd1d9caa6254 Mon Sep 17 00:00:00 2001 From: Md Yunus Date: Thu, 19 Mar 2026 19:32:39 +0530 Subject: [PATCH] Fix gpt-5-chat-latest model not supported error Exclude gpt-5-chat-latest variants from reasoning model detection to prevent sending unsupported reasoning.summary parameter. The gpt-5-chat-latest model variant does not support the reasoning.summary parameter, causing 400 Bad Request errors when the Responses API is used. Fixes: #2166 Signed-off-by: Md Yunus --- pkg/model/provider/openai/client.go | 4 ++++ pkg/model/provider/openai/thinking_budget_test.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/pkg/model/provider/openai/client.go b/pkg/model/provider/openai/client.go index 98ac96c9c..b3f54eafa 100644 --- a/pkg/model/provider/openai/client.go +++ b/pkg/model/provider/openai/client.go @@ -903,6 +903,10 @@ func isResponsesModel(model string) bool { func isOpenAIReasoningModel(model string) bool { m := strings.ToLower(model) + // Exclude -chat-latest variants which don't support reasoning parameters + if strings.Contains(m, "-chat-latest") { + return false + } return strings.HasPrefix(m, "o1") || strings.HasPrefix(m, "o3") || strings.HasPrefix(m, "o4") || diff --git a/pkg/model/provider/openai/thinking_budget_test.go b/pkg/model/provider/openai/thinking_budget_test.go index ed7d62fbd..028018bf1 100644 --- a/pkg/model/provider/openai/thinking_budget_test.go +++ b/pkg/model/provider/openai/thinking_budget_test.go @@ -40,6 +40,11 @@ func TestIsOpenAIReasoningModel(t *testing.T) { {"gpt-5-turbo", "gpt-5-turbo", true}, {"GPT-5 uppercase", "GPT-5", true}, + // GPT-5 -chat-latest variants - should NOT support reasoning + {"gpt-5-chat-latest", "gpt-5-chat-latest", false}, + {"gpt-5-chat-latest with suffix", "gpt-5-chat-latest-2025-10-01", false}, + {"GPT-5-CHAT-LATEST uppercase", "GPT-5-CHAT-LATEST", false}, + // GPT-4 series models - should NOT support reasoning {"gpt-4", "gpt-4", false}, {"gpt-4o", "gpt-4o", false},