feat: add cohere support (#1355)

* support cohere

* chore: tiny improvements

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
Ghostz
2024-04-24 21:50:01 +08:00
committed by GitHub
parent cb33e8aad5
commit 24f026d18e
12 changed files with 476 additions and 1 deletions

View File

@@ -2,8 +2,9 @@ package ratio
import (
"encoding/json"
"github.com/songquanpeng/one-api/common/logger"
"strings"
"github.com/songquanpeng/one-api/common/logger"
)
const (
@@ -162,6 +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": 0.5,
"command-nightly": 0.5,
"command-light": 0.5,
"command-light-nightly": 0.5,
"command-r": 0.5 / 1000 * USD,
"command-r-plus ": 3.0 / 1000 * USD,
}
var CompletionRatio = map[string]float64{}
@@ -284,6 +292,12 @@ func GetCompletionRatio(name string) float64 {
return 2
case "llama3-70b-8192":
return 0.79 / 0.59
case "command", "command-light", "command-nightly", "command-light-nightly":
return 2
case "command-r":
return 3
case "command-r-plus":
return 5
}
return 1
}