[GH-ISSUE #9421] <thinking> breaks the current thinking feature. #70104

Closed
opened 2026-05-13 02:19:32 -05:00 by GiteaMirror · 17 comments
Owner

Originally created by @EliEron on GitHub (Feb 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9421

Originally assigned to: @tjbck on GitHub.

Bug Report

If a model outputs the specific tag <thinking> it triggers the thinking mode in Open-Webui, but for some reason the closing </thinking> does not end the thinking mode. Leading Open-Webui to just endlessly treat the model as thinking.

On top of that the thinking mode sometimes triggers a word or two late, meaning part of the output is placed before the thinking section rather than within it.

This bug was encountered on the latest version v0.5.9. The one that explicitly makes some changes to the thinking code.


Installation Method

Installed via Docker.

Environment

  • Open WebUI Version: v0.5.9
  • Operating System: Windows 11
  • Browser (if applicable): Chrome

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

The thinking mode should end as soon as the </thinking> tag is encountered.

And in general, even if no ending tag was found it should end when the model finishes its output. Not spin infinitely waiting for it to end.

Actual Behavior:

It last forever even after encountering the </thinking> tag

Description

Reproduction Details

Steps to Reproduce:
Make a request that will cause the model to output its thoughts within <thinking> tags.

Something as simple as using this as a system message will usually be enough:
Before responding output your thoughts within <thinking> tags.

Logs and Screenshots

Screenshots/Screen Recordings (if applicable):

https://github.com/user-attachments/assets/dbfeb205-212c-45a4-8d71-8eeaa13b2dee

Demonstrates both of the issues of tokens appearing outside the thinking section and the thinking never ending.

Additional Information

I have a number of COT system prompts that instruct models to use <thinking> tags for their COT output, which predates the recent waves of deep thinking models. This is why I encountered the bug.

Originally created by @EliEron on GitHub (Feb 5, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/9421 Originally assigned to: @tjbck on GitHub. # Bug Report If a model outputs the specific tag \<thinking> it triggers the thinking mode in Open-Webui, but for some reason the closing \</thinking> does not end the thinking mode. Leading Open-Webui to just endlessly treat the model as thinking. On top of that the thinking mode sometimes triggers a word or two late, meaning part of the output is placed before the thinking section rather than within it. This bug was encountered on the latest version v0.5.9. The one that explicitly makes some changes to the thinking code. --- ## Installation Method Installed via Docker. ## Environment - **Open WebUI Version:** v0.5.9 - **Operating System:** Windows 11 - **Browser (if applicable):** Chrome **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: The thinking mode should end as soon as the \</thinking> tag is encountered. And in general, even if no ending tag was found it should end when the model finishes its output. Not spin infinitely waiting for it to end. ## Actual Behavior: It last forever even after encountering the \</thinking> tag ## Description ## Reproduction Details **Steps to Reproduce:** Make a request that will cause the model to output its thoughts within \<thinking> tags. Something as simple as using this as a system message will usually be enough: ```Before responding output your thoughts within <thinking> tags.``` ## Logs and Screenshots **Screenshots/Screen Recordings (if applicable):** https://github.com/user-attachments/assets/dbfeb205-212c-45a4-8d71-8eeaa13b2dee Demonstrates both of the issues of tokens appearing outside the thinking section and the thinking never ending. ## Additional Information I have a number of COT system prompts that instruct models to use \<thinking> tags for their COT output, which predates the recent waves of deep thinking models. This is why I encountered the bug.
Author
Owner

@stupid-ve commented on GitHub (Feb 5, 2025):

I can't even see the thinking process. I'm using 0.5.9,Win11 and Chrome. I changed model and when them think it's just the line shinning. Also the Code Interpreter keep showing it's analyzing the code after the reply appears.

<!-- gh-comment-id:2637923948 --> @stupid-ve commented on GitHub (Feb 5, 2025): I can't even see the thinking process. I'm using 0.5.9,Win11 and Chrome. I changed model and when them think it's just the line shinning. Also the Code Interpreter keep showing it's analyzing the code after the reply appears.
Author
Owner

@LorenzoBoccaccia commented on GitHub (Feb 5, 2025):

same here, both with Nova as pipeline model with pipeline side tools

Image

and with nova as litellm model with "native" function calling:

Image

may be that the end tag is tokenized differently than expected?

<!-- gh-comment-id:2637998293 --> @LorenzoBoccaccia commented on GitHub (Feb 5, 2025): same here, both with Nova as pipeline model with pipeline side tools ![Image](https://github.com/user-attachments/assets/da40c364-5a0d-4838-8d8b-3ad05febf18f) and with nova as litellm model with "native" function calling: ![Image](https://github.com/user-attachments/assets/40a3a4e4-c5a8-494a-9214-fa4e95112868) may be that the end tag is tokenized differently than expected?
Author
Owner

@spammenotinoz commented on GitHub (Feb 5, 2025):

Hi, just curious using the main branch, I don't see the Thinking with o3 or R1 do you need a custom system prompt to enable the thinking step.

<!-- gh-comment-id:2638061920 --> @spammenotinoz commented on GitHub (Feb 5, 2025): Hi, just curious using the main branch, I don't see the Thinking with o3 or R1 do you need a custom system prompt to enable the thinking step.
Author
Owner

@stupid-ve commented on GitHub (Feb 5, 2025):

Hi, just curious using the main branch, I don't see the Thinking with o3 or R1 do you need a custom system prompt to enable the thinking step.

Hi Ive read ur comment and I m using lm studio as an api for the webui. I can see it showing the model thinks in lm but not in the webui . Before i updated to the newest version i could see the thoughts. So i think it doesnt need custom prompt. Maybe i did sth wrong myself during the update process.

<!-- gh-comment-id:2638080927 --> @stupid-ve commented on GitHub (Feb 5, 2025): > Hi, just curious using the main branch, I don't see the Thinking with o3 or R1 do you need a custom system prompt to enable the thinking step. Hi Ive read ur comment and I m using lm studio as an api for the webui. I can see it showing the model thinks in lm but not in the webui . Before i updated to the newest version i could see the thoughts. So i think it doesnt need custom prompt. Maybe i did sth wrong myself during the update process.
Author
Owner

@tjbck commented on GitHub (Feb 5, 2025):

Should be addressed with 648878782b, 0.5.10 will be released shortly.

<!-- gh-comment-id:2638155200 --> @tjbck commented on GitHub (Feb 5, 2025): Should be addressed with 648878782b4574aeeddbb59687bc56ce561529cf, 0.5.10 will be released shortly.
Author
Owner

@spammenotinoz commented on GitHub (Feb 5, 2025):

0.5.10

Hi Tim, I still do not see reasoning\thinking when using o series models, with v0.5.10.
Have cleared cookies\refreshed browser. Is there something I need to do to enable?
I am not using any tools for functions.

<!-- gh-comment-id:2638250310 --> @spammenotinoz commented on GitHub (Feb 5, 2025): > 0.5.10 Hi Tim, I still do not see reasoning\thinking when using o series models, with v0.5.10. Have cleared cookies\refreshed browser. Is there something I need to do to enable? I am not using any tools for functions.
Author
Owner

@sid-6581 commented on GitHub (Feb 6, 2025):

I'm also not seeing any reasoning/thinking when using R1 through OpenRouter with Open WebUI. When I use the OpenRouter web interface I see the thinking, but in WebUI it just sits there forever and then gives me the answer with none of the reasoning in the output anywhere.

Edit: I'm on 0.5.10 as well.

<!-- gh-comment-id:2640523975 --> @sid-6581 commented on GitHub (Feb 6, 2025): I'm also not seeing any reasoning/thinking when using R1 through OpenRouter with Open WebUI. When I use the OpenRouter web interface I see the thinking, but in WebUI it just sits there forever and then gives me the answer with none of the reasoning in the output anywhere. Edit: I'm on 0.5.10 as well.
Author
Owner

@stupid-ve commented on GitHub (Feb 6, 2025):

Are you guys using LM studio?

<!-- gh-comment-id:2640567152 --> @stupid-ve commented on GitHub (Feb 6, 2025): Are you guys using LM studio?
Author
Owner

@sid-6581 commented on GitHub (Feb 6, 2025):

I use LM Studio, but I haven't connected Open WebUI to it. LM Studio shows the thinking for all the R1 models I've tried.

<!-- gh-comment-id:2640571412 --> @sid-6581 commented on GitHub (Feb 6, 2025): I use LM Studio, but I haven't connected Open WebUI to it. LM Studio shows the thinking for all the R1 models I've tried.
Author
Owner

@stupid-ve commented on GitHub (Feb 6, 2025):

I don't know how to solve your situation, but for myself, I'm using it as an api. I found out that in LM studio settings, there is a check-box in the Developer section called "When applicable, separate reasoning_content and content in API responses."

Image

By deselect it this, the thinking for all my models can be showed in Open-webui.
But since u r not connecting it to the open webui, i don't know how to solve this situation. But I think the problem might be similar. Hope it can give you some help finding the problem.

<!-- gh-comment-id:2640589018 --> @stupid-ve commented on GitHub (Feb 6, 2025): I don't know how to solve your situation, but for myself, I'm using it as an api. I found out that in LM studio settings, there is a check-box in the Developer section called "When applicable, separate reasoning_content and content in API responses." ![Image](https://github.com/user-attachments/assets/5c6de7db-2b6c-4a88-aba8-5c559df5bce8) By deselect it this, the thinking for all my models can be showed in Open-webui. But since u r not connecting it to the open webui, i don't know how to solve this situation. But I think the problem might be similar. Hope it can give you some help finding the problem.
Author
Owner

@EliEron commented on GitHub (Feb 6, 2025):

R1 not showing thinking tokens is a known issue, and one that tjbck has explicitly stated they don't intend to fix currently.

The gist of the issue is that R1 returns the thinking tokens separately from the content itself using a field called reasoning_content. Since that deviates from the standard OpenAI spec which Open-WebUi generally follows tjbck does not want to support it.

There is a workaround which is to use a pipe function. If you are using OpenRouter then you can use the function found in this github. If you are using the DeepSeek API itself you can use this function. They need different functions since OpenRouter has also gone with a slightly different design for how they deliver thinking tokens.

In either case once configured the function will add a new model to your model list which will act exactly as the normal R1 endpoint but will show the thinking tokens properly.

<!-- gh-comment-id:2640872702 --> @EliEron commented on GitHub (Feb 6, 2025): R1 not showing thinking tokens is a known issue, and one that [tjbck](https://github.com/open-webui/open-webui/issues/8749#issuecomment-2608126791) has explicitly stated they don't intend to fix currently. The gist of the issue is that R1 returns the thinking tokens separately from the content itself using a field called `reasoning_content`. Since that deviates from the standard OpenAI spec which Open-WebUi generally follows tjbck does not want to support it. There is a workaround which is to use a pipe function. If you are using OpenRouter then you can use the function found in [this](https://github.com/rmarfil3/openwebui-openrouter-reasoning-tokens) github. If you are using the DeepSeek API itself you can use [this](https://openwebui.com/f/zgccrui/deepseek_r1) function. They need different functions since OpenRouter has also gone with a slightly different design for how they deliver thinking tokens. In either case once configured the function will add a new model to your model list which will act exactly as the normal R1 endpoint but will show the thinking tokens properly.
Author
Owner

@spammenotinoz commented on GitHub (Feb 6, 2025):

R1 not showing thinking tokens is a known issue, and one that tjbck has explicitly stated they don't intend to fix currently.

The gist of the issue is that R1 returns the thinking tokens separately from the content itself using a field called reasoning_content. Since that deviates from the standard OpenAI spec which Open-WebUi generally follows tjbck does not want to support it.

There is a workaround which is to use a pipe function. If you are using OpenRouter then you can use the function found in this github. If you are using the DeepSeek API itself you can use this function. They need different functions since OpenRouter has also gone with a slightly different design for how they deliver thinking tokens.

In either case once configured the function will add a new model to your model list which will act exactly as the normal R1 endpoint but will show the thinking tokens properly.

Thank-you, that function works really well!!
I can't get the thinking to appear with o series via LITELLM or going direct is there a trick?

<!-- gh-comment-id:2641387540 --> @spammenotinoz commented on GitHub (Feb 6, 2025): > R1 not showing thinking tokens is a known issue, and one that [tjbck](https://github.com/open-webui/open-webui/issues/8749#issuecomment-2608126791) has explicitly stated they don't intend to fix currently. > > The gist of the issue is that R1 returns the thinking tokens separately from the content itself using a field called `reasoning_content`. Since that deviates from the standard OpenAI spec which Open-WebUi generally follows tjbck does not want to support it. > > There is a workaround which is to use a pipe function. If you are using OpenRouter then you can use the function found in [this](https://github.com/rmarfil3/openwebui-openrouter-reasoning-tokens) github. If you are using the DeepSeek API itself you can use [this](https://openwebui.com/f/zgccrui/deepseek_r1) function. They need different functions since OpenRouter has also gone with a slightly different design for how they deliver thinking tokens. > > In either case once configured the function will add a new model to your model list which will act exactly as the normal R1 endpoint but will show the thinking tokens properly. Thank-you, that function works really well!! I can't get the thinking to appear with o series via LITELLM or going direct is there a trick?
Author
Owner

@EliEron commented on GitHub (Feb 7, 2025):

Thank-you, that function works really well!! I can't get the thinking to appear with o series via LITELLM or going direct is there a trick?

No, there are no tricks for that.

OpenAI does not supply thinking tokens via their API, and there is no way to enable them. When they launched the o-series of models they stated they would not supply the full thinking output due to worries about various, things including maintaining their competitive edge.

Now that there are other popular deep thinking models that do provide the output I suspect they'll revisit that decision, but for now there is no way to access the thinking tokens.

<!-- gh-comment-id:2641539618 --> @EliEron commented on GitHub (Feb 7, 2025): > Thank-you, that function works really well!! I can't get the thinking to appear with o series via LITELLM or going direct is there a trick? No, there are no tricks for that. OpenAI does not supply thinking tokens via their API, and there is no way to enable them. When they launched the o-series of models they [stated](https://openai.com/index/learning-to-reason-with-llms#:~:text=Hiding%20the%20chains%20of%20Thought) they would not supply the full thinking output due to worries about various, things including maintaining their competitive edge. Now that there are other popular deep thinking models that do provide the output I suspect they'll revisit that decision, but for now there is no way to access the thinking tokens.
Author
Owner

@boshk0 commented on GitHub (Apr 23, 2025):

I confirm this bug is still present.
Open WebUI 0.6.4
Ollama 0.6.5
Model: qwq:32b-q4_K_M

<!-- gh-comment-id:2823675807 --> @boshk0 commented on GitHub (Apr 23, 2025): I confirm this bug is still present. Open WebUI **0.6.4** Ollama **0.6.5** Model: **qwq:32b-q4_K_M**
Author
Owner

@EstrianTech commented on GitHub (Apr 23, 2026):

Bug is still present. gemma4

<!-- gh-comment-id:4304771231 --> @EstrianTech commented on GitHub (Apr 23, 2026): Bug is still present. gemma4
Author
Owner

@Yam9032 commented on GitHub (Apr 25, 2026):

Can confirm its still broken using Gemma 4 26B A4B with llama.cpp.

<!-- gh-comment-id:4317741709 --> @Yam9032 commented on GitHub (Apr 25, 2026): Can confirm its still broken using Gemma 4 26B A4B with llama.cpp.
Author
Owner

@chinkeong commented on GitHub (Apr 30, 2026):

the request could have hit a max_tokens cap during reasoning, try Models → Advanced Parameters → Max Tokens and increase the size

<!-- gh-comment-id:4349424333 --> @chinkeong commented on GitHub (Apr 30, 2026): the request could have hit a max_tokens cap during reasoning, try Models → Advanced Parameters → Max Tokens and increase the size
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#70104