feat: add minimax api adaptor
This commit is contained in:
@@ -69,6 +69,8 @@ func ChannelType2APIType(channelType int) (int, bool) {
|
|||||||
apiType = constant.APITypeMoonshot
|
apiType = constant.APITypeMoonshot
|
||||||
case constant.ChannelTypeSubmodel:
|
case constant.ChannelTypeSubmodel:
|
||||||
apiType = constant.APITypeSubmodel
|
apiType = constant.APITypeSubmodel
|
||||||
|
case constant.ChannelTypeMiniMax:
|
||||||
|
apiType = constant.APITypeMiniMax
|
||||||
}
|
}
|
||||||
if apiType == -1 {
|
if apiType == -1 {
|
||||||
return constant.APITypeOpenAI, false
|
return constant.APITypeOpenAI, false
|
||||||
|
|||||||
@@ -33,5 +33,6 @@ const (
|
|||||||
APITypeJimeng
|
APITypeJimeng
|
||||||
APITypeMoonshot
|
APITypeMoonshot
|
||||||
APITypeSubmodel
|
APITypeSubmodel
|
||||||
|
APITypeMiniMax
|
||||||
APITypeDummy // this one is only for count, do not add any channel after this
|
APITypeDummy // this one is only for count, do not add any channel after this
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/QuantumNous/new-api/dto"
|
"github.com/QuantumNous/new-api/dto"
|
||||||
"github.com/QuantumNous/new-api/relay/channel"
|
"github.com/QuantumNous/new-api/relay/channel"
|
||||||
|
"github.com/QuantumNous/new-api/relay/channel/openai"
|
||||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||||
"github.com/QuantumNous/new-api/relay/constant"
|
"github.com/QuantumNous/new-api/relay/constant"
|
||||||
"github.com/QuantumNous/new-api/types"
|
"github.com/QuantumNous/new-api/types"
|
||||||
@@ -116,9 +117,8 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycom
|
|||||||
return handleTTSResponse(c, resp, info)
|
return handleTTSResponse(c, resp, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For chat completions, just pass through the response
|
adaptor := openai.Adaptor{}
|
||||||
// MiniMax API is compatible with OpenAI format
|
return adaptor.DoResponse(c, resp, info)
|
||||||
return handleChatCompletionResponse(c, resp, info)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) GetModelList() []string {
|
func (a *Adaptor) GetModelList() []string {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/QuantumNous/new-api/relay/channel"
|
"github.com/QuantumNous/new-api/relay/channel"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/ai360"
|
"github.com/QuantumNous/new-api/relay/channel/ai360"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/lingyiwanwu"
|
"github.com/QuantumNous/new-api/relay/channel/lingyiwanwu"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/minimax"
|
//"github.com/QuantumNous/new-api/relay/channel/minimax"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/openrouter"
|
"github.com/QuantumNous/new-api/relay/channel/openrouter"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/xinference"
|
"github.com/QuantumNous/new-api/relay/channel/xinference"
|
||||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||||
@@ -161,8 +161,8 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|||||||
requestURL = fmt.Sprintf("/openai/realtime?deployment=%s&api-version=%s", model_, apiVersion)
|
requestURL = fmt.Sprintf("/openai/realtime?deployment=%s&api-version=%s", model_, apiVersion)
|
||||||
}
|
}
|
||||||
return relaycommon.GetFullRequestURL(info.ChannelBaseUrl, requestURL, info.ChannelType), nil
|
return relaycommon.GetFullRequestURL(info.ChannelBaseUrl, requestURL, info.ChannelType), nil
|
||||||
case constant.ChannelTypeMiniMax:
|
//case constant.ChannelTypeMiniMax:
|
||||||
return minimax.GetRequestURL(info)
|
// return minimax.GetRequestURL(info)
|
||||||
case constant.ChannelTypeCustom:
|
case constant.ChannelTypeCustom:
|
||||||
url := info.ChannelBaseUrl
|
url := info.ChannelBaseUrl
|
||||||
url = strings.Replace(url, "{model}", info.UpstreamModelName, -1)
|
url = strings.Replace(url, "{model}", info.UpstreamModelName, -1)
|
||||||
@@ -599,8 +599,8 @@ func (a *Adaptor) GetModelList() []string {
|
|||||||
return ai360.ModelList
|
return ai360.ModelList
|
||||||
case constant.ChannelTypeLingYiWanWu:
|
case constant.ChannelTypeLingYiWanWu:
|
||||||
return lingyiwanwu.ModelList
|
return lingyiwanwu.ModelList
|
||||||
case constant.ChannelTypeMiniMax:
|
//case constant.ChannelTypeMiniMax:
|
||||||
return minimax.ModelList
|
// return minimax.ModelList
|
||||||
case constant.ChannelTypeXinference:
|
case constant.ChannelTypeXinference:
|
||||||
return xinference.ModelList
|
return xinference.ModelList
|
||||||
case constant.ChannelTypeOpenRouter:
|
case constant.ChannelTypeOpenRouter:
|
||||||
@@ -616,8 +616,8 @@ func (a *Adaptor) GetChannelName() string {
|
|||||||
return ai360.ChannelName
|
return ai360.ChannelName
|
||||||
case constant.ChannelTypeLingYiWanWu:
|
case constant.ChannelTypeLingYiWanWu:
|
||||||
return lingyiwanwu.ChannelName
|
return lingyiwanwu.ChannelName
|
||||||
case constant.ChannelTypeMiniMax:
|
//case constant.ChannelTypeMiniMax:
|
||||||
return minimax.ChannelName
|
// return minimax.ChannelName
|
||||||
case constant.ChannelTypeXinference:
|
case constant.ChannelTypeXinference:
|
||||||
return xinference.ChannelName
|
return xinference.ChannelName
|
||||||
case constant.ChannelTypeOpenRouter:
|
case constant.ChannelTypeOpenRouter:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/QuantumNous/new-api/relay/channel/gemini"
|
"github.com/QuantumNous/new-api/relay/channel/gemini"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/jimeng"
|
"github.com/QuantumNous/new-api/relay/channel/jimeng"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/jina"
|
"github.com/QuantumNous/new-api/relay/channel/jina"
|
||||||
|
"github.com/QuantumNous/new-api/relay/channel/minimax"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/mistral"
|
"github.com/QuantumNous/new-api/relay/channel/mistral"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/mokaai"
|
"github.com/QuantumNous/new-api/relay/channel/mokaai"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/moonshot"
|
"github.com/QuantumNous/new-api/relay/channel/moonshot"
|
||||||
@@ -108,6 +109,8 @@ func GetAdaptor(apiType int) channel.Adaptor {
|
|||||||
return &moonshot.Adaptor{} // Moonshot uses Claude API
|
return &moonshot.Adaptor{} // Moonshot uses Claude API
|
||||||
case constant.APITypeSubmodel:
|
case constant.APITypeSubmodel:
|
||||||
return &submodel.Adaptor{}
|
return &submodel.Adaptor{}
|
||||||
|
case constant.APITypeMiniMax:
|
||||||
|
return &minimax.Adaptor{}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user