feat: support baidu's models now (close #286)

This commit is contained in:
JustSong
2023-07-22 23:24:09 +08:00
parent 3c940113ab
commit 9a1db61675
7 changed files with 268 additions and 2 deletions

View File

@@ -152,6 +152,7 @@ const (
ChannelTypeAPI2GPT = 12
ChannelTypeAIGC2D = 13
ChannelTypeAnthropic = 14
ChannelTypeBaidu = 15
)
var ChannelBaseURLs = []string{
@@ -170,4 +171,5 @@ var ChannelBaseURLs = []string{
"https://api.api2gpt.com", // 12
"https://api.aigc2d.com", // 13
"https://api.anthropic.com", // 14
"https://aip.baidubce.com", // 15
}

View File

@@ -4,6 +4,7 @@ import "encoding/json"
// ModelRatio
// https://platform.openai.com/docs/models/model-endpoint-compatibility
// https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Blfmc9dlf
// https://openai.com/pricing
// TODO: when a new api is enabled, check the pricing here
// 1 === $0.002 / 1K tokens
@@ -38,6 +39,8 @@ var ModelRatio = map[string]float64{
"dall-e": 8,
"claude-instant-1": 0.75,
"claude-2": 30,
"ERNIE-Bot": 1, // 0.012元/千tokens
"ERNIE-Bot-turbo": 0.67, // 0.008元/千tokens
}
func ModelRatio2JSONString() string {