✨ feat: support moonshot (#63)
This commit is contained in:
parent
6f3b8ed997
commit
3789c30154
@ -192,6 +192,7 @@ const (
|
||||
ChannelTypeBaichuan = 26
|
||||
ChannelTypeMiniMax = 27
|
||||
ChannelTypeDeepseek = 28
|
||||
ChannelTypeMoonshot = 29
|
||||
)
|
||||
|
||||
var ChannelBaseURLs = []string{
|
||||
@ -224,6 +225,7 @@ var ChannelBaseURLs = []string{
|
||||
"https://api.baichuan-ai.com", //26
|
||||
"https://api.minimax.chat/v1", //27
|
||||
"https://api.deepseek.com", //28
|
||||
"https://api.moonshot.cn", //29
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -84,8 +84,8 @@ func init() {
|
||||
"chatglm_std": {0.3572, ChannelTypeZhipu}, // ¥0.005 / 1k tokens
|
||||
"chatglm_lite": {0.1429, ChannelTypeZhipu}, // ¥0.002 / 1k tokens
|
||||
"glm-3-turbo": {0.3572, ChannelTypeZhipu}, // ¥0.005 / 1k tokens
|
||||
"glm-4": {7.143, ChannelTypeZhipu}, // ¥0.1 / 1k tokens
|
||||
"glm-4v": {7.143, ChannelTypeZhipu}, // ¥0.1 / 1k tokens
|
||||
"glm-4": {7.143, ChannelTypeZhipu}, // ¥0.1 / 1k tokens
|
||||
"glm-4v": {7.143, ChannelTypeZhipu}, // ¥0.1 / 1k tokens
|
||||
"embedding-2": {0.0357, ChannelTypeZhipu}, // ¥0.0005 / 1k tokens
|
||||
"cogview-3": {17.8571, ChannelTypeZhipu}, // ¥0.25 / 1张图片
|
||||
"qwen-turbo": {0.5715, ChannelTypeAli}, // ¥0.008 / 1k tokens // https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing
|
||||
@ -110,6 +110,9 @@ func init() {
|
||||
"embo-01": {0.0357, ChannelTypeMiniMax}, // ¥0.0005 / 1k tokens
|
||||
"deepseek-coder": {0.75, ChannelTypeDeepseek}, // 暂定 $0.0015 / 1K tokens
|
||||
"deepseek-chat": {0.75, ChannelTypeDeepseek}, // 暂定 $0.0015 / 1K tokens
|
||||
"moonshot-v1-8k": {0.8572, ChannelTypeMoonshot}, // ¥0.012 / 1K tokens
|
||||
"moonshot-v1-32k": {1.7143, ChannelTypeMoonshot}, // ¥0.024 / 1K tokens
|
||||
"moonshot-v1-128k": {4.2857, ChannelTypeMoonshot}, // ¥0.06 / 1K tokens
|
||||
}
|
||||
|
||||
ModelRatio = make(map[string]float64)
|
||||
|
36
providers/moonshot/base.go
Normal file
36
providers/moonshot/base.go
Normal file
@ -0,0 +1,36 @@
|
||||
package moonshot
|
||||
|
||||
import (
|
||||
"one-api/common/requester"
|
||||
"one-api/model"
|
||||
"one-api/providers/base"
|
||||
"one-api/providers/openai"
|
||||
)
|
||||
|
||||
type MoonshotProviderFactory struct{}
|
||||
|
||||
// 创建 MoonshotProvider
|
||||
func (f MoonshotProviderFactory) Create(channel *model.Channel) base.ProviderInterface {
|
||||
config := getMoonshotConfig()
|
||||
return &MoonshotProvider{
|
||||
OpenAIProvider: openai.OpenAIProvider{
|
||||
BaseProvider: base.BaseProvider{
|
||||
Config: config,
|
||||
Channel: channel,
|
||||
Requester: requester.NewHTTPRequester(*channel.Proxy, openai.RequestErrorHandle),
|
||||
},
|
||||
BalanceAction: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getMoonshotConfig() base.ProviderConfig {
|
||||
return base.ProviderConfig{
|
||||
BaseURL: "https://api.moonshot.cn",
|
||||
ChatCompletions: "/v1/chat/completions",
|
||||
}
|
||||
}
|
||||
|
||||
type MoonshotProvider struct {
|
||||
openai.OpenAIProvider
|
||||
}
|
@ -83,6 +83,12 @@ export const CHANNEL_OPTIONS = {
|
||||
value: 28,
|
||||
color: 'default'
|
||||
},
|
||||
29: {
|
||||
key: 29,
|
||||
text: 'Moonshot',
|
||||
value: 29,
|
||||
color: 'default'
|
||||
},
|
||||
24: {
|
||||
key: 24,
|
||||
text: 'Azure Speech',
|
||||
|
@ -181,6 +181,12 @@ const typeConfig = {
|
||||
models: ['deepseek-coder', 'deepseek-chat'],
|
||||
test_model: 'deepseek-chat'
|
||||
}
|
||||
},
|
||||
29: {
|
||||
input: {
|
||||
models: ['moonshot-v1-8k', 'moonshot-v1-16k', 'moonshot-v1-128k'],
|
||||
test_model: 'moonshot-v1-8k'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user