mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-18 14:13:43 +08:00
🎨 Support Baichuan2
This commit is contained in:
@@ -189,6 +189,7 @@ const (
|
||||
ChannelTypeTencent = 23
|
||||
ChannelTypeAzureSpeech = 24
|
||||
ChannelTypeGemini = 25
|
||||
ChannelTypeBaichuan = 26
|
||||
)
|
||||
|
||||
var ChannelBaseURLs = []string{
|
||||
@@ -218,6 +219,7 @@ var ChannelBaseURLs = []string{
|
||||
"https://hunyuan.cloud.tencent.com", //23
|
||||
"", //24
|
||||
"", //25
|
||||
"https://api.baichuan-ai.com", //26
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -101,6 +101,10 @@ var ModelRatio = map[string]float64{
|
||||
"embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
||||
"semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
||||
"hunyuan": 7.143, // ¥0.1 / 1k tokens // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0
|
||||
"Baichuan2-Turbo": 0.5715, // ¥0.008 / 1k tokens
|
||||
"Baichuan2-Turbo-192k": 1.143, // ¥0.016 / 1k tokens
|
||||
"Baichuan2-53B": 1.4286, // ¥0.02 / 1k tokens
|
||||
"Baichuan-Text-Embedding": 0.0357, // ¥0.0005 / 1k tokens
|
||||
}
|
||||
|
||||
func ModelRatio2JSONString() string {
|
||||
|
||||
@@ -190,13 +190,13 @@ func countImageTokens(url string, detail string) (_ int, err error) {
|
||||
func CountTokenInput(input any, model string) int {
|
||||
switch v := input.(type) {
|
||||
case string:
|
||||
return CountTokenInput(v, model)
|
||||
return CountTokenText(v, model)
|
||||
case []string:
|
||||
text := ""
|
||||
for _, s := range v {
|
||||
text += s
|
||||
}
|
||||
return CountTokenInput(text, model)
|
||||
return CountTokenText(text, model)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user