From b11c3e0a7ecf6398a726352b5506390760df58ba Mon Sep 17 00:00:00 2001 From: JustSong Date: Wed, 24 Apr 2024 21:49:38 +0800 Subject: [PATCH] chore: tiny improvements --- README.md | 1 + relay/adaptor/cohere/adaptor.go | 6 ++---- relay/adaptor/cohere/constant.go | 6 +++++- relay/billing/ratio/model.go | 8 ++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0ab35893..2f81c10d 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 + [x] [零一万物](https://platform.lingyiwanwu.com/) + [x] [阶跃星辰](https://platform.stepfun.com/) + [x] [Coze](https://www.coze.com/) + + [x] [Cohere](https://cohere.com/) 2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。 3. 支持通过**负载均衡**的方式访问多个渠道。 4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。 diff --git a/relay/adaptor/cohere/adaptor.go b/relay/adaptor/cohere/adaptor.go index bb17eea0..6fdb1b04 100644 --- a/relay/adaptor/cohere/adaptor.go +++ b/relay/adaptor/cohere/adaptor.go @@ -7,7 +7,6 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/songquanpeng/one-api/common/logger" "github.com/songquanpeng/one-api/relay/adaptor" "github.com/songquanpeng/one-api/relay/meta" "github.com/songquanpeng/one-api/relay/model" @@ -17,7 +16,7 @@ type Adaptor struct{} // ConvertImageRequest implements adaptor.Adaptor. func (*Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error) { - panic("unimplemented") + return nil, errors.New("not implemented") } // ConvertImageRequest implements adaptor.Adaptor. @@ -32,8 +31,7 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) { func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error { adaptor.SetupCommonRequestHeader(c, req, meta) - logger.SysLog(meta.APIKey) - req.Header.Set("Authorization", "bearer "+meta.APIKey) + req.Header.Set("Authorization", "Bearer "+meta.APIKey) return nil } diff --git a/relay/adaptor/cohere/constant.go b/relay/adaptor/cohere/constant.go index 743b87a2..3ff4d655 100644 --- a/relay/adaptor/cohere/constant.go +++ b/relay/adaptor/cohere/constant.go @@ -1,3 +1,7 @@ package cohere -var ModelList = []string{"command", "command-light", "command-nightly", "command-light-nightly", "command-r", "command-r-plus"} +var ModelList = []string{ + "command", "command-nightly", + "command-light", "command-light-nightly", + "command-r", "command-r-plus", +} diff --git a/relay/billing/ratio/model.go b/relay/billing/ratio/model.go index 12f3f9e0..923d9c4f 100644 --- a/relay/billing/ratio/model.go +++ b/relay/billing/ratio/model.go @@ -163,13 +163,13 @@ var ModelRatio = map[string]float64{ "step-1v-32k": 0.024 * RMB, "step-1-32k": 0.024 * RMB, "step-1-200k": 0.15 * RMB, - //https://cohere.com/pricing command系列没有给出定价 所以采用的openrouter的标准 + // https://cohere.com/pricing "command": 0.5, - "command-light": 0.5, "command-nightly": 0.5, + "command-light": 0.5, "command-light-nightly": 0.5, - "command-r": 0.25, - "command-r-plus ": 1.5, + "command-r": 0.5 / 1000 * USD, + "command-r-plus ": 3.0 / 1000 * USD, } var CompletionRatio = map[string]float64{}