From 3cf5ec9e6f0962902ab68309937506ba19f3f92d Mon Sep 17 00:00:00 2001 From: ManJieqi <363071559@139.com> Date: Mon, 1 Apr 2024 20:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=99=BE=E5=BA=A6=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8D=E7=A7=B0=EF=BC=8C=E5=B9=B6=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=97=A7=E7=89=88=E5=85=BC=E5=AE=B9=E4=BB=A5=E5=8F=8A=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E5=8D=95=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/model-ratio.go | 28 +++++++++++++++++----------- relay/channel/baidu/adaptor.go | 12 ++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/common/model-ratio.go b/common/model-ratio.go index eb8b9e3d..24ff6c5f 100644 --- a/common/model-ratio.go +++ b/common/model-ratio.go @@ -72,17 +72,23 @@ var ModelRatio = map[string]float64{ "claude-3-sonnet-20240229": 3.0 / 1000 * USD, "claude-3-opus-20240229": 15.0 / 1000 * USD, // https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7 - "ERNIE-4.0-8K": 0.150 * RMB, - "ERNIE-3.5-8K": 0.012 * RMB, - "ERNIE-Speed-8K": 0.004 * RMB, - "ERNIE-Speed-128K":0.004 * RMB, - "ERNIE-Lite-8K": 0.003 * RMB, - "ERNIE-Tiny-8K": 0.001 * RMB, - "BLOOMZ-7B": 0.004 * RMB, - "Embedding-V1": 0.002 * RMB, - "bge-large-zh": 0.002 * RMB, - "bge-large-en": 0.002 * RMB, - "tao-8k": 0.002 * RMB, + "ERNIE-4.0": 0.120 * RMB, //旧版兼容 使用completions_pro 等同于ERNIE-4.0-8K + "ERNIE-Bot-4": 0.120 * RMB, //旧版兼容 使用completions_pro 等同于ERNIE-4.0-8K + "ERNIE-Bot": 0.012 * RMB, //旧版兼容 使用completions 等同于ERNIE-3.5-8K + "ERNIE-Bot-turbo": 0.003 * RMB, //旧版兼容 使用eb-instant 等同于ERNIE-Lite-8K + "ERNIE-Bot-8K": 0.024 * RMB, //即将弃用 使用ernie_bot_8k + + "ERNIE-4.0-8K": 0.120 * RMB, + "ERNIE-3.5-8K": 0.012 * RMB, + "ERNIE-Speed-8K": 0.004 * RMB, + "ERNIE-Speed-128K": 0.004 * RMB, + "ERNIE-Lite-8K": 0.003 * RMB, + "ERNIE-Tiny-8K": 0.001 * RMB, + "BLOOMZ-7B": 0.004 * RMB, + "Embedding-V1": 0.002 * RMB, + "bge-large-zh": 0.002 * RMB, + "bge-large-en": 0.002 * RMB, + "tao-8k": 0.002 * RMB, // https://ai.google.dev/pricing "PaLM-2": 1, "gemini-pro": 1, // $0.00025 / 1k characters -> $0.001 / 1k tokens diff --git a/relay/channel/baidu/adaptor.go b/relay/channel/baidu/adaptor.go index 7e898aa2..d9b7aafa 100644 --- a/relay/channel/baidu/adaptor.go +++ b/relay/channel/baidu/adaptor.go @@ -34,6 +34,18 @@ func (a *Adaptor) GetRequestURL(meta *util.RelayMeta) (string, error) { suffix = "embeddings/" } switch meta.ActualModelName { + case "ERNIE-4.0": + suffix += "completions_pro" //旧版兼容 + case "ERNIE-Bot-4": + suffix += "completions_pro" //旧版兼容 + case "ERNIE-Bot": + suffix += "completions" //旧版兼容 + case "ERNIE-Bot-turbo": + suffix += "eb-instant" //旧版兼容 + case "ERNIE-Speed": + suffix += "ernie_speed" //旧版兼容 + case "ERNIE-Bot-8K": + suffix += "ernie_bot_8k" //即将弃用 case "ERNIE-4.0-8K": suffix += "completions_pro" case "ERNIE-3.5-8K":