A pipe function for OpenWebUI that integrates OpenRouter model selection directly into the OpenWebUI interface. This plugin allows users to access a wide range of AI models through OpenRouter's API, with support for filtering free models and handling reasoning tokens.
- 🔄 Dynamic Model List: Fetches available models directly from OpenRouter API
- 🆓 Free Model Filter: Toggle to show only free models or all models
- 🧠 Reasoning Token Support: Properly handles
<think></think>
tags for models that support reasoning - ⚡ Performance Optimized: Includes caching to reduce API calls and improve responsiveness
- 🛡️ Robust Error Handling: Graceful handling of API errors with retry logic
-
Clone this repository:
git clone https://github.com/wojons/openwebui-openrouter-pipe.git
-
Copy the plugin file to your OpenWebUI plugins directory:
cp openwebui-openrouter-pipe/src/plugins/openrouter_model_selector.py /path/to/openwebui/plugins/
-
Restart your OpenWebUI server to load the new plugin.
After installation, configure the pipe function through the OpenWebUI interface:
- Navigate to the OpenWebUI settings
- Go to the "Functions" or "Plugins" section
- Find "OpenRouter Model Selector" in the list
- Configure the following valves:
- OPENROUTER_API_KEY: Your OpenRouter API key (required)
- FREE_ONLY: Set to
true
to show only free models,false
to show all models - MODEL_PREFIX: Customize the prefix shown before model names (default: "OpenRouter/"). Set to an empty string to remove the prefix completely.
- INCLUDE_REASONING: Enable/disable reasoning token support (default: true)
Once configured, OpenRouter models will appear in your model selection dropdown with the prefix specified in the MODEL_PREFIX valve (if any).
- Open a chat in OpenWebUI
- Click on the model selection dropdown
- Look for models with the "OpenRouter/" prefix
- Select your desired model
For more detailed usage instructions, see the Usage Guide.
- OpenWebUI (latest version recommended)
- Python 3.8+
- An OpenRouter API key
- requests
- pydantic
-
Clone the repository:
git clone https://github.com/wojons/openwebui-openrouter-pipe.git cd openwebui-openrouter-pipe
-
Install development dependencies:
pip install -r requirements-dev.txt
-
Make your changes to the code
-
Test your changes with OpenWebUI
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenWebUI for the amazing web interface
- OpenRouter for providing access to a wide range of AI models