---
title: "Open WebUI Web Search: Setup, SearXNG & External API (2026)"
description: "How to turn on web search in Open WebUI, pick a provider, fix SearXNG's JSON and rate-limit gotchas, connect any search API through the external provider with a tested adapter, and when to use agentic mode."
category: "guides"
url: https://keirolabs.cloud/blog/open-webui-web-search
published: 2026-11-24
updated: 2026-11-24
---

# Open WebUI web search: setup, SearXNG, the external provider and agentic mode

## The 60-second version

**Open WebUI can search the web before it answers, so local and hosted models can cite current sources.** An admin turns it on and picks a search engine; users toggle **Web Search** in the chat box.

| Step | Where |
|---|---|
| Turn on web search | **Admin Panel → Settings → Web Search** → toggle **Web Search** |
| Pick a provider | **Web Search Engine**: SearXNG, Brave, Kagi, Exa, Tavily, SearchApi, Serper, SerpApi and more (the docs list 28 provider pages), or **external** |
| Use it in a chat | Toggle **Web Search** in the chat input |
| Search on every message | **Settings → Interface → Web Search in Chat** → `Always` |
| Let the model decide | Native function calling ("Agentic Mode") with a capable model |

**Any search API can plug in through the `external` provider:** Open WebUI POSTs `{"query", "count"}` to your URL and expects a JSON array of `{link, title, snippet}` back. There's a tested 40-line adapter below.

Details are from Open WebUI's documentation, checked in November 2026.

## How does web search work in Open WebUI?

**Two separate pieces, which is the key to debugging it.** In the docs' words: "The search engine finds pages. The web loader reads them."

1. **Web Search Engine:** turns your question into a query and returns results (title, link, snippet).
2. **Web Loader Engine:** fetches the result pages and extracts their text, which is then added to the model's context.

**When web search "doesn't work", find out which half failed.** Results with no page content point to the loader: blocked pages, timeouts, JavaScript-heavy sites. No results at all point to the search engine: wrong URL, bad key, or a SearXNG instance that's being rate-limited.

## How do I set up SearXNG with Open WebUI?

**SearXNG is the usual free, self-hosted choice.** Run a SearXNG instance, then in **Admin Panel → Settings → Web Search** choose `searxng` and enter its query URL.

**The common gotcha: enable JSON output in SearXNG.** Open WebUI reads SearXNG's JSON API, which is off by default. Add `json` to the `formats` list in SearXNG's `settings.yml` and restart it. Without that, requests return 403.

**The second gotcha: rate limits.** SearXNG queries public search engines, which throttle automated traffic. If results go empty after a burst of use, that's usually why. There are more fixes in [SearXNG API not working?](/blog/searxng-api-alternatives).

## How do I connect any search API with the "external" provider?

**The `external` engine lets Open WebUI call your own endpoint.** Configure it in **Admin Panel → Settings → Web Search**: set **Web Search Engine** to `external`, then fill in **External Web Search URL** and **External Web Search API Key**. The environment variables are `EXTERNAL_WEB_SEARCH_URL` and `EXTERNAL_WEB_SEARCH_API_KEY`. Note that the docs label this page a community contribution, not supported by the Open WebUI team.

**The contract, from the docs:**

```text
POST <EXTERNAL_WEB_SEARCH_URL>
Authorization: Bearer <EXTERNAL_WEB_SEARCH_API_KEY>
Content-Type: application/json

{"query": "the user's search query", "count": 5}

→ 200, a top-level JSON array:
[{"link": "https://…", "title": "…", "snippet": "…"}, …]   ([] on errors or no results)
```

**A tested adapter for Keirolabs,** using only the Python standard library. Run it next to Open WebUI and point the external URL at it:

```python
# Open WebUI "External" web search -> Keirolabs. Standard library only.
import json, os, urllib.request
from http.server import BaseHTTPRequestHandler, HTTPServer

KEIRO_KEY = os.environ["KEIRO_API_KEY"]
SHARED_SECRET = os.environ.get("ADAPTER_KEY", "")      # same value as EXTERNAL_WEB_SEARCH_API_KEY

def keiro_search(query: str, count: int) -> list[dict]:
    req = urllib.request.Request(
        "https://api.keirolabs.cloud/api/v2/search/lite",
        data=json.dumps({"query": query, "count": count}).encode(),
        headers={"Authorization": f"Bearer {KEIRO_KEY}", "Content-Type": "application/json"})
    with urllib.request.urlopen(req, timeout=30) as r:
        results = json.load(r)["results"]
    return [{"link": x["url"], "title": x["title"], "snippet": x.get("snippet", "")} for x in results]

class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        if SHARED_SECRET and self.headers.get("Authorization") != f"Bearer {SHARED_SECRET}":
            self.send_response(401); self.end_headers(); return
        body = json.loads(self.rfile.read(int(self.headers["Content-Length"])) or b"{}")
        try:
            out = keiro_search(body["query"], min(int(body.get("count", 5)), 20))
        except Exception:
            out = []                                    # Open WebUI expects [] on errors
        data = json.dumps(out).encode()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(data)))
        self.end_headers()
        self.wfile.write(data)

if __name__ == "__main__":
    HTTPServer(("0.0.0.0", 8000), Handler).serve_forever()
```

```bash
KEIRO_API_KEY=... ADAPTER_KEY=some-long-random-string python3 adapter.py
# Open WebUI: External Web Search URL = http://<adapter-host>:8000/search
#             External Web Search API Key = some-long-random-string
```

**We tested it with the requests Open WebUI sends.** Without the shared key it returns 401. With the key, it returns a top-level array of results with exactly `link`, `title` and `snippet`.

**Running Open WebUI in Docker?** Use `http://host.docker.internal:8000/search`, or put the adapter in the same Docker network and use its service name. `localhost` inside the container is the container itself.

**For sensitive chats, add `"zdr": True`** to the Keirolabs request body on a paid plan, and nothing about the queries is kept ([web search APIs with ZDR](/blog/web-search-api-zero-data-retention)).

## Native (agentic) web search

**With native function calling, the model decides when to search, and can search several times.** The docs describe "Native Function Calling (Agentic Mode)" as letting quality models "independently explore the web." It works best with large models that handle tool calls well. Small local models often skip the tool or loop; see [Ollama web search](/blog/ollama-web-search) for how tool calling behaves on Ollama models.

**Default mode** (search on every message when toggled) is more predictable and works with any model. **Agentic mode** gives better answers to multi-step questions on capable models.

## Tips for better web search answers in Open WebUI

- **Keep the result count modest.** Five to eight results is usually enough. Every page the loader reads goes into the context window, and small local models fill up fast ([context engineering for search agents](/blog/context-engineering-web-search-agents)).
- **Raise the context window for local models.** Search results are long; a default 2k to 8k context truncates them silently.
- **Turn on confirmation in shared instances.** `ENABLE_WEB_SEARCH_CONFIRMATION` shows a "Use Web Search?" dialog, so users know when their question leaves the server.
- **Check what the loader got.** If answers ignore the sources, the pages may have loaded empty.
- **Watch for injected instructions.** Web pages can contain text aimed at your model; see [prompt injection from web search results](/blog/prompt-injection-web-search-results).

New Keirolabs accounts get up to 2,000 free credits with no card, enough to run the adapter for a long while ([get a key](https://platform.keirolabs.cloud/register)).
