fix: prompt calculation

User will correctly get estimated prompt usage when upstream returns either zero or nothing.
This commit is contained in:
funnycups authored and GitHub committed 2025-08-16 22:54:00 +08:00
1 parent 14ea270406
commit 2f176cff7f
2 files changed
+12 -6

No files matched your search

+2
View File
@@ -128,6 +128,8 @@ func Relay(c *gin.Context, relayFormat types.RelayFormat) {
return
}
relayInfo.SetPromptTokens(tokens)
priceData, err := helper.ModelPriceHelper(c, relayInfo, tokens, meta)
if err != nil {
newAPIError = types.NewError(err, types.ErrorCodeModelPriceError)