Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a2d34b9e
authored
Oct 20, 2025
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add minimax api adaptor
parent
0a8e54de
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
10 deletions
+16
-10
common/api_type.go
+2
-0
constant/api_type.go
+1
-0
relay/channel/minimax/adaptor.go
+3
-3
relay/channel/openai/adaptor.go
+7
-7
relay/relay_adaptor.go
+3
-0
No files found.
common/api_type.go
View file @
a2d34b9e
...
...
@@ -69,6 +69,8 @@ func ChannelType2APIType(channelType int) (int, bool) {
apiType
=
constant
.
APITypeMoonshot
case
constant
.
ChannelTypeSubmodel
:
apiType
=
constant
.
APITypeSubmodel
case
constant
.
ChannelTypeMiniMax
:
apiType
=
constant
.
APITypeMiniMax
}
if
apiType
==
-
1
{
return
constant
.
APITypeOpenAI
,
false
...
...
constant/api_type.go
View file @
a2d34b9e
...
...
@@ -33,5 +33,6 @@ const (
APITypeJimeng
APITypeMoonshot
APITypeSubmodel
APITypeMiniMax
APITypeDummy
// this one is only for count, do not add any channel after this
)
relay/channel/minimax/adaptor.go
View file @
a2d34b9e
...
...
@@ -10,6 +10,7 @@ import (
"github.com/QuantumNous/new-api/dto"
"github.com/QuantumNous/new-api/relay/channel"
"github.com/QuantumNous/new-api/relay/channel/openai"
relaycommon
"github.com/QuantumNous/new-api/relay/common"
"github.com/QuantumNous/new-api/relay/constant"
"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
)
}
// For chat completions, just pass through the response
// MiniMax API is compatible with OpenAI format
return
handleChatCompletionResponse
(
c
,
resp
,
info
)
adaptor
:=
openai
.
Adaptor
{}
return
adaptor
.
DoResponse
(
c
,
resp
,
info
)
}
func
(
a
*
Adaptor
)
GetModelList
()
[]
string
{
...
...
relay/channel/openai/adaptor.go
View file @
a2d34b9e
...
...
@@ -18,7 +18,7 @@ import (
"github.com/QuantumNous/new-api/relay/channel"
"github.com/QuantumNous/new-api/relay/channel/ai360"
"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/xinference"
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
)
}
return
relaycommon
.
GetFullRequestURL
(
info
.
ChannelBaseUrl
,
requestURL
,
info
.
ChannelType
),
nil
case
constant
.
ChannelTypeMiniMax
:
return
minimax
.
GetRequestURL
(
info
)
//
case constant.ChannelTypeMiniMax:
//
return minimax.GetRequestURL(info)
case
constant
.
ChannelTypeCustom
:
url
:=
info
.
ChannelBaseUrl
url
=
strings
.
Replace
(
url
,
"{model}"
,
info
.
UpstreamModelName
,
-
1
)
...
...
@@ -599,8 +599,8 @@ func (a *Adaptor) GetModelList() []string {
return
ai360
.
ModelList
case
constant
.
ChannelTypeLingYiWanWu
:
return
lingyiwanwu
.
ModelList
case
constant
.
ChannelTypeMiniMax
:
return
minimax
.
ModelList
//
case constant.ChannelTypeMiniMax:
//
return minimax.ModelList
case
constant
.
ChannelTypeXinference
:
return
xinference
.
ModelList
case
constant
.
ChannelTypeOpenRouter
:
...
...
@@ -616,8 +616,8 @@ func (a *Adaptor) GetChannelName() string {
return
ai360
.
ChannelName
case
constant
.
ChannelTypeLingYiWanWu
:
return
lingyiwanwu
.
ChannelName
case
constant
.
ChannelTypeMiniMax
:
return
minimax
.
ChannelName
//
case constant.ChannelTypeMiniMax:
//
return minimax.ChannelName
case
constant
.
ChannelTypeXinference
:
return
xinference
.
ChannelName
case
constant
.
ChannelTypeOpenRouter
:
...
...
relay/relay_adaptor.go
View file @
a2d34b9e
...
...
@@ -18,6 +18,7 @@ import (
"github.com/QuantumNous/new-api/relay/channel/gemini"
"github.com/QuantumNous/new-api/relay/channel/jimeng"
"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/mokaai"
"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
case
constant
.
APITypeSubmodel
:
return
&
submodel
.
Adaptor
{}
case
constant
.
APITypeMiniMax
:
return
&
minimax
.
Adaptor
{}
}
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment