✨ feat: support moonshot (#63)
This commit is contained in:
parent
6f3b8ed997
commit
3789c30154
@ -192,6 +192,7 @@ const (
|
|||||||
ChannelTypeBaichuan = 26
|
ChannelTypeBaichuan = 26
|
||||||
ChannelTypeMiniMax = 27
|
ChannelTypeMiniMax = 27
|
||||||
ChannelTypeDeepseek = 28
|
ChannelTypeDeepseek = 28
|
||||||
|
ChannelTypeMoonshot = 29
|
||||||
)
|
)
|
||||||
|
|
||||||
var ChannelBaseURLs = []string{
|
var ChannelBaseURLs = []string{
|
||||||
@ -224,6 +225,7 @@ var ChannelBaseURLs = []string{
|
|||||||
"https://api.baichuan-ai.com", //26
|
"https://api.baichuan-ai.com", //26
|
||||||
"https://api.minimax.chat/v1", //27
|
"https://api.minimax.chat/v1", //27
|
||||||
"https://api.deepseek.com", //28
|
"https://api.deepseek.com", //28
|
||||||
|
"https://api.moonshot.cn", //29
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -110,6 +110,9 @@ func init() {
|
|||||||
"embo-01": {0.0357, ChannelTypeMiniMax}, // ¥0.0005 / 1k tokens
|
"embo-01": {0.0357, ChannelTypeMiniMax}, // ¥0.0005 / 1k tokens
|
||||||
"deepseek-coder": {0.75, ChannelTypeDeepseek}, // 暂定 $0.0015 / 1K tokens
|
"deepseek-coder": {0.75, ChannelTypeDeepseek}, // 暂定 $0.0015 / 1K tokens
|
||||||
"deepseek-chat": {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)
|
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,
|
value: 28,
|
||||||
color: 'default'
|
color: 'default'
|
||||||
},
|
},
|
||||||
|
29: {
|
||||||
|
key: 29,
|
||||||
|
text: 'Moonshot',
|
||||||
|
value: 29,
|
||||||
|
color: 'default'
|
||||||
|
},
|
||||||
24: {
|
24: {
|
||||||
key: 24,
|
key: 24,
|
||||||
text: 'Azure Speech',
|
text: 'Azure Speech',
|
||||||
|
@ -181,6 +181,12 @@ const typeConfig = {
|
|||||||
models: ['deepseek-coder', 'deepseek-chat'],
|
models: ['deepseek-coder', 'deepseek-chat'],
|
||||||
test_model: '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