feat: add minimax provider support

This commit is contained in:
princeh23 2026-02-18 21:58:19 +08:00
parent eda6e37332
commit 5f70f28333
2 changed files with 11 additions and 1 deletions

View file

@ -177,6 +177,7 @@ type ProvidersConfig struct {
Nvidia ProviderConfig `json:"nvidia"`
Ollama ProviderConfig `json:"ollama"`
Moonshot ProviderConfig `json:"moonshot"`
Minimax ProviderConfig `json:"minimax"`
ShengSuanYun ProviderConfig `json:"shengsuanyun"`
DeepSeek ProviderConfig `json:"deepseek"`
GitHubCopilot ProviderConfig `json:"github_copilot"`
@ -327,6 +328,7 @@ func DefaultConfig() *Config {
Gemini: ProviderConfig{},
Nvidia: ProviderConfig{},
Moonshot: ProviderConfig{},
Minimax: ProviderConfig{},
ShengSuanYun: ProviderConfig{},
},
Gateway: GatewayConfig{

View file

@ -56,7 +56,7 @@ func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []Too
// Strip provider prefix from model name (e.g., moonshot/kimi-k2.5 -> kimi-k2.5, groq/openai/gpt-oss-120b -> openai/gpt-oss-120b, ollama/qwen2.5:14b -> qwen2.5:14b)
if idx := strings.Index(model, "/"); idx != -1 {
prefix := model[:idx]
if prefix == "moonshot" || prefix == "nvidia" || prefix == "groq" || prefix == "ollama" {
if prefix == "moonshot" || prefix == "nvidia" || prefix == "groq" || prefix == "ollama" || prefix == "minimax" {
model = model[idx+1:]
}
}
@ -351,6 +351,14 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
apiBase = "https://api.moonshot.cn/v1"
}
case (strings.Contains(lowerModel, "minimax") || strings.HasPrefix(model, "minimax/")) && cfg.Providers.Minimax.APIKey != "":
apiKey = cfg.Providers.Minimax.APIKey
apiBase = cfg.Providers.Minimax.APIBase
proxy = cfg.Providers.Minimax.Proxy
if apiBase == "" {
apiBase = "https://api.minimax.chat/v1"
}
case strings.HasPrefix(model, "openrouter/") || strings.HasPrefix(model, "anthropic/") || strings.HasPrefix(model, "openai/") || strings.HasPrefix(model, "meta-llama/") || strings.HasPrefix(model, "deepseek/") || strings.HasPrefix(model, "google/"):
apiKey = cfg.Providers.OpenRouter.APIKey
proxy = cfg.Providers.OpenRouter.Proxy