From: Lucas Rolff Date: Tue, 3 Jun 2025 07:24:29 +0000 (+0200) Subject: [Minor] Log the token usage for OpenAI (compatible) plain conversion X-Git-Tag: 3.12.0~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5488%2Fhead;p=thirdparty%2Frspamd.git [Minor] Log the token usage for OpenAI (compatible) plain conversion --- diff --git a/src/plugins/lua/gpt.lua b/src/plugins/lua/gpt.lua index bdec927e62..51df0bc20c 100644 --- a/src/plugins/lua/gpt.lua +++ b/src/plugins/lua/gpt.lua @@ -355,6 +355,10 @@ local function default_openai_plain_conversion(task, input) local reason = clean_reply_line(lines[2]) local categories = lua_util.str_split(clean_reply_line(lines[3]), ',') + if type(reply.usage) == 'table' then + rspamd_logger.infox(task, 'usage: %s tokens', reply.usage.total_tokens) + end + if spam_score then return spam_score, reason, categories end