mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 15:53:42 +08:00 
			
		
		
		
	feat: add SiliconFlow (#1717)
* Add SiliconFlow * Update README.md * Update README.md * Update channel.constants.js * Update ChannelConstants.js * Update channel.constants.js * Update ChannelConstants.js * Update compatible.go * Update README.md
This commit is contained in:
		@@ -89,6 +89,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 
 | 
			
		||||
   + [x] [DeepL](https://www.deepl.com/)
 | 
			
		||||
   + [x] [together.ai](https://www.together.ai/)
 | 
			
		||||
   + [x] [novita.ai](https://www.novita.ai/)
 | 
			
		||||
   + [x] [硅基流动 SiliconCloud](https://siliconflow.cn/siliconcloud)
 | 
			
		||||
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
 | 
			
		||||
3. 支持通过**负载均衡**的方式访问多个渠道。
 | 
			
		||||
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,7 @@ import (
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/novita"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/stepfun"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/togetherai"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/siliconflow"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/channeltype"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +31,7 @@ var CompatibleChannels = []int{
 | 
			
		||||
	channeltype.DeepSeek,
 | 
			
		||||
	channeltype.TogetherAI,
 | 
			
		||||
	channeltype.Novita,
 | 
			
		||||
	channeltype.SiliconFlow,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetCompatibleChannelMeta(channelType int) (string, []string) {
 | 
			
		||||
@@ -60,6 +62,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
 | 
			
		||||
		return "doubao", doubao.ModelList
 | 
			
		||||
	case channeltype.Novita:
 | 
			
		||||
		return "novita", novita.ModelList
 | 
			
		||||
	case channeltype.SiliconFlow:
 | 
			
		||||
		return "siliconflow", siliconflow.ModelList
 | 
			
		||||
	default:
 | 
			
		||||
		return "openai", ModelList
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								relay/adaptor/siliconflow/constants.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								relay/adaptor/siliconflow/constants.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
package siliconflow
 | 
			
		||||
 | 
			
		||||
// https://docs.siliconflow.cn/docs/getting-started
 | 
			
		||||
 | 
			
		||||
var ModelList = []string{
 | 
			
		||||
	"deepseek-ai/deepseek-llm-67b-chat",
 | 
			
		||||
	"Qwen/Qwen1.5-14B-Chat",
 | 
			
		||||
	"Qwen/Qwen1.5-7B-Chat",
 | 
			
		||||
	"Qwen/Qwen1.5-110B-Chat",
 | 
			
		||||
	"Qwen/Qwen1.5-32B-Chat",
 | 
			
		||||
	"01-ai/Yi-1.5-6B-Chat",
 | 
			
		||||
	"01-ai/Yi-1.5-9B-Chat-16K",
 | 
			
		||||
	"01-ai/Yi-1.5-34B-Chat-16K",
 | 
			
		||||
	"THUDM/chatglm3-6b",
 | 
			
		||||
	"deepseek-ai/DeepSeek-V2-Chat",
 | 
			
		||||
	"THUDM/glm-4-9b-chat",
 | 
			
		||||
	"Qwen/Qwen2-72B-Instruct",
 | 
			
		||||
	"Qwen/Qwen2-7B-Instruct",
 | 
			
		||||
	"Qwen/Qwen2-57B-A14B-Instruct",
 | 
			
		||||
	"deepseek-ai/DeepSeek-Coder-V2-Instruct",
 | 
			
		||||
	"Qwen/Qwen2-1.5B-Instruct",
 | 
			
		||||
	"internlm/internlm2_5-7b-chat",
 | 
			
		||||
	"BAAI/bge-large-en-v1.5",
 | 
			
		||||
	"BAAI/bge-large-zh-v1.5",
 | 
			
		||||
	"Pro/Qwen/Qwen2-7B-Instruct",
 | 
			
		||||
	"Pro/Qwen/Qwen2-1.5B-Instruct",
 | 
			
		||||
	"Pro/Qwen/Qwen1.5-7B-Chat",
 | 
			
		||||
	"Pro/THUDM/glm-4-9b-chat",
 | 
			
		||||
	"Pro/THUDM/chatglm3-6b",
 | 
			
		||||
	"Pro/01-ai/Yi-1.5-9B-Chat-16K",
 | 
			
		||||
	"Pro/01-ai/Yi-1.5-6B-Chat",
 | 
			
		||||
	"Pro/google/gemma-2-9b-it",
 | 
			
		||||
	"Pro/internlm/internlm2_5-7b-chat",
 | 
			
		||||
	"Pro/meta-llama/Meta-Llama-3-8B-Instruct",
 | 
			
		||||
	"Pro/mistralai/Mistral-7B-Instruct-v0.2",
 | 
			
		||||
}
 | 
			
		||||
@@ -45,5 +45,6 @@ const (
 | 
			
		||||
	Novita
 | 
			
		||||
	VertextAI
 | 
			
		||||
	Proxy
 | 
			
		||||
	SiliconFlow
 | 
			
		||||
	Dummy
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,7 @@ var ChannelBaseURLs = []string{
 | 
			
		||||
	"https://api.novita.ai/v3/openai",           // 41
 | 
			
		||||
	"",                                          // 42
 | 
			
		||||
	"",                                          // 43
 | 
			
		||||
	"https://api.siliconflow.cn",                 // 44
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ export const CHANNEL_OPTIONS = [
 | 
			
		||||
  { key: 39, text: 'together.ai', value: 39, color: 'blue' },
 | 
			
		||||
  { key: 42, text: 'VertexAI', value: 42, color: 'blue' },
 | 
			
		||||
  { key: 43, text: 'Proxy', value: 43, color: 'blue' },
 | 
			
		||||
  { key: 44, text: 'SiliconFlow', value: 44, color: 'blue' },
 | 
			
		||||
  { key: 8, text: '自定义渠道', value: 8, color: 'pink' },
 | 
			
		||||
  { key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
 | 
			
		||||
  { key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },
 | 
			
		||||
 
 | 
			
		||||
@@ -173,6 +173,12 @@ export const CHANNEL_OPTIONS = {
 | 
			
		||||
    value: 43,
 | 
			
		||||
    color: 'primary'
 | 
			
		||||
  },
 | 
			
		||||
  44: {
 | 
			
		||||
    key: 44,
 | 
			
		||||
    text: 'SiliconFlow',
 | 
			
		||||
    value: 44,
 | 
			
		||||
    color: 'primary'
 | 
			
		||||
  },
 | 
			
		||||
  41: {
 | 
			
		||||
    key: 41,
 | 
			
		||||
    text: 'Novita',
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ export const CHANNEL_OPTIONS = [
 | 
			
		||||
    { key: 39, text: 'together.ai', value: 39, color: 'blue' },
 | 
			
		||||
    { key: 42, text: 'VertexAI', value: 42, color: 'blue' },
 | 
			
		||||
    { key: 43, text: 'Proxy', value: 43, color: 'blue' },
 | 
			
		||||
    { key: 44, text: 'SiliconFlow', value: 44, color: 'blue' },
 | 
			
		||||
    { key: 8, text: '自定义渠道', value: 8, color: 'pink' },
 | 
			
		||||
    { key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
 | 
			
		||||
    { key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user