Filters and pipes that expose OpenRouter’s advanced features through Open WebUI’s interface. Provides user-friendly toggles for speed optimization, reasoning modes, web search, structured outputs, and image generation without requiring model name modifications.
Download openrouter-functions.json from GitHub Releases, then import into Open WebUI:
- In Open WebUI, click the profile icon → Admin Panel → Functions tab
- Click Import button and select the downloaded
openrouter-functions.json - Confirm the import (refresh the page if functions don’t appear immediately)
- Enable all OpenRouter functions in the Functions list
- IMPORTANT: For each filter, click the
...menu → enable Global toggle- This makes filter toggles appear automatically in all chats without requiring a workspace
OpenRouter offers powerful capabilities beyond basic LLM access:
- Image Generation: Generate and edit images through models like Gemini and GPT-5 Image
- Performance Routing: Optimize for throughput (
:nitro), cost (:floor), or latency across multiple providers serving the same model - Extended Reasoning: Enable step-by-step thinking for complex queries (
:thinkingvariant orreasoningparameter) - Real-time Web Search: Access current information via native provider search or Exa API (
:onlinevariant) - Structured Outputs: Force valid JSON responses with optional schema validation
- Provider Control: Fine-grained routing, privacy modes, fallbacks, and cost limits
- Automatic Fallbacks: Provider-level redundancy without configuration
OpenRouter supports two approaches for feature activation:
Model name suffixes (e.g., openai/gpt-4o:nitro, claude-3.5-sonnet:online):
- Convenient shorthand for common features
- Issue: Open WebUI Filter functions validate model names against known models before processing. Models with
:variantsuffixes are rejected at this validation stage, preventing the request from reaching OpenRouter.
Request body parameters (e.g., provider.sort = "throughput", plugins = [{"id": "web"}]):
- Equivalent functionality without modifying model names
- Compatible with Open WebUI’s model validation
- More flexible - can combine multiple features in one request
- This is the approach we use
Open WebUI supports multiple extension methods (Pipe, Filter, Action functions). We use:
Filter functions for request modification:
- Provide UI toggles for users (per-conversation enable/disable)
- Intercept requests before they reach OpenRouter (
inlethook) - Support admin-configurable settings (Valves) for customization
- Allow global settings (filters without toggles, always applied)
Pipe functions for custom models:
- Appear as selectable models in the Open WebUI interface
- Handle complete request/response cycles (e.g., image generation)
- Support streaming responses and status updates
Filters (in filters/ directory):
- Toggle Filters: User-controlled per-conversation switches for dynamic features (speed optimization, reasoning modes, web search, structured outputs)
- Global Settings Filter: Admin-configured settings applied to all requests (privacy mode, cost limits, provider preferences)
Pipes (in pipes/ directory):
- Custom models for specialized tasks (e.g., image generation with automatic model selection)
All functions use OpenRouter’s parameter-based API to avoid model name validation issues.
Format code:
uv run black filters/ pipes/Export functions to Open WebUI import format:
uv run python export.pyThis generates openrouter-functions.json ready for import into Open WebUI.
To share functions to openwebui.com: import openrouter-functions.json into your Open WebUI instance, then use the share button on each function. Copy content from COMMUNITY_README.md into the README field on the sharing page.
Generated images are cached at /app/backend/data/cache/image_generations/.
# Delete images older than 30 days
find /app/backend/data/cache/image_generations/ -name "*.png" -mtime +30 -delete- OpenRouter Docs
- https://openrouter.ai/docs
- Open WebUI Functions
- https://docs.openwebui.com/features/plugin/functions