Update relay-gemini-native.go

This commit is contained in:
xqx121
2025-06-18 14:26:23 +08:00
committed by GitHub
parent 0b9b21eafd
commit edcdb378fd

View File

@@ -65,6 +65,9 @@ func GeminiTextGenerationHandler(c *gin.Context, resp *http.Response, info *rela
} }
} }
// 计算最终使用量
usage.CompletionTokens = usage.TotalTokens - usage.PromptTokens
// 直接返回 Gemini 原生格式的 JSON 响应 // 直接返回 Gemini 原生格式的 JSON 响应
jsonResponse, err := json.Marshal(geminiResponse) jsonResponse, err := json.Marshal(geminiResponse)
if err != nil { if err != nil {