diff --git a/internal/providers/openai_request.go b/internal/providers/openai_request.go index 55a3eab0..82c11383 100644 --- a/internal/providers/openai_request.go +++ b/internal/providers/openai_request.go @@ -265,8 +265,14 @@ func (p *OpenAIProvider) buildRequestBody(model string, req ChatRequest, stream // Certain model families don't support custom temperature (locked to default). // This is a model-level constraint, not provider-specific — applies to both OpenAI and Azure. // Note: gpt-5.X flagship models (gpt-5.1, gpt-5.4, gpt-5.5) DO support temperature; - // only the mini/nano reasoning variants reject it. - skipTemp := strings.HasPrefix(capabilityModel, "gpt-5-mini") || strings.HasPrefix(capabilityModel, "gpt-5-nano") || strings.HasPrefix(capabilityModel, "o1") || strings.HasPrefix(capabilityModel, "o3") || strings.HasPrefix(capabilityModel, "o4") + // the locked ones are the base gpt-5, gpt-5-chat, and the mini/nano reasoning variants. + skipTemp := capabilityModel == "gpt-5" || + strings.HasPrefix(capabilityModel, "gpt-5-chat") || + strings.HasPrefix(capabilityModel, "gpt-5-mini") || + strings.HasPrefix(capabilityModel, "gpt-5-nano") || + strings.HasPrefix(capabilityModel, "o1") || + strings.HasPrefix(capabilityModel, "o3") || + strings.HasPrefix(capabilityModel, "o4") // Kimi Coding rejects any temperature override — `invalid temperature: only // 1 is allowed for this model`. Skip sending so the upstream applies its // own default (1). Matches the model-locked behavior of o1/o3/o4. diff --git a/internal/providers/openai_test.go b/internal/providers/openai_test.go index c915c01e..ec7bf3be 100644 --- a/internal/providers/openai_test.go +++ b/internal/providers/openai_test.go @@ -59,6 +59,9 @@ func TestBuildRequestBody_TemperatureSkippedForReasoningModels(t *testing.T) { // These model families don't support custom temperature (locked to default). // This is a model-level constraint, not provider-specific. models := []string{ + "gpt-5", + "gpt-5-chat", + "gpt-5-chat-latest", "gpt-5-mini", "gpt-5-mini-2025-01", "gpt-5-nano", @@ -68,6 +71,8 @@ func TestBuildRequestBody_TemperatureSkippedForReasoningModels(t *testing.T) { "o3", "o3-mini", "o4-mini", + "openai/gpt-5", + "openai/gpt-5-chat-latest", "openai/gpt-5-mini", "openai/o3-mini", } @@ -96,7 +101,6 @@ func TestBuildRequestBody_TemperatureKeptForNonReasoningModels(t *testing.T) { "gpt-4", "gpt-4o", "gpt-4-turbo", - "gpt-5", "gpt-5.1", "gpt-5.4", "openai/gpt-5.4",