diff --git a/controller/channel-test.go b/controller/channel-test.go index 5ae04e8a013f..c51b55ed8fe2 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -113,6 +113,15 @@ func testChannel(channel *model.Channel, testModel string, endpointType string) if strings.HasSuffix(testModel, ratio_setting.CompactModelSuffix) { requestPath = "/v1/responses/compact" } + + // Codex channel only supports responses endpoints. + if channel.Type == constant.ChannelTypeCodex { + if strings.HasSuffix(testModel, ratio_setting.CompactModelSuffix) { + requestPath = "/v1/responses/compact" + } else { + requestPath = "/v1/responses" + } + } } if strings.HasPrefix(requestPath, "/v1/responses/compact") { testModel = ratio_setting.WithCompactModelSuffix(testModel) @@ -562,6 +571,14 @@ func buildTestRequest(model string, endpointType string, channel *model.Channel) } } + // Codex channel only supports responses endpoints. + if channel != nil && channel.Type == constant.ChannelTypeCodex { + return &dto.OpenAIResponsesRequest{ + Model: model, + Input: json.RawMessage(`[{"role":"user","content":"hi"}]`), + } + } + // Responses-only models (e.g. codex series) if strings.Contains(strings.ToLower(model), "codex") { return &dto.OpenAIResponsesRequest{ diff --git a/relay/channel/codex/adaptor.go b/relay/channel/codex/adaptor.go index d8a4e866b35a..d7318431df9e 100644 --- a/relay/channel/codex/adaptor.go +++ b/relay/channel/codex/adaptor.go @@ -96,6 +96,14 @@ func (a *Adaptor) ConvertOpenAIResponsesRequest(c *gin.Context, info *relaycommo request.Instructions = json.RawMessage(`""`) } + // Codex backend requires streaming; force stream when unset. + if !request.Stream { + request.Stream = true + if info != nil { + info.IsStream = true + } + } + if isCompact { return request, nil }