MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetModelPrice

Function GetModelPrice

setting/ratio_setting/model_ratio.go:333–351  ·  view source on GitHub ↗

GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false

(name string, printErr bool)

Source from the content-addressed store, hash-verified

331
332// GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false
333func GetModelPrice(name string, printErr bool) (float64, bool) {
334 modelPriceMapMutex.RLock()
335 defer modelPriceMapMutex.RUnlock()
336
337 if strings.HasPrefix(name, "gpt-4-gizmo") {
338 name = "gpt-4-gizmo-*"
339 }
340 if strings.HasPrefix(name, "gpt-4o-gizmo") {
341 name = "gpt-4o-gizmo-*"
342 }
343 price, ok := modelPriceMap[name]
344 if !ok {
345 if printErr {
346 common.SysError("model price not found: " + name)
347 }
348 return -1, false
349 }
350 return price, true
351}
352
353func UpdateModelRatioByJSONString(jsonStr string) error {
354 modelRatioMapMutex.Lock()

Callers 5

updatePricingFunction · 0.92
RelayTaskSubmitFunction · 0.92
ModelPriceHelperFunction · 0.92
ModelPriceHelperPerCallFunction · 0.92
ContainPriceOrRatioFunction · 0.92

Calls 1

SysErrorFunction · 0.92

Tested by

no test coverage detected