This is an automated email from the ASF dual-hosted git repository. ashishtiwari pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push: new 8850e9cb9 fix: missing ctx.llm_raw_usage in non-stream mode (#12564) 8850e9cb9 is described below commit 8850e9cb91223ec75c67a0a70856584909265c32 Author: Ashish Tiwari <ashishjaitiwari15112...@gmail.com> AuthorDate: Fri Aug 29 13:25:50 2025 +0530 fix: missing ctx.llm_raw_usage in non-stream mode (#12564) --- apisix/plugins/ai-drivers/openai-base.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/apisix/plugins/ai-drivers/openai-base.lua b/apisix/plugins/ai-drivers/openai-base.lua index 6ed0bc404..2ad4944a6 100644 --- a/apisix/plugins/ai-drivers/openai-base.lua +++ b/apisix/plugins/ai-drivers/openai-base.lua @@ -165,6 +165,7 @@ local function read_response(ctx, res) core.log.info("got token usage from ai service: ", core.json.delay_encode(res_body.usage)) ctx.ai_token_usage = {} if type(res_body.usage) == "table" then + ctx.llm_raw_usage = res_body.usage ctx.ai_token_usage.prompt_tokens = res_body.usage.prompt_tokens or 0 ctx.ai_token_usage.completion_tokens = res_body.usage.completion_tokens or 0 ctx.ai_token_usage.total_tokens = res_body.usage.total_tokens or 0