fix(providers):add modelscope provider backend implementation
This commit is contained in:
parent
19835b2f60
commit
6cd71044a0
3 changed files with 11 additions and 1 deletions
|
|
@ -51,6 +51,12 @@
|
||||||
"model": "openai/gpt-5.4",
|
"model": "openai/gpt-5.4",
|
||||||
"api_key": "sk-key2",
|
"api_key": "sk-key2",
|
||||||
"api_base": "https://api2.example.com/v1"
|
"api_base": "https://api2.example.com/v1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model_name": "MiniMax-M2.5",
|
||||||
|
"model": "modelscope/MiniMax/MiniMax-M2.5",
|
||||||
|
"api_key": "sk-key3",
|
||||||
|
"api_base": "https://api-inference.modelscope.cn/v1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"channels": {
|
"channels": {
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err
|
||||||
case "litellm", "openrouter", "groq", "zhipu", "gemini", "nvidia",
|
case "litellm", "openrouter", "groq", "zhipu", "gemini", "nvidia",
|
||||||
"ollama", "moonshot", "shengsuanyun", "deepseek", "cerebras",
|
"ollama", "moonshot", "shengsuanyun", "deepseek", "cerebras",
|
||||||
"vivgrid", "volcengine", "vllm", "qwen", "mistral", "avian",
|
"vivgrid", "volcengine", "vllm", "qwen", "mistral", "avian",
|
||||||
"minimax", "longcat":
|
"minimax", "longcat", "modelscope":
|
||||||
// All other OpenAI-compatible HTTP providers
|
// All other OpenAI-compatible HTTP providers
|
||||||
if cfg.APIKey == "" && cfg.APIBase == "" {
|
if cfg.APIKey == "" && cfg.APIBase == "" {
|
||||||
return nil, "", fmt.Errorf("api_key or api_base is required for HTTP-based protocol %q", protocol)
|
return nil, "", fmt.Errorf("api_key or api_base is required for HTTP-based protocol %q", protocol)
|
||||||
|
|
@ -217,6 +217,8 @@ func getDefaultAPIBase(protocol string) string {
|
||||||
return "https://api.minimaxi.com/v1"
|
return "https://api.minimaxi.com/v1"
|
||||||
case "longcat":
|
case "longcat":
|
||||||
return "https://api.longcat.chat/openai"
|
return "https://api.longcat.chat/openai"
|
||||||
|
case "modelscope":
|
||||||
|
return "https://api.modelscope.cn/v1"
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -464,6 +464,8 @@ func normalizeModel(model, apiBase string) string {
|
||||||
|
|
||||||
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
||||||
return model
|
return model
|
||||||
|
} else if strings.Contains(strings.ToLower(apiBase), "api-inference.modelscope.cn") {
|
||||||
|
return model
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix := strings.ToLower(before)
|
prefix := strings.ToLower(before)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue