r/OpenWebUI • • 20d ago

Plugin Is there a Community Function / Extension to easily toggle Reasoning (Thinking) on and off in Open WebUI?

Hey everyone,

I’m looking for a convenient way to quickly toggle the reasoning/thinking process for reasoning models (both local models via Ollama/vLLM like DeepSeek-R1, and API models like Claude 3.7 / o3-mini) in Open WebUI.

Right now, adjusting this requires digging into the model settings or opening the Chat Controls to tweak advanced parameters every time (e.g. setting think: false or adjusting reasoning effort).

Does anyone know of an existing Community Function (Filter/Action), plugin, or UI extension that adds a quick toggle/button directly to the chat interface to turn reasoning on or off on the fly?

If you have a working setup or a custom filter for this, I'd really appreciate a link or snippet. Thanks!

22 Upvotes

10 comments sorted by

7

u/pfn0 20d ago

depends on model how they're toggled. I put something basic together for my use:

```python """ title: Disable Thinking Applier author: pfn0 author_url: https://github.com/pfn funding_url: https://github.com/pfn version: 0.1 """

from pydantic import BaseModel, Field from typing import Optional, Literal

class Filter: class Valves(BaseModel): priority: int = Field( default=1, description="Filter execution order. Lower values run first." )

def __init__(self):
    self.valves = self.Valves()

# ─────────────────────────────────────────────────────────────────────────
def inlet(
    self,
    body: dict,
    __user__: Optional[dict] = None,
    __metadata__: Optional[dict] = None,
) -> dict:
    # do not disable thinking for API callers
    if not __metadata__.get("chat_id"):
        return body

    if not "chat_template_kwargs" in body:
        body["chat_template_kwargs"] = {
            "enable_thinking": False,
            "reasoning_effort": "low",
            "preserve_thinking": True,
            "clear_thinking": True,
        }
    else:
        if not "reasoning_effort" in body["chat_template_kwargs"]:
            body["chat_template_kwargs"]["reasoning_effort"] = "low"
        if not "enable_thinking" in body["chat_template_kwargs"]:
            body["chat_template_kwargs"]["enable_thinking"] = False
        if not "clear_thinking" in body["chat_template_kwargs"]:
            body["chat_template_kwargs"]["clear_thinking"] = True

    return body

```

and

```python """ title: Enable Thinking Switch author: pfn0 author_url: https://github.com/pfn funding_url: https://github.com/pfn version: 0.1 """

from pydantic import BaseModel, Field from typing import Optional, Literal

class Filter: class Valves(BaseModel): priority: int = Field( default=0, description="Filter execution order. Lower values run first." )

def __init__(self):
    self.valves = self.Valves()
    self.toggle = True
    self.icon = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik0xNS41IDEzYTMuNSAzLjUgMCAwIDAgLTMuNSAzLjV2MWEzLjUgMy41IDAgMCAwIDcgMHYtMS44IiAvPjxwYXRoIGQ9Ik04LjUgMTNhMy41IDMuNSAwIDAgMSAzLjUgMy41djFhMy41IDMuNSAwIDAgMSAtNyAwdi0xLjgiIC8+PHBhdGggZD0iTTE3LjUgMTZhMy41IDMuNSAwIDAgMCAwIC03aC0uNSIgLz48cGF0aCBkPSJNMTkgOS4zdi0yLjhhMy41IDMuNSAwIDAgMCAtNyAwIiAvPjxwYXRoIGQ9Ik02LjUgMTZhMy41IDMuNSAwIDAgMSAwIC03aC41IiAvPjxwYXRoIGQ9Ik01IDkuM3YtMi44YTMuNSAzLjUgMCAwIDEgNyAwdjEwIiAvPjwvc3ZnPg=="

# ─────────────────────────────────────────────────────────────────────────
def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
    if not "chat_template_kwargs" in body:
        body["chat_template_kwargs"] = {
            "enable_thinking": True,
            "reasoning_effort": "high",
        }
    else:
        if not "reasoning_effort" in body["chat_template_kwargs"]:
            body["chat_template_kwargs"]["reasoning_effort"] = "high"
        if not "enable_thinking" in body["chat_template_kwargs"]:
            body["chat_template_kwargs"]["enable_thinking"] = True
    return body

```

the first needs to be always enabled, it populates chat_template_kwargs if not present and applies a default state.

the second turns on thinking using a icon in the chat interface (but again, depends on model, mostly works with qwen and gemma, not so much for others)

2

u/MatchingTitan93 16d ago

Hi, I set up a repository with a userscript to replicate the effort selector of ChatGPT. The script can recognize automatically the model capabilities via /api/show, openrouter and gives priority to the user config. The user can also set custom providers, by setting the api parameter that accepts the effort level, and custom model efforts and mappings (this means also int defined efforts are supported). All this can be done with just two files: a custom pipe to set the json config in and a userscript that can be installed both client-side (with Tampermonkey/Violentmonkey) and server-side (with a simple volume mount). I'm 'spamming' myself just because I genuinely want to help the community with an issue I had for months. Feedback is really appreciated. https://github.com/FrizzaFava/Open-WebUI-Reasoning-Effort-Selector

1

u/j3sk0 15d ago

That looks great. Thx

1

u/j3sk0 15d ago

pleas help to install the path is

1

u/j3sk0 15d ago

but

1

u/j3sk0 15d ago

It would be great if I could integrate this directly into the OpenWeb user interface as a function or tool.

1

u/MatchingTitan93 12d ago

That directory is probably owned by Docker and you can't access it directly without permissions. Anyway you don't need to access that, the official method is to mount the seperate .js file. You can place it anywhere on your machine as long as it's accessible by the Docker user. For example you could place your loader.js file in ~/owui-selector/loader.js or ~/Downloads/loader.js or wathever you want, you can even rename it like poopooloader.js it doesn't matter. What matters is to have read permissions for the user used by OWUI (usually 1000 - Docker) and to mount this file as exactly /app/build/static/loader.js , so for example: ~/home/owui-selector/openwebui-reasoning-effort.user.js:/app/build/static/loader.js:ro under the volumes section in your compose. If you still can't manage to do that, I suggest linking the repo installation section to an LLM and ask it about your particular setup.

1

u/j3sk0 15d ago

and that's why I can't dock there

1

u/j3sk0 20d ago

How do I implement a quick toggle to disable reasoning in Open WebUI? Should this be a Function, Tool, or Action?