feat: add minimax provider support
This commit is contained in:
parent
eda6e37332
commit
5f70f28333
2 changed files with 11 additions and 1 deletions
|
|
@ -177,6 +177,7 @@ type ProvidersConfig struct {
|
||||||
Nvidia ProviderConfig `json:"nvidia"`
|
Nvidia ProviderConfig `json:"nvidia"`
|
||||||
Ollama ProviderConfig `json:"ollama"`
|
Ollama ProviderConfig `json:"ollama"`
|
||||||
Moonshot ProviderConfig `json:"moonshot"`
|
Moonshot ProviderConfig `json:"moonshot"`
|
||||||
|
Minimax ProviderConfig `json:"minimax"`
|
||||||
ShengSuanYun ProviderConfig `json:"shengsuanyun"`
|
ShengSuanYun ProviderConfig `json:"shengsuanyun"`
|
||||||
DeepSeek ProviderConfig `json:"deepseek"`
|
DeepSeek ProviderConfig `json:"deepseek"`
|
||||||
GitHubCopilot ProviderConfig `json:"github_copilot"`
|
GitHubCopilot ProviderConfig `json:"github_copilot"`
|
||||||
|
|
@ -327,6 +328,7 @@ func DefaultConfig() *Config {
|
||||||
Gemini: ProviderConfig{},
|
Gemini: ProviderConfig{},
|
||||||
Nvidia: ProviderConfig{},
|
Nvidia: ProviderConfig{},
|
||||||
Moonshot: ProviderConfig{},
|
Moonshot: ProviderConfig{},
|
||||||
|
Minimax: ProviderConfig{},
|
||||||
ShengSuanYun: ProviderConfig{},
|
ShengSuanYun: ProviderConfig{},
|
||||||
},
|
},
|
||||||
Gateway: GatewayConfig{
|
Gateway: GatewayConfig{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
// 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 {
|
if idx := strings.Index(model, "/"); idx != -1 {
|
||||||
prefix := model[:idx]
|
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:]
|
model = model[idx+1:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -351,6 +351,14 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
apiBase = "https://api.moonshot.cn/v1"
|
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/"):
|
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
|
apiKey = cfg.Providers.OpenRouter.APIKey
|
||||||
proxy = cfg.Providers.OpenRouter.Proxy
|
proxy = cfg.Providers.OpenRouter.Proxy
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue