Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d2bafda6
authored
May 16, 2024
by
Calcium-Ion
Committed by
GitHub
May 16, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #259 from jimmyshjj/original
Add Baidu Default Behavior and Updating Baidu&360 Models & Prices
parents
191fe6ea
69108aa0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
8 deletions
+56
-8
common/model-ratio.go
+23
-3
relay/channel/ai360/constants.go
+3
-0
relay/channel/baidu/adaptor.go
+17
-0
relay/channel/baidu/constants.go
+13
-5
No files found.
common/model-ratio.go
View file @
d2bafda6
...
...
@@ -69,9 +69,17 @@ var DefaultModelRatio = map[string]float64{
"claude-3-haiku-20240307"
:
0.125
,
// $0.25 / 1M tokens
"claude-3-sonnet-20240229"
:
1.5
,
// $3 / 1M tokens
"claude-3-opus-20240229"
:
7.5
,
// $15 / 1M tokens
"ERNIE-Bot"
:
0.8572
,
// ¥0.012 / 1k tokens
"ERNIE-Bot-turbo"
:
0.5715
,
// ¥0.008 / 1k tokens
"ERNIE-Bot-4"
:
8.572
,
// ¥0.12 / 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 //renamed to ERNIE-Lite-8K
"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
"PaLM-2"
:
1
,
"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.5"
:
1.2858
,
// ¥0.018 / 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_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"
)
{
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
{
case
"llama2-70b-4096"
:
return
0.8
/
0.64
...
...
relay/channel/ai360/constants.go
View file @
d2bafda6
package
ai360
var
ModelList
=
[]
string
{
"360gpt-turbo"
,
"360gpt-turbo-responsibility-8k"
,
"360gpt-pro"
,
"360GPT_S2_V9"
,
"embedding-bert-512-v1"
,
"embedding_s1_v1"
,
...
...
relay/channel/baidu/adaptor.go
View file @
d2bafda6
...
...
@@ -9,6 +9,7 @@ import (
"one-api/relay/channel"
relaycommon
"one-api/relay/common"
"one-api/relay/constant"
"strings"
)
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"
case
"BLOOMZ-7B"
:
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"
:
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
err
error
...
...
relay/channel/baidu/constants.go
View file @
d2bafda6
package
baidu
var
ModelList
=
[]
string
{
"ERNIE-Bot-4"
,
"ERNIE-Bot-8K"
,
"ERNIE-Bot"
,
"ERNIE-Speed"
,
"ERNIE-Bot-turbo"
,
"ERNIE-3.5-8K"
,
"ERNIE-4.0-8K"
,
"ERNIE-Speed-8K"
,
"ERNIE-Speed-128K"
,
"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"
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment