Skip to content

Commit 402fcf7

Browse files
authored
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
1 parent 36039e3 commit 402fcf7

File tree

8 files changed

+51
-0
lines changed

8 files changed

+51
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
8989
+ [x] [DeepL](https://www.deepl.com/)
9090
+ [x] [together.ai](https://www.together.ai/)
9191
+ [x] [novita.ai](https://www.novita.ai/)
92+
+ [x] [硅基流动 SiliconCloud](https://siliconflow.cn/siliconcloud)
9293
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)
9394
3. 支持通过**负载均衡**的方式访问多个渠道。
9495
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。

relay/adaptor/openai/compatible.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/songquanpeng/one-api/relay/adaptor/novita"
1414
"github.com/songquanpeng/one-api/relay/adaptor/stepfun"
1515
"github.com/songquanpeng/one-api/relay/adaptor/togetherai"
16+
"github.com/songquanpeng/one-api/relay/adaptor/siliconflow"
1617
"github.com/songquanpeng/one-api/relay/channeltype"
1718
)
1819

@@ -30,6 +31,7 @@ var CompatibleChannels = []int{
3031
channeltype.DeepSeek,
3132
channeltype.TogetherAI,
3233
channeltype.Novita,
34+
channeltype.SiliconFlow,
3335
}
3436

3537
func GetCompatibleChannelMeta(channelType int) (string, []string) {
@@ -60,6 +62,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
6062
return "doubao", doubao.ModelList
6163
case channeltype.Novita:
6264
return "novita", novita.ModelList
65+
case channeltype.SiliconFlow:
66+
return "siliconflow", siliconflow.ModelList
6367
default:
6468
return "openai", ModelList
6569
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package siliconflow
2+
3+
// https://docs.siliconflow.cn/docs/getting-started
4+
5+
var ModelList = []string{
6+
"deepseek-ai/deepseek-llm-67b-chat",
7+
"Qwen/Qwen1.5-14B-Chat",
8+
"Qwen/Qwen1.5-7B-Chat",
9+
"Qwen/Qwen1.5-110B-Chat",
10+
"Qwen/Qwen1.5-32B-Chat",
11+
"01-ai/Yi-1.5-6B-Chat",
12+
"01-ai/Yi-1.5-9B-Chat-16K",
13+
"01-ai/Yi-1.5-34B-Chat-16K",
14+
"THUDM/chatglm3-6b",
15+
"deepseek-ai/DeepSeek-V2-Chat",
16+
"THUDM/glm-4-9b-chat",
17+
"Qwen/Qwen2-72B-Instruct",
18+
"Qwen/Qwen2-7B-Instruct",
19+
"Qwen/Qwen2-57B-A14B-Instruct",
20+
"deepseek-ai/DeepSeek-Coder-V2-Instruct",
21+
"Qwen/Qwen2-1.5B-Instruct",
22+
"internlm/internlm2_5-7b-chat",
23+
"BAAI/bge-large-en-v1.5",
24+
"BAAI/bge-large-zh-v1.5",
25+
"Pro/Qwen/Qwen2-7B-Instruct",
26+
"Pro/Qwen/Qwen2-1.5B-Instruct",
27+
"Pro/Qwen/Qwen1.5-7B-Chat",
28+
"Pro/THUDM/glm-4-9b-chat",
29+
"Pro/THUDM/chatglm3-6b",
30+
"Pro/01-ai/Yi-1.5-9B-Chat-16K",
31+
"Pro/01-ai/Yi-1.5-6B-Chat",
32+
"Pro/google/gemma-2-9b-it",
33+
"Pro/internlm/internlm2_5-7b-chat",
34+
"Pro/meta-llama/Meta-Llama-3-8B-Instruct",
35+
"Pro/mistralai/Mistral-7B-Instruct-v0.2",
36+
}

relay/channeltype/define.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ const (
4545
Novita
4646
VertextAI
4747
Proxy
48+
SiliconFlow
4849
Dummy
4950
)

relay/channeltype/url.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var ChannelBaseURLs = []string{
4545
"https://api.novita.ai/v3/openai", // 41
4646
"", // 42
4747
"", // 43
48+
"https://api.siliconflow.cn", // 44
4849
}
4950

5051
func init() {

web/air/src/constants/channel.constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const CHANNEL_OPTIONS = [
2929
{ key: 39, text: 'together.ai', value: 39, color: 'blue' },
3030
{ key: 42, text: 'VertexAI', value: 42, color: 'blue' },
3131
{ key: 43, text: 'Proxy', value: 43, color: 'blue' },
32+
{ key: 44, text: 'SiliconFlow', value: 44, color: 'blue' },
3233
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' },
3334
{ key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
3435
{ key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },

web/berry/src/constants/ChannelConstants.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ export const CHANNEL_OPTIONS = {
173173
value: 43,
174174
color: 'primary'
175175
},
176+
44: {
177+
key: 44,
178+
text: 'SiliconFlow',
179+
value: 44,
180+
color: 'primary'
181+
},
176182
41: {
177183
key: 41,
178184
text: 'Novita',

web/default/src/constants/channel.constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const CHANNEL_OPTIONS = [
2929
{ key: 39, text: 'together.ai', value: 39, color: 'blue' },
3030
{ key: 42, text: 'VertexAI', value: 42, color: 'blue' },
3131
{ key: 43, text: 'Proxy', value: 43, color: 'blue' },
32+
{ key: 44, text: 'SiliconFlow', value: 44, color: 'blue' },
3233
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' },
3334
{ key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
3435
{ key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },

0 commit comments

Comments
 (0)