mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-02 16:32:14 +00:00
fix(pricing): add image cache pricing field
This commit is contained in:
1 parent
eacff0a629
commit
fa565eafb1
1 file changed
+5
@@ -155,6 +155,7 @@ type LiteLLMModelPricing struct {
|
|||||||
OutputCostPerImage float64 `json:"output_cost_per_image"` // 图片生成模型每张图片价格
|
OutputCostPerImage float64 `json:"output_cost_per_image"` // 图片生成模型每张图片价格
|
||||||
OutputCostPerImageToken float64 `json:"output_cost_per_image_token"` // 图片输出 token 价格
|
OutputCostPerImageToken float64 `json:"output_cost_per_image_token"` // 图片输出 token 价格
|
||||||
InputCostPerImageToken float64 `json:"input_cost_per_image_token"` // 图片输入 token 价格(如 gpt-image-2 图片编辑)
|
InputCostPerImageToken float64 `json:"input_cost_per_image_token"` // 图片输入 token 价格(如 gpt-image-2 图片编辑)
|
||||||
|
CacheReadInputImageTokenCost float64 `json:"cache_read_input_image_token_cost"`
|
||||||
|
|
||||||
// TokenPricingAbsent 表示源数据中 input/output token 价格均缺失(仅有图片价)。
|
// TokenPricingAbsent 表示源数据中 input/output token 价格均缺失(仅有图片价)。
|
||||||
// 此类条目只可用于图片计费,token 计费必须回退到 fallback 或 fail-closed,
|
// 此类条目只可用于图片计费,token 计费必须回退到 fallback 或 fail-closed,
|
||||||
@@ -189,6 +190,7 @@ type LiteLLMRawEntry struct {
|
|||||||
OutputCostPerImage *float64 `json:"output_cost_per_image"`
|
OutputCostPerImage *float64 `json:"output_cost_per_image"`
|
||||||
OutputCostPerImageToken *float64 `json:"output_cost_per_image_token"`
|
OutputCostPerImageToken *float64 `json:"output_cost_per_image_token"`
|
||||||
InputCostPerImageToken *float64 `json:"input_cost_per_image_token"`
|
InputCostPerImageToken *float64 `json:"input_cost_per_image_token"`
|
||||||
|
CacheReadInputImageTokenCost *float64 `json:"cache_read_input_image_token_cost"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PricingService 动态价格服务
|
// PricingService 动态价格服务
|
||||||
@@ -657,6 +659,9 @@ func (s *PricingService) parsePricingData(body []byte) (map[string]*LiteLLMModel
|
|||||||
if entry.InputCostPerImageToken != nil {
|
if entry.InputCostPerImageToken != nil {
|
||||||
pricing.InputCostPerImageToken = *entry.InputCostPerImageToken
|
pricing.InputCostPerImageToken = *entry.InputCostPerImageToken
|
||||||
}
|
}
|
||||||
|
if entry.CacheReadInputImageTokenCost != nil {
|
||||||
|
pricing.CacheReadInputImageTokenCost = *entry.CacheReadInputImageTokenCost
|
||||||
|
}
|
||||||
|
|
||||||
hasExplicitLongContext := entry.LongContextInputTokenThreshold != nil ||
|
hasExplicitLongContext := entry.LongContextInputTokenThreshold != nil ||
|
||||||
entry.LongContextInputCostMultiplier != nil ||
|
entry.LongContextInputCostMultiplier != nil ||
|
||||||
|
|||||||
Reference in new issue
Block a user