Documentation
¶
Index ¶
- Constants
- Variables
- func AudioCompletionRatio2JSONString() string
- func AudioRatio2JSONString() string
- func CacheRatio2JSONString() string
- func CheckGroupRatio(jsonStr string) error
- func CompletionRatio2JSONString() string
- func ContainsAudioCompletionRatio(name string) bool
- func ContainsAudioRatio(name string) bool
- func ContainsGroupRatio(name string) bool
- func DefaultModelRatio2JSONString() string
- func FormatMatchingModelName(name string) string
- func GetAudioCompletionRatio(name string) float64
- func GetAudioRatio(name string) float64
- func GetCacheRatio(name string) (float64, bool)
- func GetCacheRatioCopy() map[string]float64
- func GetCacheRatioMap() map[string]float64
- func GetCompletionRatio(name string) float64
- func GetCompletionRatioCopy() map[string]float64
- func GetCompletionRatioMap() map[string]float64
- func GetCreateCacheRatio(name string) (float64, bool)
- func GetDefaultAudioCompletionRatioMap() map[string]float64
- func GetDefaultAudioRatioMap() map[string]float64
- func GetDefaultImageRatioMap() map[string]float64
- func GetDefaultModelPriceMap() map[string]float64
- func GetDefaultModelRatioMap() map[string]float64
- func GetExposedData() gin.H
- func GetGroupGroupRatio(userGroup, usingGroup string) (float64, bool)
- func GetGroupRatio(name string) float64
- func GetGroupRatioCopy() map[string]float64
- func GetImageRatio(name string) (float64, bool)
- func GetModelPrice(name string, printErr bool) (float64, bool)
- func GetModelPriceCopy() map[string]float64
- func GetModelPriceMap() map[string]float64
- func GetModelRatio(name string) (float64, bool, string)
- func GetModelRatioCopy() map[string]float64
- func GetModelRatioOrPrice(model string) (float64, bool, bool)
- func GroupGroupRatio2JSONString() string
- func GroupRatio2JSONString() string
- func ImageRatio2JSONString() string
- func InitRatioSettings()
- func InvalidateExposedDataCache()
- func IsExposeRatioEnabled() bool
- func ModelPrice2JSONString() string
- func ModelRatio2JSONString() string
- func SetExposeRatioEnabled(enabled bool)
- func UpdateAudioCompletionRatioByJSONString(jsonStr string) error
- func UpdateAudioRatioByJSONString(jsonStr string) error
- func UpdateCacheRatioByJSONString(jsonStr string) error
- func UpdateCompletionRatioByJSONString(jsonStr string) error
- func UpdateGroupGroupRatioByJSONString(jsonStr string) error
- func UpdateGroupRatioByJSONString(jsonStr string) error
- func UpdateImageRatioByJSONString(jsonStr string) error
- func UpdateModelPriceByJSONString(jsonStr string) error
- func UpdateModelRatioByJSONString(jsonStr string) error
- func WithCompactModelSuffix(modelName string) string
- type GroupRatioSetting
Constants ¶
View Source
const ( USD2RMB = 7.3 // 暂定 1 USD = 7.3 RMB USD = 500 // $0.002 = 1 -> $1 = 500 RMB = USD / USD2RMB )
from songquanpeng/one-api
View Source
const CompactModelSuffix = "-openai-compact"
View Source
const CompactWildcardModelKey = "*" + CompactModelSuffix
Variables ¶
View Source
var (
GroupGroupRatio = map[string]map[string]float64{
"vip": {
"edit_this": 0.9,
},
}
)
Functions ¶
func AudioCompletionRatio2JSONString ¶
func AudioCompletionRatio2JSONString() string
func AudioRatio2JSONString ¶
func AudioRatio2JSONString() string
func CacheRatio2JSONString ¶
func CacheRatio2JSONString() string
CacheRatio2JSONString converts the cache ratio map to a JSON string
func CheckGroupRatio ¶
func CompletionRatio2JSONString ¶
func CompletionRatio2JSONString() string
func ContainsAudioRatio ¶
func ContainsGroupRatio ¶
func DefaultModelRatio2JSONString ¶
func DefaultModelRatio2JSONString() string
func FormatMatchingModelName ¶
转换模型名,减少渠道必须配置各种带参数模型
func GetAudioCompletionRatio ¶
func GetAudioRatio ¶
func GetCacheRatio ¶
GetCacheRatio returns the cache ratio for a model
func GetCacheRatioCopy ¶
func GetCacheRatioMap ¶
GetCacheRatioMap returns the cache ratio map
func GetCompletionRatio ¶
func GetCompletionRatioCopy ¶
func GetCompletionRatioMap ¶
func GetCreateCacheRatio ¶
func GetDefaultAudioRatioMap ¶
func GetDefaultImageRatioMap ¶
func GetDefaultModelPriceMap ¶
func GetDefaultModelRatioMap ¶
func GetExposedData ¶
func GetGroupGroupRatio ¶
func GetGroupRatio ¶
func GetGroupRatioCopy ¶
func GetImageRatio ¶
func GetModelPrice ¶
GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false
func GetModelPriceCopy ¶
func GetModelPriceMap ¶
func GetModelRatioCopy ¶
func GetModelRatioOrPrice ¶
result: 倍率or价格, usePrice, exist
func GroupGroupRatio2JSONString ¶
func GroupGroupRatio2JSONString() string
func GroupRatio2JSONString ¶
func GroupRatio2JSONString() string
func ImageRatio2JSONString ¶
func ImageRatio2JSONString() string
func InitRatioSettings ¶
func InitRatioSettings()
InitRatioSettings initializes all model related settings maps
func InvalidateExposedDataCache ¶
func InvalidateExposedDataCache()
func IsExposeRatioEnabled ¶
func IsExposeRatioEnabled() bool
func ModelPrice2JSONString ¶
func ModelPrice2JSONString() string
func ModelRatio2JSONString ¶
func ModelRatio2JSONString() string
func SetExposeRatioEnabled ¶
func SetExposeRatioEnabled(enabled bool)
func UpdateCacheRatioByJSONString ¶
UpdateCacheRatioByJSONString updates the cache ratio map from a JSON string
func WithCompactModelSuffix ¶
Types ¶
type GroupRatioSetting ¶
type GroupRatioSetting struct {
GroupRatio map[string]float64 `json:"group_ratio"`
GroupGroupRatio map[string]map[string]float64 `json:"group_group_ratio"`
GroupSpecialUsableGroup *types.RWMap[string, map[string]string] `json:"group_special_usable_group"`
}
func GetGroupRatioSetting ¶
func GetGroupRatioSetting() *GroupRatioSetting
Click to show internal directories.
Click to hide internal directories.