mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-09 11:45:57 -05:00
[GH-ISSUE #21768] issue: OpenAI-compatible streaming: finish_reason incorrectly returned as "stop" after streaming tool_calls #90302
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Sechma on GitHub (Feb 23, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21768
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.8.4
Ollama Version (if applicable)
No response
Operating System
Windows 11
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
When using OpenWebUI’s OpenAI-compatible endpoint (/api/v1/chat/completions) with stream: true and function/tool calling enabled, the streaming response should preserve correct OpenAI-compatible semantics.
If the model emits a tool call during streaming (i.e., delta.tool_calls is present in one or more chunks), the final streamed chunk should include:
finish_reason: "tool_calls"
This is required so agent frameworks (such as OpenCode or Vercel AI SDK) can correctly detect that a tool execution step is required and continue the agent loop.
This behavior is correctly observed when:
Using stream: false via OpenWebUI
Streaming directly against Ollama’s OpenAI-compatible endpoint
Actual Behavior
When using stream: true through OpenWebUI:
The server correctly streams delta.tool_calls chunks.
However, the final chunk incorrectly sets:
finish_reason: "stop"
instead of:
finish_reason: "tool_calls"
As a result, agent frameworks interpret the response as a completed generation rather than a tool invocation, and the agent loop terminates prematurely.
Notably, this issue does not occur in non-streaming mode (stream: false), where the correct finish_reason: "tool_calls" is returned.
Steps to Reproduce
Run following comand:
(fill your API TOKEN)
Logs & Screenshots
Response:
Additional Information
Non-streaming variant works fine, but lots of AI agents using just stream variant:
@Classic298 commented on GitHub (Feb 24, 2026):
can you confirm if this is solved by
0b867590a8?@tnndclub commented on GitHub (Feb 25, 2026):
I have the same issue where tool_calls is not possible after upgrading to release 0.8.5
No such issue on release 0.8.3.
@Classic298 commented on GitHub (Feb 25, 2026):
Confirmation is wanted if this is fixed in dev please. Thanks.
A fix might be in place - so additional error reports are not pushing this forward. We need to know if the error is still the case in
devfor you or not. -- Thankshttps://docs.openwebui.com/getting-started/development
@Classic298 commented on GitHub (Mar 1, 2026):
nobody willing to confirm?
@Sechma commented on GitHub (Mar 2, 2026):
I'm confirming it helps and the issue is fixed
@tnndclub commented on GitHub (Mar 2, 2026):
@Classic298
It doesn't help.
Here is what I did,
tool calling is still failing.
I also tried latest release, 0.8.7, and the tool calling works.
@Classic298 commented on GitHub (Mar 2, 2026):
@Sechma so for you it works
@tnndclub and you said it doesn't help but you are also saying in 0.8.7 it works?
So does it work? I will close this now as I also suspect it should work now.
Thanks.