fix: prompt calculation

User will correctly get estimated prompt usage when upstream returns either zero or nothing.
This commit is contained in:
funnycups
2025-08-16 22:54:00 +08:00
committed by GitHub
parent 206ed55db4
commit e3473e3c39
2 changed files with 12 additions and 6 deletions

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)