Skip to content

Open WebUI Functions: Pipes, Filters and Actions Explained With Examples

8–12 minutes
Woman in a brick-walled loft holding a tablet with a FUNCTIONS card, hook supercharge Open WebUI

Functions are Open WebUI’s plugin system for changing how the app itself behaves. With a few lines of Python you can add a new “model” that talks to any API, translate or redact every message, add a button under each reply, or run code when a user signs up.

There are four kinds: Pipes, Filters, Actions and, since Open WebUI 0.10.0, Events. Open WebUI works out which kind you wrote from the class name, so there is nothing to configure.

Functions are powerful because they run as Python on your server, which also makes them the most dangerous thing you can install. Only admins can add them, and you should read every line before you do.

This guide explains each type with a minimal example, how to install from the community library or a URL, Valves and UserValves, attaching functions to specific models, Functions vs Tools, and fixes for functions that will not load.

It follows Open WebUI’s official Functions documentation as of late November 2026.

TL;DR

  • Where: Admin Panel > Functions. Create, import from URL, or get from the community library.
  • Pipe: adds a selectable model (any API or custom logic).
  • Filter: edits messages on the way in (inlet), while streaming (stream) and on the way out (outlet).
  • Action: adds a button under chat messages.
  • Event: runs on system events such as sign-up (0.10.0+).
  • Security: functions run arbitrary Python on your server. Review code before saving.

What Functions Are

Functions are modular Python plugins stored in Open WebUI’s database as source code, loaded at runtime and executed on the server. Administrators create and manage them; regular users only see the results, such as a new model in the list or a new button in the chat.

The docs give a feel for the range: connect a provider that does not use the OpenAI API, build a smart home controller, add real-time translation, enforce compliance rules, generate charts, or trigger external workflows from a button.

If you have not set up Open WebUI yet, start with our Open WebUI and Ollama setup guide.

The Four Function Types

Type Class name What it does What users see
Pipe class Pipe Adds a custom model or agent A selectable model in the model list
Filter class Filter Intercepts data going to and from models Nothing, or an on/off switch if toggleable
Action class Action Adds an interactive button to messages A button on chat messages
Event class Event Runs code on system events (0.10.0+) Nothing; runs in the background

When you save a function, Open WebUI looks for a top-level class named Pipe, Filter, Action or Event, in that order. The first one found sets the type, so a file with both Pipe and Filter becomes a Pipe.

Install a Function

From the community library

  1. Browse the community library at openwebui.com and open a function.
  2. Click Get and enter your instance URL, for example http://localhost:3000.
  3. Click Import to Open WebUI. You land in the Function Editor.
  4. Read the code, then click Save.

From a URL

  1. Go to Admin Panel > Functions.
  2. Click Import from URL and paste a link to the Python file. GitHub links are converted to raw file links automatically.
  3. Review and save.

Write your own

  1. Go to Admin Panel > Functions and click Create.
  2. Enter an ID (letters, numbers and underscores only), a name and a description.
  3. Write the Python code and click Save. The type is detected for you.

After saving, check that the function’s Active toggle is on before testing. Functions created through the API start inactive.

You can add metadata in a docstring at the top of the file, which Open WebUI reads as YAML:

"""
title: My Custom Function
author: your_name
version: 1.0.0
required_open_webui_version: 0.4.0
requirements: requests, beautifulsoup4
"""

Packages listed under requirements are installed with pip the first time the function loads, unless ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS is turned off.

Pipe: Add a Custom Model

A Pipe registers itself as a model. When someone selects it and sends a message, your pipe() method handles the whole request, with or without an LLM behind it. This is the official minimal example:

from pydantic import BaseModel, Field

class Pipe:
    class Valves(BaseModel):
        MODEL_ID: str = Field(default="")

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

    async def pipe(self, body: dict):
        print(self.valves, body)
        return "Hello, World!"

Typical uses:

  • Providers without an OpenAI-style API, such as native Anthropic or Google Vertex endpoints.
  • Agents and workflows that call tools and reason over several steps.
  • Non-LLM interfaces, like a database query tool, a calculator or a smart home controller.
  • Routers and proxies that add caching, load balancing or cost tracking.

One Pipe can also expose several models, which the docs call a manifold: add a pipes() method that returns a list of {"id": ..., "name": ...} entries.

Filter: Change Messages In and Out

A Filter sits between the user and the model. Its methods run at different points:

Method When it runs Example uses
inlet() Once per user turn, before the model Add context, clean input, rate limits, cost estimates
request() Before every call to the model, including calls after tool runs Stamp parameters, inject headers, enforce redaction
stream() On each streamed chunk Censor words, replace terms, count tokens
outlet() After the full response Logging, citations, disclaimers, caching

A skeleton Filter looks like this:

from pydantic import BaseModel

class Filter:
    class Valves(BaseModel):
        pass

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

    async def inlet(self, body: dict) -> dict:
        # change the user's message here
        return body

    async def outlet(self, body: dict) -> dict:
        # change or log the finished reply here
        return body

The difference between inlet and request matters once tools are involved. A turn that calls three tools makes several model calls; inlet sees only the first, while request runs before each one.

Use inlet for things that must happen once per turn, such as billing or logging, and request for rules that must apply to every call.

Set self.toggle = True in __init__ to give users an on/off switch for the filter in the chat input area.

Action: Add a Button to Messages

An Action adds a button to the message toolbar. When clicked, action() runs with access to the message and to events that can show status updates, notifications, confirmations or input boxes.

async def action(self, body: dict, __event_emitter__=None):
    await __event_emitter__({
        "type": "status",
        "data": {"description": "Processing request..."}
    })
    # do the work, then notify the user
    await __event_emitter__({
        "type": "notification",
        "data": {"type": "info", "content": "Action completed successfully"}
    })

Good ideas for Actions: summarise or translate a message, export a chat to another system, generate a PDF report, send a Slack notification, or trigger a CI pipeline. Each Action’s Valves can include a priority value to control button order (lower appears first).

Valves and UserValves

Level Class Who sets it Good for
Admin Valves Administrators, via the gear icon in Admin Panel > Functions API keys, endpoints, global behaviour
User UserValves Any user, from the chat Preferred language, output format, personal API key

Both are Pydantic models nested inside your class. Values are stored in the database and loaded automatically. Event functions can have Valves but not UserValves, because events run without a user. Admins can also encrypt secret Valve values at rest.

Turn On, Make Global or Attach to Models

  • Active: enables or disables the function. Disabled functions are not loaded.
  • Global: for Filters and Actions, applies the function to every model automatically.
  • Per model: instead of Global, go to Workspace > Models, edit a model, and pick the function under Filters or Actions. This lets you, for example, apply a moderation filter only to a public-facing model.
  • Version history: admins can compare versions, roll back with Set as Production, and delete old versions.

The whole Functions page is hidden when ENABLE_FUNCTIONS is set to False.

Functions vs Tools

You want to Use
Let the model fetch live data (weather, APIs) during a reply Tool
Add a provider with a non-OpenAI API Pipe
Build a multi-step agent with your own logic Pipe
Translate, moderate or redact every message Filter
Log all requests or enforce rate limits Filter
Add an export or summarise button Action

Tools are called by the model itself, so they depend on good tool calling; see our Ollama tool calling guide. Built-in features like web search and RAG with documents may already cover what you need without a plugin.

Security Rules

The docs put it bluntly: functions execute arbitrary Python on your server. A malicious function could read your files, leak data or take over the host.

  • Only install from sources you trust, and read the code first.
  • Watch for network calls to unknown domains and for anything reading environment variables or files.
  • Keep function creation to admins (it already is), and treat the separate Tools Access user permission as root-level access.
  • Pin versions you have reviewed, and use version history to roll back.
  • Keep Open WebUI up to date with our update guide.

Troubleshooting

Saving shows a Python error

The editor runs your code before storing it. A syntax error, a failed import or a missing Pipe/Filter/Action/Event class is refused, and the previous saved version keeps running. Fix the error and save again.

My function switched itself to inactive

It failed to load outside the editor, often after a restart. A common cause is a package installed into the container by hand but not listed in requirements, so it disappears on restart. Check the log for Error loading module, add the package to requirements, then switch the function back on.

The Pipe model does not appear

Make sure the function is Active. For a manifold, check that pipes() returns a list of id and name entries.

My Filter does nothing

Turn on Global, or attach it to the model you are chatting with under Workspace > Models. If it is toggleable, switch it on in the chat.

A system prompt I add appears several times

You are inserting it in request(), which runs before every model call in a tool-using turn. Move it to inlet() or check whether it is already there.

The Functions page is missing

You are not an admin, or ENABLE_FUNCTIONS=False is set.

FAQ

What is the difference between a Pipe and a Filter?

A Pipe is a model users select. A Filter changes messages for existing models without users choosing it.

Can regular users create functions?

No. Function creation is restricted to administrators.

Where do I find ready-made functions?

In the community library on openwebui.com, which imports straight into your instance after you review the code.

Can a function install Python packages?

Yes, through the requirements line in its frontmatter, installed automatically on first load.

Can I use a function with only one model?

Yes. Leave Global off and attach the Filter or Action to that model in Workspace > Models.

What are Event functions for?

Running code on system events such as a user signing up, a chat being deleted or the server starting. They arrived in Open WebUI 0.10.0.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman in a brick-walled loft holding a tablet with a FUNCTIONS card, hook supercharge Open WebUI