fix(billing): 前台模型 - 支持火山方舟视频 Token 计费

This commit is contained in:
MasterChiefCN committed 2026-08-21 11:57:36 +08:00
1 parent 4dfc92817c
commit 851bec843f
6 files changed
+98 -18

No files matched your search

+3
View File
@@ -498,6 +498,9 @@ func (s *Service) newLogicalModelBillingOrder(userID string, task *model.Task, i
}
amount, err = creditAmount(logicalModel.UnitPriceMicrocredits, quantity, 10_000)
case "token":
if channelModel.Capability != capability || !supportsTokenBilling(capability, channelModel.Protocol) {
return nil, BadAuthRequest("当前供应线路不支持前台模型的 Token 计费方式")
}
pricing := &model.ChannelModel{InputTokenPriceMicrocredits: logicalModel.InputPriceMicrocredits, OutputTokenPriceMicrocredits: logicalModel.OutputPriceMicrocredits, CachedTokenPriceMicrocredits: logicalModel.CachedPriceMicrocredits}
amount, err = tokenEstimateAmount(pricing, tokenEstimate, 10_000)
quantity = tokenEstimate.InputTokens + tokenEstimate.OutputTokens