Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions controller/channel-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
}
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
4 changes: 0 additions & 4 deletions middleware/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
18 changes: 1 addition & 17 deletions relay/channel/codex/constants.go
Original file line number Diff line number Diff line change
@@ -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)
}
6 changes: 0 additions & 6 deletions relay/helper/model_mapped.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 0 additions & 13 deletions setting/ratio_setting/compact_suffix.go

This file was deleted.

18 changes: 0 additions & 18 deletions setting/ratio_setting/model_ratio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down