| 1 | package config |
| 2 | |
| 3 | // ProviderCatalog describes the display hierarchy only. Existing preset IDs, |
| 4 | // credentials and provider entries remain the installation authority. |
| 5 | type ProviderCatalog struct { |
| 6 | BrandID string `json:"brandId"` |
| 7 | BrandLabel string `json:"brandLabel"` |
| 8 | Region string `json:"region"` |
| 9 | Product string `json:"product"` |
| 10 | Format string `json:"format"` |
| 11 | BaseURL string `json:"baseUrl"` |
| 12 | Protocols map[string]ProviderProtocolEndpoint `json:"protocols,omitempty"` |
| 13 | } |
| 14 | |
| 15 | var providerCatalog = map[string]ProviderCatalog{ |
| 16 | "doubao-chat": {BrandID: "doubao", BrandLabel: "火山引擎 / 豆包", Region: "cn", Product: "api"}, |
| 17 | "doubao-responses": {BrandID: "doubao", BrandLabel: "火山引擎 / 豆包", Region: "cn", Product: "api"}, |
| 18 | "baidu-cloud": {BrandID: "baidu", BrandLabel: "百度智能云 / 千帆", Region: "cn", Product: "api"}, |
| 19 | "ppio": {BrandID: "ppio", BrandLabel: "PPIO / 派欧云", Region: "cn", Product: "api"}, |
| 20 | "qiniu": {BrandID: "qiniu", BrandLabel: "七牛云", Region: "cn", Product: "api"}, |
| 21 | "xai-chat": {BrandID: "xai", BrandLabel: "xAI / Grok", Region: "global", Product: "api"}, |
| 22 | "xai-responses": {BrandID: "xai", BrandLabel: "xAI / Grok", Region: "global", Product: "api"}, |
| 23 | "cerebras": {BrandID: "cerebras", BrandLabel: "Cerebras", Region: "global", Product: "api"}, |
| 24 | "together": {BrandID: "together", BrandLabel: "Together AI", Region: "global", Product: "api"}, |
| 25 | "fireworks-chat": {BrandID: "fireworks", BrandLabel: "Fireworks AI", Region: "global", Product: "api"}, |
| 26 | "fireworks-anthropic": {BrandID: "fireworks", BrandLabel: "Fireworks AI", Region: "global", Product: "api"}, |
| 27 | "fireworks-responses": {BrandID: "fireworks", BrandLabel: "Fireworks AI", Region: "global", Product: "api"}, |
| 28 | |
| 29 | "amd-gpu-cloud": {BrandID: "amd", BrandLabel: "AMD GPU Cloud", Region: "cn", Product: "api"}, |
| 30 | "deepseek-chat": {BrandID: "deepseek", BrandLabel: "DeepSeek", Region: "global", Product: "api"}, |
| 31 | "openai-responses": {BrandID: "openai", BrandLabel: "OpenAI", Region: "global", Product: "api"}, |
| 32 | "openai-chat": {BrandID: "openai", BrandLabel: "OpenAI", Region: "global", Product: "api"}, |
| 33 | "siliconflow": {BrandID: "siliconflow", BrandLabel: "SiliconFlow", Region: "cn", Product: "api"}, |
| 34 | "ollama-local": {BrandID: "ollama", BrandLabel: "Ollama", Region: "local", Product: "local"}, |
| 35 | "ollama-cloud": {BrandID: "ollama", BrandLabel: "Ollama", Region: "global", Product: "api"}, |
| 36 | "lmstudio": {BrandID: "lmstudio", BrandLabel: "LM Studio", Region: "local", Product: "local"}, |
| 37 | "deepseek-anthropic": {BrandID: "deepseek", BrandLabel: "DeepSeek", Region: "global", Product: "api"}, |
| 38 | "longcat-openai": {BrandID: "longcat", BrandLabel: "LongCat", Region: "global", Product: "api"}, |
| 39 | "longcat-anthropic": {BrandID: "longcat", BrandLabel: "LongCat", Region: "global", Product: "api"}, |
| 40 | "kimi-cn": {BrandID: "kimi", BrandLabel: "Moonshot / Kimi", Region: "cn", Product: "api"}, |
| 41 | "kimi-global": {BrandID: "kimi", BrandLabel: "Moonshot / Kimi", Region: "global", Product: "api"}, |
| 42 | "kimi-coding-plan": {BrandID: "kimi", BrandLabel: "Moonshot / Kimi", Region: "global", Product: "coding"}, |
| 43 | "mimo-api": {BrandID: "mimo", BrandLabel: "MiMo", Region: "global", Product: "api"}, |
| 44 | "mimo-anthropic": {BrandID: "mimo", BrandLabel: "MiMo", Region: "global", Product: "api"}, |
| 45 | "mimo-token-plan-cn": {BrandID: "mimo", BrandLabel: "MiMo", Region: "cn", Product: "token"}, |
| 46 | "mimo-token-plan-cn-anthropic": {BrandID: "mimo", BrandLabel: "MiMo", Region: "cn", Product: "token"}, |
| 47 | "mimo-token-plan-sgp": {BrandID: "mimo", BrandLabel: "MiMo", Region: "sgp", Product: "token"}, |
| 48 | "mimo-token-plan-sgp-anthropic": {BrandID: "mimo", BrandLabel: "MiMo", Region: "sgp", Product: "token"}, |
| 49 | "mimo-token-plan-ams": {BrandID: "mimo", BrandLabel: "MiMo", Region: "ams", Product: "token"}, |
| 50 | "mimo-token-plan-ams-anthropic": {BrandID: "mimo", BrandLabel: "MiMo", Region: "ams", Product: "token"}, |
| 51 | "minimax-cn-api": {BrandID: "minimax", BrandLabel: "MiniMax", Region: "cn", Product: "api"}, |
| 52 | "minimax-global-api": {BrandID: "minimax", BrandLabel: "MiniMax", Region: "global", Product: "api"}, |
| 53 | "minimax-cn-anthropic": {BrandID: "minimax", BrandLabel: "MiniMax", Region: "cn", Product: "api"}, |
| 54 | "minimax-global-anthropic": {BrandID: "minimax", BrandLabel: "MiniMax", Region: "global", Product: "api"}, |
| 55 | "deepseek-responses": {BrandID: "deepseek", BrandLabel: "DeepSeek", Region: "global", Product: "api"}, |
| 56 | "glm-cn": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "cn", Product: "api"}, |
| 57 | "zai-global": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "global", Product: "api"}, |
| 58 | "glm-coding-plan-cn": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "cn", Product: "coding"}, |
| 59 | "glm-coding-plan-cn-anthropic": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "cn", Product: "coding"}, |
| 60 | "zai-coding-plan-global": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "global", Product: "coding"}, |
| 61 | "zai-coding-plan-global-anthropic": {BrandID: "zai", BrandLabel: "智谱 / Z.AI", Region: "global", Product: "coding"}, |
| 62 | "opencode-go": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 63 | "opencode-zen-anthropic": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "zen"}, |
| 64 | "qwen-cn": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "cn", Product: "api"}, |
| 65 | "qwen-global": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "global", Product: "api"}, |
| 66 | "qwen-coding-plan-cn": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "cn", Product: "coding"}, |
| 67 | "qwen-coding-plan-cn-anthropic": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "cn", Product: "coding"}, |
| 68 | "qwen-coding-plan-global": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "global", Product: "coding"}, |
| 69 | "qwen-coding-plan-global-anthropic": {BrandID: "qwen", BrandLabel: "阿里云百炼 / Qwen", Region: "global", Product: "coding"}, |
| 70 | "stepfun": {BrandID: "stepfun", BrandLabel: "StepFun", Region: "global", Product: "coding"}, |
| 71 | "stepfun-responses": {BrandID: "stepfun", BrandLabel: "StepFun", Region: "global", Product: "api"}, |
| 72 | "stepfun-anthropic": {BrandID: "stepfun", BrandLabel: "StepFun", Region: "global", Product: "coding"}, |
| 73 | "stepfun-api": {BrandID: "stepfun", BrandLabel: "StepFun", Region: "global", Product: "api"}, |
| 74 | "stepfun-api-anthropic": {BrandID: "stepfun", BrandLabel: "StepFun", Region: "global", Product: "api"}, |
| 75 | "opencode-go-recommended": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 76 | "opencode-go-anthropic": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 77 | "opencode-go-responses": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 78 | "opencode-go-deepseek-anthropic": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 79 | "opencode-go-deepseek-responses": {BrandID: "opencode", BrandLabel: "OpenCode", Region: "global", Product: "go"}, |
| 80 | "scnet": {BrandID: "scnet", BrandLabel: "SCNet", Region: "global", Product: "token"}, |
| 81 | "scnet-anthropic": {BrandID: "scnet", BrandLabel: "SCNet", Region: "global", Product: "token"}, |
| 82 | } |
| 83 | |
| 84 | func CatalogForProviderPreset(p ProviderPreset) ProviderCatalog { |
| 85 | c, ok := providerCatalog[p.ID] |
| 86 | if !ok { |
| 87 | c = ProviderCatalog{BrandID: p.ID, BrandLabel: p.Label, Region: "global", Product: "api"} |
| 88 | } |
| 89 | if len(p.Entries) == 1 { |
| 90 | c.Format = p.Entries[0].Kind |
| 91 | c.BaseURL = p.Entries[0].BaseURL |
| 92 | } else { |
| 93 | c.Format = "bundle" |
| 94 | } |
| 95 | c.Protocols = ProtocolEndpointsForCatalog(c) |
| 96 | return c |
| 97 | } |
| 98 |