open-webui-tools

Open WebUI Tools

A collection of tools, filters and fixes for Open WebUI. Each project lives in its own folder and can be used on its own.

Maintained by @fractuscontext.

Contents

Repair tools

Chat Fix

Chat Fix rescues Open WebUI chats that get stuck on the infinite “Loading…” spinner, or that crash back to the home page. It can also clean up retries, removing the regenerated responses you no longer need.

đź”— Launch the Repair Tool

Chat Fix screenshot

The bug happens when a chat’s internal message tree has broken links, usually after network interruptions, API errors or third-party tools. Chat Fix repairs the exported JSON so you can import the chat back into Open WebUI.

Usage instructions are built into the page under “Don’t know how to use?”.

The "Loading..." spinner ![Infinite spinning](/open-webui-tools/chat-fix/assets/infinite_spinning.png)
Technical details * Resolves `currentId` pointers that reference non-existent nodes. * Prunes `childrenIds` arrays of invalid or dangling IDs. * Prune mode rebuilds the tree along a single linear path from the root to the most recently timestamped leaf. * To test it yourself, import [`bad-test-1.json`](/open-webui-tools/chat-fix/tests/bad-test-1.json) into Open WebUI to reproduce the crash, run it through the tool, then re-import the result to confirm the fix.

Functions

Filter functions that run on every request before it reaches the model.

Token Saver Reloaded

token-saver-reloaded.py cuts token usage and cost on long chats.

Valves | Valve | Default | Description | | :--- | :---: | :--- | | `priority` | `0` | Execution order (higher runs later). | | `n_last_messages` | `50` | Messages to keep (user and assistant each count as 1). | | `supplementary_messages_to_be_sent` | `3` | Extra relevant past messages to retrieve beyond the cutoff. `0` disables lookup. | | `use_bm25_instead_of_sentence_transformer` | `False` | `True` uses lightweight BM25 keyword search, `False` uses PyTorch semantic search. | | `debug_mode` | `False` | Logs diagnostics (library status, forgotten messages, evaluation time) to the server log as WARNING. | | `ignore_images_after_n_messages` | `10` | Keep images only in the last N messages. | | `api_base_url` | `http://127.0.0.1:8080` | Open WebUI API base URL, used to fetch message timestamps. | | `inject_system_instructions` | `True` | Tell the model in the System Prompt how to read the injected time data. | | `enable_token_optimizer` | `False` | Remove common filler words from user messages. | | `min_words_to_optimize` | `60` | Skip optimization for shorter messages. | | `max_words_to_optimize` | `2000` | Skip optimization for very long messages. | | `optimize_current_only` | `True` | Only optimize the current (last) message. |
Requirements * `httpx>=0.24.0` (usually bundled with Open WebUI) * `rank-bm25` for keyword search * `sentence-transformers` and `torch` for semantic search

Simple Prompt

simple-prompt.py appends your own instructions to the System Prompt. Out of the box, it pushes the model toward short, structured answers.

Valves | Valve | Default | Description | | :--- | :---: | :--- | | `priority` | `0` | Execution order (higher runs later). | | `target_word_count` | `240` | Soft word-count target, substituted for `{target_word_count}` in the prompts. | | `system_prompt` | built-in prompt | Main instructions. Edit to change them, or clear to disable. | | `additional_prompt` | blank | Extra instructions appended after `system_prompt`. Ignored while blank. |

Installation

Requires Open WebUI v0.8.4 or higher.

Repository layout

License

MIT © 2025-2026 @fractuscontext