Skip to content

Commit abafa3c

Browse files
authored
* add minimax provider (sipeed#1273)
1 parent aaf99d7 commit abafa3c

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

pkg/config/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ type ProvidersConfig struct {
481481
Qwen ProviderConfig `json:"qwen"`
482482
Mistral ProviderConfig `json:"mistral"`
483483
Avian ProviderConfig `json:"avian"`
484+
Minimax ProviderConfig `json:"minimax"`
484485
}
485486

486487
// IsEmpty checks if all provider configs are empty (no API keys or API bases set)
@@ -506,7 +507,8 @@ func (p ProvidersConfig) IsEmpty() bool {
506507
p.Antigravity.APIKey == "" && p.Antigravity.APIBase == "" &&
507508
p.Qwen.APIKey == "" && p.Qwen.APIBase == "" &&
508509
p.Mistral.APIKey == "" && p.Mistral.APIBase == "" &&
509-
p.Avian.APIKey == "" && p.Avian.APIBase == ""
510+
p.Avian.APIKey == "" && p.Avian.APIBase == "" &&
511+
p.Minimax.APIKey == "" && p.Minimax.APIBase == ""
510512
}
511513

512514
// MarshalJSON implements custom JSON marshaling for ProvidersConfig

pkg/config/defaults.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,14 @@ func DefaultConfig() *Config {
346346
APIKey: "",
347347
},
348348

349+
// Minimax - https://api.minimaxi.com/
350+
{
351+
ModelName: "MiniMax-M2.5",
352+
Model: "minimax/MiniMax-M2.5",
353+
APIBase: "https://api.minimaxi.com/v1",
354+
APIKey: "",
355+
},
356+
349357
// VLLM (local) - http://localhost:8000
350358
{
351359
ModelName: "local-model",

pkg/providers/factory.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
208208
sel.apiBase = "https://api.mistral.ai/v1"
209209
}
210210
}
211+
case "minimax":
212+
if cfg.Providers.Minimax.APIKey != "" {
213+
sel.apiKey = cfg.Providers.Minimax.APIKey
214+
sel.apiBase = cfg.Providers.Minimax.APIBase
215+
sel.proxy = cfg.Providers.Minimax.Proxy
216+
if sel.apiBase == "" {
217+
sel.apiBase = "https://api.minimaxi.com/v1"
218+
}
219+
}
211220
case "github_copilot", "copilot":
212221
sel.providerType = providerTypeGitHubCopilot
213222
if cfg.Providers.GitHubCopilot.APIBase != "" {
@@ -325,6 +334,13 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
325334
if sel.apiBase == "" {
326335
sel.apiBase = "https://api.mistral.ai/v1"
327336
}
337+
case (strings.Contains(lowerModel, "minimax") || strings.HasPrefix(model, "minimax/")) && cfg.Providers.Minimax.APIKey != "":
338+
sel.apiKey = cfg.Providers.Minimax.APIKey
339+
sel.apiBase = cfg.Providers.Minimax.APIBase
340+
sel.proxy = cfg.Providers.Minimax.Proxy
341+
if sel.apiBase == "" {
342+
sel.apiBase = "https://api.minimaxi.com/v1"
343+
}
328344
case strings.HasPrefix(model, "avian/") && cfg.Providers.Avian.APIKey != "":
329345
sel.apiKey = cfg.Providers.Avian.APIKey
330346
sel.apiBase = cfg.Providers.Avian.APIBase

pkg/providers/factory_provider.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err
9494

9595
case "litellm", "openrouter", "groq", "zhipu", "gemini", "nvidia",
9696
"ollama", "moonshot", "shengsuanyun", "deepseek", "cerebras",
97-
"vivgrid", "volcengine", "vllm", "qwen", "mistral", "avian":
97+
"vivgrid", "volcengine", "vllm", "qwen", "mistral", "avian",
98+
"minimax":
9899
// All other OpenAI-compatible HTTP providers
99100
if cfg.APIKey == "" && cfg.APIBase == "" {
100101
return nil, "", fmt.Errorf("api_key or api_base is required for HTTP-based protocol %q", protocol)
@@ -212,6 +213,8 @@ func getDefaultAPIBase(protocol string) string {
212213
return "https://api.mistral.ai/v1"
213214
case "avian":
214215
return "https://api.avian.io/v1"
216+
case "minimax":
217+
return "https://api.minimaxi.com/v1"
215218
default:
216219
return ""
217220
}

pkg/providers/openai_compat/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ func normalizeModel(model, apiBase string) string {
440440
prefix := strings.ToLower(before)
441441
switch prefix {
442442
case "litellm", "moonshot", "nvidia", "groq", "ollama", "deepseek", "google",
443-
"openrouter", "zhipu", "mistral", "vivgrid":
443+
"openrouter", "zhipu", "mistral", "vivgrid", "minimax":
444444
return after
445445
default:
446446
return model

0 commit comments

Comments
 (0)