feat: support deepseek now

This commit is contained in:
JustSong 2024-04-26 00:48:53 +08:00
parent da0842272c
commit c317872097
8 changed files with 27 additions and 1 deletions

View File

@ -84,6 +84,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
+ [x] [阶跃星辰](https://platform.stepfun.com/) + [x] [阶跃星辰](https://platform.stepfun.com/)
+ [x] [Coze](https://www.coze.com/) + [x] [Coze](https://www.coze.com/)
+ [x] [Cohere](https://cohere.com/) + [x] [Cohere](https://cohere.com/)
+ [x] [DeepSeek](https://www.deepseek.com/)
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。 2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
3. 支持通过**负载均衡**的方式访问多个渠道。 3. 支持通过**负载均衡**的方式访问多个渠道。
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。 4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。

View File

@ -0,0 +1,6 @@
package deepseek
var ModelList = []string{
"deepseek-chat",
"deepseek-coder",
}

View File

@ -3,6 +3,7 @@ package openai
import ( import (
"github.com/songquanpeng/one-api/relay/adaptor/ai360" "github.com/songquanpeng/one-api/relay/adaptor/ai360"
"github.com/songquanpeng/one-api/relay/adaptor/baichuan" "github.com/songquanpeng/one-api/relay/adaptor/baichuan"
"github.com/songquanpeng/one-api/relay/adaptor/deepseek"
"github.com/songquanpeng/one-api/relay/adaptor/groq" "github.com/songquanpeng/one-api/relay/adaptor/groq"
"github.com/songquanpeng/one-api/relay/adaptor/lingyiwanwu" "github.com/songquanpeng/one-api/relay/adaptor/lingyiwanwu"
"github.com/songquanpeng/one-api/relay/adaptor/minimax" "github.com/songquanpeng/one-api/relay/adaptor/minimax"
@ -22,6 +23,7 @@ var CompatibleChannels = []int{
channeltype.Groq, channeltype.Groq,
channeltype.LingYiWanWu, channeltype.LingYiWanWu,
channeltype.StepFun, channeltype.StepFun,
channeltype.DeepSeek,
} }
func GetCompatibleChannelMeta(channelType int) (string, []string) { func GetCompatibleChannelMeta(channelType int) (string, []string) {
@ -44,6 +46,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
return "lingyiwanwu", lingyiwanwu.ModelList return "lingyiwanwu", lingyiwanwu.ModelList
case channeltype.StepFun: case channeltype.StepFun:
return "stepfun", stepfun.ModelList return "stepfun", stepfun.ModelList
case channeltype.DeepSeek:
return "deepseek", deepseek.ModelList
default: default:
return "openai", ModelList return "openai", ModelList
} }

View File

@ -170,6 +170,9 @@ var ModelRatio = map[string]float64{
"command-light-nightly": 0.5, "command-light-nightly": 0.5,
"command-r": 0.5 / 1000 * USD, "command-r": 0.5 / 1000 * USD,
"command-r-plus ": 3.0 / 1000 * USD, "command-r-plus ": 3.0 / 1000 * USD,
// https://platform.deepseek.com/api-docs/pricing/
"deepseek-chat": 1.0 / 1000 * RMB,
"deepseek-coder": 1.0 / 1000 * RMB,
} }
var CompletionRatio = map[string]float64{} var CompletionRatio = map[string]float64{}
@ -285,6 +288,9 @@ func GetCompletionRatio(name string) float64 {
if strings.HasPrefix(name, "gemini-") { if strings.HasPrefix(name, "gemini-") {
return 3 return 3
} }
if strings.HasPrefix(name, "deepseek-") {
return 2
}
switch name { switch name {
case "llama2-70b-4096": case "llama2-70b-4096":
return 0.8 / 0.64 return 0.8 / 0.64

View File

@ -37,6 +37,7 @@ const (
AwsClaude AwsClaude
Coze Coze
Cohere Cohere
DeepSeek
Dummy Dummy
) )

View File

@ -36,7 +36,8 @@ var ChannelBaseURLs = []string{
"https://api.stepfun.com", // 32 "https://api.stepfun.com", // 32
"", // 33 "", // 33
"https://api.coze.com", // 34 "https://api.coze.com", // 34
"https://api.cohere.ai", //35 "https://api.cohere.ai", // 35
"https://api.deepseek.com", // 36
} }
func init() { func init() {

View File

@ -131,6 +131,12 @@ export const CHANNEL_OPTIONS = {
value: 35, value: 35,
color: 'primary' color: 'primary'
}, },
36: {
key: 36,
text: 'DeepSeek',
value: 36,
color: 'primary'
},
8: { 8: {
key: 8, key: 8,
text: '自定义渠道', text: '自定义渠道',

View File

@ -21,6 +21,7 @@ export const CHANNEL_OPTIONS = [
{ key: 32, text: '阶跃星辰', value: 32, color: 'blue' }, { key: 32, text: '阶跃星辰', value: 32, color: 'blue' },
{ key: 34, text: 'Coze', value: 34, color: 'blue' }, { key: 34, text: 'Coze', value: 34, color: 'blue' },
{ key: 35, text: 'Cohere', value: 35, color: 'blue' }, { key: 35, text: 'Cohere', value: 35, color: 'blue' },
{ key: 36, text: 'DeepSeek', value: 36, color: 'black' },
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' }, { key: 8, text: '自定义渠道', value: 8, color: 'pink' },
{ key: 22, text: '知识库FastGPT', value: 22, color: 'blue' }, { key: 22, text: '知识库FastGPT', value: 22, color: 'blue' },
{ key: 21, text: '知识库AI Proxy', value: 21, color: 'purple' }, { key: 21, text: '知识库AI Proxy', value: 21, color: 'purple' },