owndev/Open-WebUI-Functions
Open-WebUI-Functions is a collection of custom pipelines, filters, and integrations designed to enhance Open WebUI. These functions enable seamless interactions with Azure AI, N8N, Google Gemini and other AI models, providing dynamic request handling, preprocessing, and automation.
Overview
Open‑WebUI‑Functions is a small library of Python functions that plug into the Open WebUI chat‑interface‑by‑the‑side LLM‑assistant (‑‑ the open‑source project open‑webui/open‑webui). The repo supplies ready‑made pipelines, filters and integrations so you can connect Open WebUI to external AI services (Azure OpenAI, Google Gemini, Infomaniak, N8N, etc.), preprocess or post‑process data, and keep secrets such as API keys encrypted.
Key Features
| Feature | What it does | Why it matters |
|---|---|---|
| Custom pipelines | Python‑based processing steps that call external LLM providers, perform RAG look‑ups, or transform data. | Lets you use Azure, Google Gemini, Infomaniak, N8N, … without writing boiler‑plate code. |
| Filters | Small hooks that run before/after a request (e.g., token‑usage tracking, Google‑Search grounding). | Gives you observability and extra logic without touching the core UI. |
| Integrations | Ready‑to‑paste functions for Azure AI, N8N workflow automation, Infomaniak AI tools, Google Gemini, etc. | Reduces the friction of wiring up third‑party services. |
| Streaming & non‑streaming support | Handles both real‑time token streams and batch responses. | Works with chat‑style streaming as well as classic request‑response calls. |
| Secure secret handling | Automatic encryption of API keys using the WEBUI_SECRET_KEY env‑var. |
Keeps credentials safe inside the Open WebUI database. |
| Env‑var configuration | All behaviour (model list, timeouts, token‑tracking, etc.) is toggled via environment variables. | Makes the same function usable in many deployment scenarios. |
How It Works
- Install Open WebUI (the main chat UI).
- In the Admin → Functions panel, click Add New Function and paste the Python code from this repo.
- Set any required environment variables (e.g.,
AZURE_AI_API_KEY,WEBUI_SECRET_KEY). - The function becomes a selectable “pipeline” inside Open WebUI; when a user sends a message, the pipeline forwards the request to the external provider, applies any configured filters, and returns the answer (streaming if supported).
- Optional filters like Time Token Tracker can log usage to Azure Log Analytics for observability.
Typical Use‑Cases
| Use‑case | Example pipeline | What you get |
|---|---|---|
| Enterprise LLM with Azure | azure_ai_foundry.py |
Azure OpenAI inference, Azure Search‑based RAG, citation cards, token usage stored in Open WebUI. |
| Automation via N8N | n8n.py |
Send chat messages to an N8N webhook, receive processed replies, see tool‑call summaries. |
| Google Gemini generation | google_gemini.py |
Access Gemini models, stream text, generate images or videos, track tokens, optional Google Search grounding. |
| Observability | time_token_tracker.py |
Logs response time and token counts, optionally pushes to Azure Log Analytics. |
Getting Started (quick steps)
# 1. Run Open WebUI (Docker, Helm, etc.)
# 2. Open the UI → Admin Settings → Functions
# 3. Add a new function and paste the desired *.py file from this repo
# 4. Set required env vars, e.g.:
export WEBUI_SECRET_KEY="my‑random‑secret"
export AZURE_AI_API_KEY="<key>"
# 5. Save – the pipeline now appears in the model selector.
Documentation & Support
- Docs folder – detailed guides for each integration (Azure citations, N8N usage, Google Gemini settings, etc.).
- Tests – Docker‑based end‑to‑end tests live under
tests/e2e/. - Issues & PRs – community can contribute new pipelines or filters.
- License – MIT (see
LICENSE).
Open‑WebUI‑Functions does not provide its own LLM; it merely extends the existing Open WebUI platform with ready‑made connectors and utilities for real‑world AI workflows.
Related
- Project
- Project
- Project
- Project
- Project