ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Connect OpenWebUI to a Search API
Tutorial

How to Connect OpenWebUI to a Search API

Replace SearXNG in OpenWebUI with a direct search API integration. Configure a custom function tool that calls Scavio and returns structured results.

Get Free API KeyAPI Docs

You can connect OpenWebUI to the Scavio search API by creating a custom Function tool in OpenWebUI's function editor. This replaces the default SearXNG integration with a reliable API-backed search that covers Google, Reddit, YouTube, and Amazon.

Prerequisites

  • OpenWebUI installed (v0.4+)
  • Scavio API key
  • Admin access to OpenWebUI

Walkthrough

Step 1: Open the Function editor in OpenWebUI

Go to Workspace > Functions > New Function. Select Tool as the function type.

Bash
# Navigate to:
# Settings > Workspace > Functions > + (Add Function)
# Function Type: Tool
# Name: web_search
# Description: Search the web using Scavio

Step 2: Write the function tool code

Paste this Python function into the OpenWebUI function editor. It calls the Scavio API and returns formatted results.

Python
import requests
from pydantic import BaseModel, Field

class Tools:
    class Valves(BaseModel):
        SCAVIO_API_KEY: str = Field(default="", description="Your Scavio API key")

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

    def web_search(
        self,
        query: str,
        platform: str = "google"
    ) -> str:
        """
        Search the web for current information.
        :param query: The search query
        :param platform: Platform to search: google, amazon, reddit, youtube
        :return: Formatted search results
        """
        try:
            r = requests.post(
                "https://api.scavio.dev/api/v1/search",
                json={"query": query, "platform": platform, "num_results": 5},
                headers={"x-api-key": self.valves.SCAVIO_API_KEY},
                timeout=15
            )
            r.raise_for_status()
            results = r.json().get("organic_results", [])
            if not results:
                return "No results found."
            lines = []
            for i, res in enumerate(results, 1):
                lines.append(f"{i}. {res.get('title')}\n   {res.get('snippet','')}\n   {res.get('link')}")
            return "\n\n".join(lines)
        except Exception as e:
            return f"Search error: {str(e)}"

Step 3: Configure the API key in Valve settings

After saving the function, click the Valve icon on the function card and enter your Scavio API key in SCAVIO_API_KEY.

Bash
# In OpenWebUI:
# Functions > web_search > Valve Settings (wrench icon)
# SCAVIO_API_KEY: your-scavio-api-key
# Save

Step 4: Enable the tool in a model chat

Start a new chat, click the tools icon, and enable 'web_search'. Test it with a query that requires current data.

Bash
# Test prompt:
# "What are the latest AI model releases in 2026? Search the web and summarize."

# Expected behavior:
# OpenWebUI calls web_search(query="latest AI model releases 2026")
# Returns top 5 results formatted as numbered list
# Model synthesizes the results into an answer

Python Example

Python
# Standalone test of the function logic before loading into OpenWebUI
import requests

SCAVIO_KEY = "your-scavio-api-key"

def web_search(query: str, platform: str = "google", num_results: int = 5) -> str:
    try:
        r = requests.post(
            "https://api.scavio.dev/api/v1/search",
            json={"query": query, "platform": platform, "num_results": num_results},
            headers={"x-api-key": SCAVIO_KEY},
            timeout=15
        )
        r.raise_for_status()
        results = r.json().get("organic_results", [])
        if not results:
            return "No results found."
        lines = []
        for i, res in enumerate(results, 1):
            lines.append(f"{i}. {res.get('title')}\n   {res.get('snippet','')}\n   {res.get('link')}")
        return "\n\n".join(lines)
    except Exception as e:
        return f"Search error: {str(e)}"

# Test before deploying to OpenWebUI
if __name__ == "__main__":
    print(web_search("latest AI models 2026"))
    print("\n" + "="*50 + "\n")
    print(web_search("Claude API pricing", platform="reddit"))

JavaScript Example

JavaScript
// Test the API call from Node.js before configuring in OpenWebUI
const SCAVIO_KEY = 'your-scavio-api-key';

async function webSearch(query, platform = 'google', numResults = 5) {
  const res = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'x-api-key': SCAVIO_KEY },
    body: JSON.stringify({ query, platform, num_results: numResults })
  });
  const data = await res.json();
  const results = data.organic_results ?? [];
  if (!results.length) return 'No results found.';
  return results.map((r, i) => `${i+1}. ${r.title}\n   ${r.snippet ?? ''}\n   ${r.link}`).join('\n\n');
}

console.log(await webSearch('latest AI models 2026'));

Expected Output

JSON
1. Anthropic Releases Claude 4 Opus with Extended Thinking
   Anthropic's latest model Claude 4 Opus introduces extended thinking mode and 200K context window...
   https://anthropic.com/news/claude-4-opus

2. OpenAI GPT-5 Benchmark Results 2026
   GPT-5 achieves state-of-the-art results on...
   https://openai.com/research/gpt-5

Related Tutorials

  • How to Add Web Search to a Local Llama Model
  • How to Set Up RAG with Search Instead of Vectors
  • How to Migrate from Exa to Scavio MCP

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

OpenWebUI installed (v0.4+). Scavio API key. Admin access to OpenWebUI. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Use Case

OpenWebUI Search Integration with Search API

Read more
Use Case

OpenWebUI Reliable Search Backend

Read more
Best Of

Best Search APIs for OpenWebUI in May 2026

Read more
Best Of

Best Search API for OpenWebUI Tools in 2026

Read more
Solution

Add Unified Search to Multi-Agent Systems with Scavio

Read more
Comparison

MCP Search Integration vs Direct API Integration

Read more

Start Building

Replace SearXNG in OpenWebUI with a direct search API integration. Configure a custom function tool that calls Scavio and returns structured results.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy