[GH-ISSUE #24537] issue: Reasoning tags are displayed as raw output for Gemini 3 Flash via LiteLLM #107319

Closed
opened 2026-05-18 06:05:10 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @arnoulddw on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24537

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.9.4

Ollama Version (if applicable)

Not applicable. The affected model is accessed through LiteLLM, not Ollama.

Operating System

Debian GNU/Linux, kernel 6.12.85+deb13-amd64, x86_64

Browser

Chrome 147.0.7727.137

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of Open WebUI.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup, with secrets redacted.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup.
  • I have documented step-by-step reproduction instructions.

Expected Behavior

When a model returns content wrapped in reasoning tags such as:

<think>...</think>

Open WebUI should detect the reasoning block and hide it or render it in the collapsible reasoning/thinking UI, not display the raw tags and reasoning text in the assistant’s final visible answer.

This should work when the model-level Advanced Parameter Reasoning Tags is set to the default supported tags, and also when explicitly configured with:

Start tag: <think>
End tag: </think>

Actual Behavior

For a Gemini 3 Flash model accessed via LiteLLM, Open WebUI stores and displays the raw <think> block directly in the assistant message content.

The exported chat JSON shows the assistant message content beginning with:

<think>
[redacted]
</think>
[redacted]

The raw tags are present in both:

chat.history.messages[assistant_message_id].content

and:

chat.history.messages[assistant_message_id].output[0].content[0].text

Changing Reasoning Tags from Default to explicit custom <think> / </think> did not resolve the issue.

Steps to Reproduce

  1. Run Open WebUI v0.9.4 using Docker.

  2. Configure Open WebUI to use LiteLLM as an OpenAI-compatible provider.

  3. Configure a LiteLLM model alias for Gemini 3 Flash high reasoning, for example:

    model_list:
      - model_name: gemini-3-flash-preview-high
        litellm_params:
          model: gemini/gemini-3-flash-preview
          api_key: os.environ/GEMINI_API_KEY
          reasoning_effort: high
    

    Secrets/API keys are redacted.

  4. In Open WebUI, add/select the model with ID:

    gemini-3-flash-preview-high
    
  5. Open the model settings:

    Settings → Models → Gemini 3 Flash → Advanced Params
    
  6. Test with:

    Reasoning Tags: Default
    
  7. Then also test with custom reasoning tags:

    Start tag: <think>
    End tag: </think>
    
  8. Start a new chat with the Gemini 3 Flash model.

  9. Send a simple rewriting/proofreading prompt. Example redacted form:

    Rewrite the following short message for clarity and tone. Only output the rewritten text.
    
    [redacted]
    
  10. Observe the assistant response.

Expected result at step 10

The reasoning content should be hidden or shown only in Open WebUI’s reasoning/thinking UI. The final visible assistant message should contain only the final answer.

Actual result at step 10

The assistant response visibly includes the raw reasoning block before the final answer:

<think>
[redacted]
</think>
[redacted]

Logs & Screenshots

Screenshots of the model Advanced Params page and a redacted chat export can be provided if needed.

Relevant redacted export evidence:

{
  "model": "gemini-3-flash-preview-high",
  "content": "<think>[redacted]</think>[redacted]",
  "output": [
    {
      "type": "message",
      "content": [
        {
          "type": "output_text",
          "text": "<think>[redacted]</think>[redacted]"
        }
      ]
    }
  ]
}

Browser console logs and Docker logs are not included in this draft.

Additional Information

This appears to involve the interaction between:

  • Open WebUI reasoning-tag parsing/rendering
  • LiteLLM OpenAI-compatible responses
  • Gemini 3 Flash high reasoning / thought-summary output

The issue is not that the model emits a <think> block. The issue is that Open WebUI has a Reasoning Tags setting that appears intended to parse/hide this pattern, but the raw tags remain visible and stored as normal assistant content for this LiteLLM/Gemini response path.

Originally created by @arnoulddw on GitHub (May 10, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24537 ## Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items. - [x] I am using the latest version of Open WebUI. ## Installation Method Docker ## Open WebUI Version v0.9.4 ## Ollama Version (if applicable) Not applicable. The affected model is accessed through LiteLLM, not Ollama. ## Operating System Debian GNU/Linux, kernel 6.12.85+deb13-amd64, x86_64 ## Browser Chrome 147.0.7727.137 ## Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of Open WebUI. - [ ] I have included the browser console logs. - [ ] I have included the Docker container logs. - [x] I have provided every relevant configuration, setting, and environment variable used in my setup, with secrets redacted. - [x] I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup. - [x] I have documented step-by-step reproduction instructions. ## Expected Behavior When a model returns content wrapped in reasoning tags such as: ```text <think>...</think> ``` Open WebUI should detect the reasoning block and hide it or render it in the collapsible reasoning/thinking UI, not display the raw tags and reasoning text in the assistant’s final visible answer. This should work when the model-level Advanced Parameter `Reasoning Tags` is set to the default supported tags, and also when explicitly configured with: ```text Start tag: <think> End tag: </think> ``` ## Actual Behavior For a Gemini 3 Flash model accessed via LiteLLM, Open WebUI stores and displays the raw `<think>` block directly in the assistant message content. The exported chat JSON shows the assistant message content beginning with: ```text <think> [redacted] </think> [redacted] ``` The raw tags are present in both: ```text chat.history.messages[assistant_message_id].content ``` and: ```text chat.history.messages[assistant_message_id].output[0].content[0].text ``` Changing `Reasoning Tags` from `Default` to explicit custom `<think>` / `</think>` did not resolve the issue. ## Steps to Reproduce 1. Run Open WebUI v0.9.4 using Docker. 2. Configure Open WebUI to use LiteLLM as an OpenAI-compatible provider. 3. Configure a LiteLLM model alias for Gemini 3 Flash high reasoning, for example: ```yaml model_list: - model_name: gemini-3-flash-preview-high litellm_params: model: gemini/gemini-3-flash-preview api_key: os.environ/GEMINI_API_KEY reasoning_effort: high ``` Secrets/API keys are redacted. 4. In Open WebUI, add/select the model with ID: ```text gemini-3-flash-preview-high ``` 5. Open the model settings: ```text Settings → Models → Gemini 3 Flash → Advanced Params ``` 6. Test with: ```text Reasoning Tags: Default ``` 7. Then also test with custom reasoning tags: ```text Start tag: <think> End tag: </think> ``` 8. Start a new chat with the Gemini 3 Flash model. 9. Send a simple rewriting/proofreading prompt. Example redacted form: ```text Rewrite the following short message for clarity and tone. Only output the rewritten text. [redacted] ``` 10. Observe the assistant response. ## Expected result at step 10 The reasoning content should be hidden or shown only in Open WebUI’s reasoning/thinking UI. The final visible assistant message should contain only the final answer. ## Actual result at step 10 The assistant response visibly includes the raw reasoning block before the final answer: ```text <think> [redacted] </think> [redacted] ``` ## Logs & Screenshots Screenshots of the model Advanced Params page and a redacted chat export can be provided if needed. Relevant redacted export evidence: ```json { "model": "gemini-3-flash-preview-high", "content": "<think>[redacted]</think>[redacted]", "output": [ { "type": "message", "content": [ { "type": "output_text", "text": "<think>[redacted]</think>[redacted]" } ] } ] } ``` Browser console logs and Docker logs are not included in this draft. ## Additional Information This appears to involve the interaction between: - Open WebUI reasoning-tag parsing/rendering - LiteLLM OpenAI-compatible responses - Gemini 3 Flash high reasoning / thought-summary output The issue is not that the model emits a `<think>` block. The issue is that Open WebUI has a `Reasoning Tags` setting that appears intended to parse/hide this pattern, but the raw tags remain visible and stored as normal assistant content for this LiteLLM/Gemini response path.
Author
Owner

@owui-terminator[bot] commented on GitHub (May 10, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟣 #23879 issue: reasoning_content is ignored in non-stream openai API
    This is directly related: it reports that reasoning_content is ignored in non-stream OpenAI-compatible responses, which matches the symptom of reasoning not being parsed/rendered correctly when coming through LiteLLM/Gemini.
    by vanmilleru · bug

  2. 🟣 #20231 issue: Non-streaming responses with thinking enabled are not parsed correctly (thinking content merged into final answer)
    This issue describes non-streaming responses with thinking enabled not being parsed correctly, causing <think> content to be merged into the final visible answer. That is very close to the current report’s raw <think> block being shown in the assistant message.
    by hamid370 · bug

  3. 🟣 #17020 issue: Reasoning Tag disable does not seem to work
    This older bug shows reasoning tag handling can fail even when reasoning is disabled/configured, indicating the same reasoning-tag parsing/settings path is implicated. It is not identical, but it is relevant to tag parsing behavior.
    by RocketRider · bug

  4. 🟣 #23844 issue: wrap in convert_output_to_messages leaks reasoning markup for chat templates that don't strip (Gemma 4 et al.) — regression of #23742
    This is a close match for leaked <think> markup, though specifically in a chat-template/tool-path regression. It confirms the same class of issue where reasoning tags are preserved in visible output instead of being stripped/hidden.
    by nulltea · bug

  5. 🟣 #21832 issue: Post-tool “thinking” text leaks outside reasoning tags again
    This issue reports ‘thinking’ text leaking outside reasoning tags again after tool use. While tool-related, it is the same symptom family: reasoning content/tag markup appearing in normal assistant output instead of the reasoning UI.
    by kksaohun · bug


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4415456009 --> @owui-terminator[bot] commented on GitHub (May 10, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟣 [#23879](https://github.com/open-webui/open-webui/issues/23879) **issue: reasoning_content is ignored in non-stream openai API** *This is directly related: it reports that `reasoning_content` is ignored in non-stream OpenAI-compatible responses, which matches the symptom of reasoning not being parsed/rendered correctly when coming through LiteLLM/Gemini.* *by vanmilleru · `bug`* 2. 🟣 [#20231](https://github.com/open-webui/open-webui/issues/20231) **issue: Non-streaming responses with thinking enabled are not parsed correctly (thinking content merged into final answer)** *This issue describes non-streaming responses with thinking enabled not being parsed correctly, causing `<think>` content to be merged into the final visible answer. That is very close to the current report’s raw `<think>` block being shown in the assistant message.* *by hamid370 · `bug`* 3. 🟣 [#17020](https://github.com/open-webui/open-webui/issues/17020) **issue: Reasoning Tag disable does not seem to work** *This older bug shows reasoning tag handling can fail even when reasoning is disabled/configured, indicating the same reasoning-tag parsing/settings path is implicated. It is not identical, but it is relevant to tag parsing behavior.* *by RocketRider · `bug`* 4. 🟣 [#23844](https://github.com/open-webui/open-webui/issues/23844) **issue: <think> wrap in convert_output_to_messages leaks reasoning markup for chat templates that don't strip <think> (Gemma 4 et al.) — regression of #23742** *This is a close match for leaked `<think>` markup, though specifically in a chat-template/tool-path regression. It confirms the same class of issue where reasoning tags are preserved in visible output instead of being stripped/hidden.* *by nulltea · `bug`* 5. 🟣 [#21832](https://github.com/open-webui/open-webui/issues/21832) **issue: Post-tool “thinking” text leaks outside reasoning tags again** *This issue reports ‘thinking’ text leaking outside reasoning tags again after tool use. While tool-related, it is the same symptom family: reasoning content/tag markup appearing in normal assistant output instead of the reasoning UI.* *by kksaohun · `bug`* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@thefounderofantirome commented on GitHub (May 12, 2026):

This looks less like a model problem and more like a response-shape mismatch between LiteLLM's OpenAI-compatible output and the Open WebUI reasoning-tag parser.

Because the raw <think>...</think> block is being stored directly into both:

  • chat.history.messages[*].content
  • chat.history.messages[*].output[0].content[0].text

I would check two things first:

  1. whether the LiteLLM response is arriving as a plain final text blob that already contains <think>...</think> rather than as a structured reasoning/content separation
  2. whether Open WebUI's reasoning-tag extraction runs only on certain response paths (for example native provider adapters or streaming-specific shapes) and is being skipped on this LiteLLM/Gemini path

The fastest isolation is:

  • capture the exact raw JSON returned by LiteLLM for one affected request
  • compare it against a model/provider path where Open WebUI reasoning rendering works correctly

If the LiteLLM response is a single flattened text field, then the short-term unblock is usually to normalize the relay output before Open WebUI sees it, or patch Open WebUI to run the reasoning-tag split on that response path too.

I would also test the same model once through LiteLLM in streaming mode and once in non-stream mode. If only one mode leaks raw <think> tags, that narrows the bug to one parser branch very quickly.

If anyone needs a quick paid BYO-key debug pass for Open WebUI + LiteLLM reasoning/output normalization, I can help trace the raw response path and turn it into a clean working setup.

<!-- gh-comment-id:4426900377 --> @thefounderofantirome commented on GitHub (May 12, 2026): This looks less like a model problem and more like a response-shape mismatch between LiteLLM's OpenAI-compatible output and the Open WebUI reasoning-tag parser. Because the raw `<think>...</think>` block is being stored directly into both: - `chat.history.messages[*].content` - `chat.history.messages[*].output[0].content[0].text` I would check two things first: 1. whether the LiteLLM response is arriving as a plain final text blob that already contains `<think>...</think>` rather than as a structured reasoning/content separation 2. whether Open WebUI's reasoning-tag extraction runs only on certain response paths (for example native provider adapters or streaming-specific shapes) and is being skipped on this LiteLLM/Gemini path The fastest isolation is: - capture the exact raw JSON returned by LiteLLM for one affected request - compare it against a model/provider path where Open WebUI reasoning rendering works correctly If the LiteLLM response is a single flattened text field, then the short-term unblock is usually to normalize the relay output before Open WebUI sees it, or patch Open WebUI to run the reasoning-tag split on that response path too. I would also test the same model once through LiteLLM in streaming mode and once in non-stream mode. If only one mode leaks raw `<think>` tags, that narrows the bug to one parser branch very quickly. If anyone needs a quick paid BYO-key debug pass for Open WebUI + LiteLLM reasoning/output normalization, I can help trace the raw response path and turn it into a clean working setup.
Author
Owner

@Classic298 commented on GitHub (May 12, 2026):

Just to chime in I can't reproduce with the exact same setup in latest open webui and latest litellm. So might be a version mismatch

<!-- gh-comment-id:4428025344 --> @Classic298 commented on GitHub (May 12, 2026): Just to chime in I can't reproduce with the exact same setup in latest open webui and latest litellm. So might be a version mismatch
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#107319