diff --git a/controller/channel-test.go b/controller/channel-test.go index bdd67d27a90d..2180fcfb1689 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -26,7 +26,6 @@ import ( "github.com/QuantumNous/new-api/relay/helper" "github.com/QuantumNous/new-api/service" "github.com/QuantumNous/new-api/setting/operation_setting" - "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/QuantumNous/new-api/types" "github.com/bytedance/gopkg/util/gopool" @@ -47,9 +46,6 @@ func normalizeChannelTestEndpoint(channel *model.Channel, modelName, endpointTyp if normalized != "" { return normalized } - if strings.HasSuffix(modelName, ratio_setting.CompactModelSuffix) { - return string(constant.EndpointTypeOpenAIResponseCompact) - } if channel != nil && channel.Type == constant.ChannelTypeCodex { return string(constant.EndpointTypeOpenAIResponse) } @@ -125,14 +121,6 @@ func testChannel(channel *model.Channel, testModel string, endpointType string, if strings.Contains(strings.ToLower(testModel), "codex") { requestPath = "/v1/responses" } - - // responses compaction models (must use /v1/responses/compact) - if strings.HasSuffix(testModel, ratio_setting.CompactModelSuffix) { - requestPath = "/v1/responses/compact" - } - } - if strings.HasPrefix(requestPath, "/v1/responses/compact") { - testModel = ratio_setting.WithCompactModelSuffix(testModel) } c.Request = &http.Request{ @@ -684,14 +672,6 @@ func buildTestRequest(model string, endpointType string, channel *model.Channel, } } - // Responses compaction models (must use /v1/responses/compact) - if strings.HasSuffix(model, ratio_setting.CompactModelSuffix) { - return &dto.OpenAIResponsesCompactionRequest{ - Model: model, - Input: testResponsesInput, - } - } - // Responses-only models (e.g. codex series) if strings.Contains(strings.ToLower(model), "codex") { return &dto.OpenAIResponsesRequest{ diff --git a/middleware/distributor.go b/middleware/distributor.go index d626941456c7..9c7523784270 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -335,10 +335,6 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) { modelRequest.Group = req.Group common.SetContextKey(c, constant.ContextKeyTokenGroup, modelRequest.Group) } - - if strings.HasPrefix(c.Request.URL.Path, "/v1/responses/compact") && modelRequest.Model != "" { - modelRequest.Model = ratio_setting.WithCompactModelSuffix(modelRequest.Model) - } return &modelRequest, shouldSelectChannel, nil } diff --git a/relay/channel/codex/constants.go b/relay/channel/codex/constants.go index 5233393eaeec..ba269fc99567 100644 --- a/relay/channel/codex/constants.go +++ b/relay/channel/codex/constants.go @@ -1,26 +1,10 @@ package codex -import ( - "github.com/QuantumNous/new-api/setting/ratio_setting" - "github.com/samber/lo" -) - -var baseModelList = []string{ +var ModelList = []string{ "gpt-5", "gpt-5-codex", "gpt-5-codex-mini", "gpt-5.1", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "gpt-5.2-codex", "gpt-5.3-codex", "gpt-5.3-codex-spark", "gpt-5.4", } -var ModelList = withCompactModelSuffix(baseModelList) - const ChannelName = "codex" - -func withCompactModelSuffix(models []string) []string { - out := make([]string, 0, len(models)*2) - out = append(out, models...) - out = append(out, lo.Map(models, func(model string, _ int) string { - return ratio_setting.WithCompactModelSuffix(model) - })...) - return lo.Uniq(out) -} diff --git a/relay/helper/model_mapped.go b/relay/helper/model_mapped.go index 5d6efa094865..f0374da93dc9 100644 --- a/relay/helper/model_mapped.go +++ b/relay/helper/model_mapped.go @@ -4,12 +4,10 @@ import ( "encoding/json" "errors" "fmt" - "strings" "github.com/QuantumNous/new-api/dto" "github.com/QuantumNous/new-api/relay/common" relayconstant "github.com/QuantumNous/new-api/relay/constant" - "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/gin-gonic/gin" ) @@ -21,9 +19,6 @@ func ModelMappedHelper(c *gin.Context, info *common.RelayInfo, request dto.Reque isResponsesCompact := info.RelayMode == relayconstant.RelayModeResponsesCompact originModelName := info.OriginModelName mappingModelName := originModelName - if isResponsesCompact && strings.HasSuffix(originModelName, ratio_setting.CompactModelSuffix) { - mappingModelName = strings.TrimSuffix(originModelName, ratio_setting.CompactModelSuffix) - } // map model name modelMapping := c.GetString("model_mapping") @@ -72,7 +67,6 @@ func ModelMappedHelper(c *gin.Context, info *common.RelayInfo, request dto.Reque finalUpstreamModelName = info.UpstreamModelName } info.UpstreamModelName = finalUpstreamModelName - info.OriginModelName = ratio_setting.WithCompactModelSuffix(finalUpstreamModelName) } if request != nil { request.SetModelName(info.UpstreamModelName) diff --git a/setting/ratio_setting/compact_suffix.go b/setting/ratio_setting/compact_suffix.go deleted file mode 100644 index 2d2fe3c34bb9..000000000000 --- a/setting/ratio_setting/compact_suffix.go +++ /dev/null @@ -1,13 +0,0 @@ -package ratio_setting - -import "strings" - -const CompactModelSuffix = "-openai-compact" -const CompactWildcardModelKey = "*" + CompactModelSuffix - -func WithCompactModelSuffix(modelName string) string { - if strings.HasSuffix(modelName, CompactModelSuffix) { - return modelName - } - return modelName + CompactModelSuffix -} diff --git a/setting/ratio_setting/model_ratio.go b/setting/ratio_setting/model_ratio.go index 62fc8b3e10db..44c001525129 100644 --- a/setting/ratio_setting/model_ratio.go +++ b/setting/ratio_setting/model_ratio.go @@ -360,18 +360,6 @@ func UpdateModelPriceByJSONString(jsonStr string) error { // GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false func GetModelPrice(name string, printErr bool) (float64, bool) { name = FormatMatchingModelName(name) - - if strings.HasSuffix(name, CompactModelSuffix) { - price, ok := modelPriceMap.Get(CompactWildcardModelKey) - if !ok { - if printErr { - common.SysError("model price not found: " + name) - } - return -1, false - } - return price, true - } - price, ok := modelPriceMap.Get(name) if !ok { if printErr { @@ -399,12 +387,6 @@ func GetModelRatio(name string) (float64, bool, string) { ratio, ok := modelRatioMap.Get(name) if !ok { - if strings.HasSuffix(name, CompactModelSuffix) { - if wildcardRatio, ok := modelRatioMap.Get(CompactWildcardModelKey); ok { - return wildcardRatio, true, name - } - //return 0, true, name - } return 37.5, operation_setting.SelfUseModeEnabled, name } return ratio, true, name