From aa1326eaeaee5a9c2f64501409051d446d0b0b4e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:04:51 +0100 Subject: [PATCH] fix: replies cut off at the token limit on a Responses API connection lose their token usage (#33619) When a streamed reply from a Responses API connection stopped early, for example at the token limit or through a content filter, its token counts were lost. The chat showed no usage for that reply and the admin analytics recorded zero tokens for it. Such replies now keep the usage the provider reported, the same as replies that finished normally. Fixes #33615 --- backend/open_webui/utils/response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/response.py b/backend/open_webui/utils/response.py index 7f9080936e..374b5b4904 100644 --- a/backend/open_webui/utils/response.py +++ b/backend/open_webui/utils/response.py @@ -835,7 +835,7 @@ def handle_responses_streaming_event( return current_output, None - elif event_type == 'response.completed': + elif event_type in ('response.completed', 'response.incomplete'): # State Machine Event: Completed response_data = data.get('response', {}) final_output = response_data.get('output')