refactor: add GetRatio to Adaptor

This commit is contained in:
WqyJh
2025-01-14 14:38:26 +08:00
parent 3915ce9814
commit 0ad609ade6
70 changed files with 1038 additions and 467 deletions

View File

@@ -1,14 +1,19 @@
package cohere
var ModelList = []string{
"command", "command-nightly",
"command-light", "command-light-nightly",
"command-r", "command-r-plus",
}
import "github.com/songquanpeng/one-api/relay/billing/ratio"
func init() {
num := len(ModelList)
for i := 0; i < num; i++ {
ModelList = append(ModelList, ModelList[i]+"-internet")
}
// https://cohere.com/pricing
var RatioMap = map[string]ratio.Ratio{
"command": {Input: 1 * ratio.MILLI_USD, Output: 2 * ratio.MILLI_USD},
"command-internet": {Input: 1 * ratio.MILLI_USD, Output: 2 * ratio.MILLI_USD},
"command-nightly": {Input: 1 * ratio.MILLI_USD, Output: 2 * ratio.MILLI_USD},
"command-nightly-internet": {Input: 1 * ratio.MILLI_USD, Output: 2 * ratio.MILLI_USD},
"command-light": {Input: 0.3 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-light-internet": {Input: 0.3 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-light-nightly": {Input: 0.3 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-light-nightly-internet": {Input: 0.3 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-r": {Input: 0.15 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-r-internet": {Input: 0.15 * ratio.MILLI_USD, Output: 0.6 * ratio.MILLI_USD},
"command-r-plus": {Input: 2.5 * ratio.MILLI_USD, Output: 10 * ratio.MILLI_USD},
"command-r-plus-internet": {Input: 2.5 * ratio.MILLI_USD, Output: 10 * ratio.MILLI_USD},
}