channel.go 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. package constant
  2. const (
  3. ChannelTypeUnknown = 0
  4. ChannelTypeOpenAI = 1
  5. ChannelTypeMidjourney = 2
  6. ChannelTypeAzure = 3
  7. ChannelTypeOllama = 4
  8. ChannelTypeMidjourneyPlus = 5
  9. ChannelTypeOpenAIMax = 6
  10. ChannelTypeOhMyGPT = 7
  11. ChannelTypeCustom = 8
  12. ChannelTypeAILS = 9
  13. ChannelTypeAIProxy = 10
  14. ChannelTypePaLM = 11
  15. ChannelTypeAPI2GPT = 12
  16. ChannelTypeAIGC2D = 13
  17. ChannelTypeAnthropic = 14
  18. ChannelTypeBaidu = 15
  19. ChannelTypeZhipu = 16
  20. ChannelTypeAli = 17
  21. ChannelTypeXunfei = 18
  22. ChannelType360 = 19
  23. ChannelTypeOpenRouter = 20
  24. ChannelTypeAIProxyLibrary = 21
  25. ChannelTypeFastGPT = 22
  26. ChannelTypeTencent = 23
  27. ChannelTypeGemini = 24
  28. ChannelTypeMoonshot = 25
  29. ChannelTypeZhipu_v4 = 26
  30. ChannelTypePerplexity = 27
  31. ChannelTypeLingYiWanWu = 31
  32. ChannelTypeAws = 33
  33. ChannelTypeCohere = 34
  34. ChannelTypeMiniMax = 35
  35. ChannelTypeSunoAPI = 36
  36. ChannelTypeDify = 37
  37. ChannelTypeJina = 38
  38. ChannelCloudflare = 39
  39. ChannelTypeSiliconFlow = 40
  40. ChannelTypeVertexAi = 41
  41. ChannelTypeMistral = 42
  42. ChannelTypeDeepSeek = 43
  43. ChannelTypeMokaAI = 44
  44. ChannelTypeVolcEngine = 45
  45. ChannelTypeBaiduV2 = 46
  46. ChannelTypeXinference = 47
  47. ChannelTypeXai = 48
  48. ChannelTypeCoze = 49
  49. ChannelTypeKling = 50
  50. ChannelTypeJimeng = 51
  51. ChannelTypeVidu = 52
  52. ChannelTypeSubmodel = 53
  53. ChannelTypeDoubaoVideo = 54
  54. ChannelTypeSora = 55
  55. ChannelTypeReplicate = 56
  56. ChannelTypeDummy // this one is only for count, do not add any channel after this
  57. )
  58. var ChannelBaseURLs = []string{
  59. "", // 0
  60. "https://api.openai.com", // 1
  61. "https://oa.api2d.net", // 2
  62. "", // 3
  63. "http://localhost:11434", // 4
  64. "https://api.openai-sb.com", // 5
  65. "https://api.openaimax.com", // 6
  66. "https://api.ohmygpt.com", // 7
  67. "", // 8
  68. "https://api.caipacity.com", // 9
  69. "https://api.aiproxy.io", // 10
  70. "", // 11
  71. "https://api.api2gpt.com", // 12
  72. "https://api.aigc2d.com", // 13
  73. "https://api.anthropic.com", // 14
  74. "https://aip.baidubce.com", // 15
  75. "https://open.bigmodel.cn", // 16
  76. "https://dashscope.aliyuncs.com", // 17
  77. "", // 18
  78. "https://api.360.cn", // 19
  79. "https://openrouter.ai/api", // 20
  80. "https://api.aiproxy.io", // 21
  81. "https://fastgpt.run/api/openapi", // 22
  82. "https://hunyuan.tencentcloudapi.com", //23
  83. "https://generativelanguage.googleapis.com", //24
  84. "https://api.moonshot.cn", //25
  85. "https://open.bigmodel.cn", //26
  86. "https://api.perplexity.ai", //27
  87. "", //28
  88. "", //29
  89. "", //30
  90. "https://api.lingyiwanwu.com", //31
  91. "", //32
  92. "", //33
  93. "https://api.cohere.ai", //34
  94. "https://api.minimax.chat", //35
  95. "", //36
  96. "https://api.dify.ai", //37
  97. "https://api.jina.ai", //38
  98. "https://api.cloudflare.com", //39
  99. "https://api.siliconflow.cn", //40
  100. "", //41
  101. "https://api.mistral.ai", //42
  102. "https://api.deepseek.com", //43
  103. "https://api.moka.ai", //44
  104. "https://ark.cn-beijing.volces.com", //45
  105. "https://qianfan.baidubce.com", //46
  106. "", //47
  107. "https://api.x.ai", //48
  108. "https://api.coze.cn", //49
  109. "https://api.klingai.com", //50
  110. "https://visual.volcengineapi.com", //51
  111. "https://api.vidu.cn", //52
  112. "https://llm.submodel.ai", //53
  113. "https://ark.cn-beijing.volces.com", //54
  114. "https://api.openai.com", //55
  115. "https://api.replicate.com", //56
  116. }
  117. var ChannelTypeNames = map[int]string{
  118. ChannelTypeUnknown: "Unknown",
  119. ChannelTypeOpenAI: "OpenAI",
  120. ChannelTypeMidjourney: "Midjourney",
  121. ChannelTypeAzure: "Azure",
  122. ChannelTypeOllama: "Ollama",
  123. ChannelTypeMidjourneyPlus: "MidjourneyPlus",
  124. ChannelTypeOpenAIMax: "OpenAIMax",
  125. ChannelTypeOhMyGPT: "OhMyGPT",
  126. ChannelTypeCustom: "Custom",
  127. ChannelTypeAILS: "AILS",
  128. ChannelTypeAIProxy: "AIProxy",
  129. ChannelTypePaLM: "PaLM",
  130. ChannelTypeAPI2GPT: "API2GPT",
  131. ChannelTypeAIGC2D: "AIGC2D",
  132. ChannelTypeAnthropic: "Anthropic",
  133. ChannelTypeBaidu: "Baidu",
  134. ChannelTypeZhipu: "Zhipu",
  135. ChannelTypeAli: "Ali",
  136. ChannelTypeXunfei: "Xunfei",
  137. ChannelType360: "360",
  138. ChannelTypeOpenRouter: "OpenRouter",
  139. ChannelTypeAIProxyLibrary: "AIProxyLibrary",
  140. ChannelTypeFastGPT: "FastGPT",
  141. ChannelTypeTencent: "Tencent",
  142. ChannelTypeGemini: "Gemini",
  143. ChannelTypeMoonshot: "Moonshot",
  144. ChannelTypeZhipu_v4: "ZhipuV4",
  145. ChannelTypePerplexity: "Perplexity",
  146. ChannelTypeLingYiWanWu: "LingYiWanWu",
  147. ChannelTypeAws: "AWS",
  148. ChannelTypeCohere: "Cohere",
  149. ChannelTypeMiniMax: "MiniMax",
  150. ChannelTypeSunoAPI: "SunoAPI",
  151. ChannelTypeDify: "Dify",
  152. ChannelTypeJina: "Jina",
  153. ChannelCloudflare: "Cloudflare",
  154. ChannelTypeSiliconFlow: "SiliconFlow",
  155. ChannelTypeVertexAi: "VertexAI",
  156. ChannelTypeMistral: "Mistral",
  157. ChannelTypeDeepSeek: "DeepSeek",
  158. ChannelTypeMokaAI: "MokaAI",
  159. ChannelTypeVolcEngine: "VolcEngine",
  160. ChannelTypeBaiduV2: "BaiduV2",
  161. ChannelTypeXinference: "Xinference",
  162. ChannelTypeXai: "xAI",
  163. ChannelTypeCoze: "Coze",
  164. ChannelTypeKling: "Kling",
  165. ChannelTypeJimeng: "Jimeng",
  166. ChannelTypeVidu: "Vidu",
  167. ChannelTypeSubmodel: "Submodel",
  168. ChannelTypeDoubaoVideo: "DoubaoVideo",
  169. ChannelTypeSora: "Sora",
  170. ChannelTypeReplicate: "Replicate",
  171. }
  172. func GetChannelTypeName(channelType int) string {
  173. if name, ok := ChannelTypeNames[channelType]; ok {
  174. return name
  175. }
  176. return "Unknown"
  177. }
  178. type ChannelSpecialBase struct {
  179. ClaudeBaseURL string
  180. OpenAIBaseURL string
  181. }
  182. var ChannelSpecialBases = map[string]ChannelSpecialBase{
  183. "glm-coding-plan": {
  184. ClaudeBaseURL: "https://open.bigmodel.cn/api/anthropic",
  185. OpenAIBaseURL: "https://open.bigmodel.cn/api/coding/paas/v4",
  186. },
  187. "glm-coding-plan-international": {
  188. ClaudeBaseURL: "https://api.z.ai/api/anthropic",
  189. OpenAIBaseURL: "https://api.z.ai/api/coding/paas/v4",
  190. },
  191. "kimi-coding-plan": {
  192. ClaudeBaseURL: "https://api.kimi.com/coding",
  193. OpenAIBaseURL: "https://api.kimi.com/coding/v1",
  194. },
  195. "doubao-coding-plan": {
  196. ClaudeBaseURL: "https://ark.cn-beijing.volces.com/api/coding",
  197. OpenAIBaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3",
  198. },
  199. }