channel.go 7.5 KB

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