mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-19 00:46:37 +08:00
Merge pull request #259 from jimmyshjj/original
Add Baidu Default Behavior and Updating Baidu&360 Models & Prices
This commit is contained in:
commit
55962acf7c
@ -69,9 +69,17 @@ var DefaultModelRatio = map[string]float64{
|
|||||||
"claude-3-haiku-20240307": 0.125, // $0.25 / 1M tokens
|
"claude-3-haiku-20240307": 0.125, // $0.25 / 1M tokens
|
||||||
"claude-3-sonnet-20240229": 1.5, // $3 / 1M tokens
|
"claude-3-sonnet-20240229": 1.5, // $3 / 1M tokens
|
||||||
"claude-3-opus-20240229": 7.5, // $15 / 1M tokens
|
"claude-3-opus-20240229": 7.5, // $15 / 1M tokens
|
||||||
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens
|
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens //renamed to ERNIE-3.5-8K
|
||||||
"ERNIE-Bot-turbo": 0.5715, // ¥0.008 / 1k tokens
|
"ERNIE-Bot-turbo": 0.5715, // ¥0.008 / 1k tokens //renamed to ERNIE-Lite-8K
|
||||||
"ERNIE-Bot-4": 8.572, // ¥0.12 / 1k tokens
|
"ERNIE-Bot-4": 8.572, // ¥0.12 / 1k tokens //renamed to ERNIE-4.0-8K
|
||||||
|
"ERNIE-4.0-8K": 8.572, // ¥0.12 / 1k tokens
|
||||||
|
"ERNIE-3.5-8K": 0.8572, // ¥0.012 / 1k tokens
|
||||||
|
"ERNIE-Speed-8K": 0.2858, // ¥0.004 / 1k tokens
|
||||||
|
"ERNIE-Speed-128K": 0.2858, // ¥0.004 / 1k tokens
|
||||||
|
"ERNIE-Lite-8K": 0.2143, // ¥0.003 / 1k tokens
|
||||||
|
"ERNIE-Tiny-8K": 0.0715, // ¥0.001 / 1k tokens
|
||||||
|
"ERNIE-Character-8K": 0.2858, // ¥0.004 / 1k tokens
|
||||||
|
"ERNIE-Functions-8K": 0.2858, // ¥0.004 / 1k tokens
|
||||||
"Embedding-V1": 0.1429, // ¥0.002 / 1k tokens
|
"Embedding-V1": 0.1429, // ¥0.002 / 1k tokens
|
||||||
"PaLM-2": 1,
|
"PaLM-2": 1,
|
||||||
"gemini-pro": 1, // $0.00025 / 1k characters -> $0.001 / 1k tokens
|
"gemini-pro": 1, // $0.00025 / 1k characters -> $0.001 / 1k tokens
|
||||||
@ -98,6 +106,9 @@ var DefaultModelRatio = map[string]float64{
|
|||||||
"SparkDesk-v3.1": 1.2858, // ¥0.018 / 1k tokens
|
"SparkDesk-v3.1": 1.2858, // ¥0.018 / 1k tokens
|
||||||
"SparkDesk-v3.5": 1.2858, // ¥0.018 / 1k tokens
|
"SparkDesk-v3.5": 1.2858, // ¥0.018 / 1k tokens
|
||||||
"360GPT_S2_V9": 0.8572, // ¥0.012 / 1k tokens
|
"360GPT_S2_V9": 0.8572, // ¥0.012 / 1k tokens
|
||||||
|
"360gpt-turbo": 0.0858, // ¥0.0012 / 1k tokens
|
||||||
|
"360gpt-turbo-responsibility-8k": 0.8572, // ¥0.012 / 1k tokens
|
||||||
|
"360gpt-pro": 0.8572, // ¥0.012 / 1k tokens
|
||||||
"embedding-bert-512-v1": 0.0715, // ¥0.001 / 1k tokens
|
"embedding-bert-512-v1": 0.0715, // ¥0.001 / 1k tokens
|
||||||
"embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
"embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
||||||
"semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
"semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens
|
||||||
@ -289,6 +300,15 @@ func GetCompletionRatio(name string) float64 {
|
|||||||
if strings.HasPrefix(name, "deepseek") {
|
if strings.HasPrefix(name, "deepseek") {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(name, "ERNIE-Speed-") {
|
||||||
|
return 2
|
||||||
|
} else if strings.HasPrefix(name, "ERNIE-Lite-") {
|
||||||
|
return 2
|
||||||
|
} else if strings.HasPrefix(name, "ERNIE-Character") {
|
||||||
|
return 2
|
||||||
|
} else if strings.HasPrefix(name, "ERNIE-Functions") {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
switch name {
|
switch name {
|
||||||
case "llama2-70b-4096":
|
case "llama2-70b-4096":
|
||||||
return 0.8 / 0.64
|
return 0.8 / 0.64
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package ai360
|
package ai360
|
||||||
|
|
||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
|
"360gpt-turbo",
|
||||||
|
"360gpt-turbo-responsibility-8k",
|
||||||
|
"360gpt-pro",
|
||||||
"360GPT_S2_V9",
|
"360GPT_S2_V9",
|
||||||
"embedding-bert-512-v1",
|
"embedding-bert-512-v1",
|
||||||
"embedding_s1_v1",
|
"embedding_s1_v1",
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"one-api/relay/channel"
|
"one-api/relay/channel"
|
||||||
relaycommon "one-api/relay/common"
|
relaycommon "one-api/relay/common"
|
||||||
"one-api/relay/constant"
|
"one-api/relay/constant"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Adaptor struct {
|
type Adaptor struct {
|
||||||
@ -33,8 +34,24 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|||||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant"
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant"
|
||||||
case "BLOOMZ-7B":
|
case "BLOOMZ-7B":
|
||||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/bloomz_7b1"
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/bloomz_7b1"
|
||||||
|
case "ERNIE-4.0-8K":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro"
|
||||||
|
case "ERNIE-3.5-8K":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions"
|
||||||
|
case "ERNIE-Speed-8K":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_speed"
|
||||||
|
case "ERNIE-Character-8K":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-char-8k"
|
||||||
|
case "ERNIE-Functions-8K":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-func-8k"
|
||||||
|
case "ERNIE-Lite-8K-0922":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant"
|
||||||
|
case "Yi-34B-Chat":
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/yi_34b_chat"
|
||||||
case "Embedding-V1":
|
case "Embedding-V1":
|
||||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/embeddings/embedding-v1"
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/embeddings/embedding-v1"
|
||||||
|
default:
|
||||||
|
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/" + strings.ToLower(info.UpstreamModelName)
|
||||||
}
|
}
|
||||||
var accessToken string
|
var accessToken string
|
||||||
var err error
|
var err error
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
package baidu
|
package baidu
|
||||||
|
|
||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
"ERNIE-Bot-4",
|
"ERNIE-3.5-8K",
|
||||||
"ERNIE-Bot-8K",
|
"ERNIE-4.0-8K",
|
||||||
"ERNIE-Bot",
|
"ERNIE-Speed-8K",
|
||||||
"ERNIE-Speed",
|
"ERNIE-Speed-128K",
|
||||||
"ERNIE-Bot-turbo",
|
"ERNIE-Lite-8K",
|
||||||
|
"ERNIE-Tiny-8K",
|
||||||
|
"ERNIE-Character-8K",
|
||||||
|
"ERNIE-Functions-8K",
|
||||||
|
//"ERNIE-Bot-4",
|
||||||
|
//"ERNIE-Bot-8K",
|
||||||
|
//"ERNIE-Bot",
|
||||||
|
//"ERNIE-Speed",
|
||||||
|
//"ERNIE-Bot-turbo",
|
||||||
"Embedding-V1",
|
"Embedding-V1",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user