npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openclaw-litellm-search-provider

v2026.3.24

Published

OpenClaw web search provider plugin for LiteLLM Search API

Readme

OpenClaw LiteLLM Search Provider Plugin

npm version License: MIT

A production-ready web search provider plugin for OpenClaw that bridges to LiteLLM's Search API. Supports multiple search backends (Brave, Tavily, etc.) through LiteLLM's unified interface.

Features

  • 🔍 Unified Search Interface: Access multiple search engines through LiteLLM's single API
  • 🔐 Secure Credential Handling: API keys from environment variables or encrypted config
  • Smart Caching: Configurable response caching with TTL
  • 🌍 Region Support: Country-specific search results
  • 🔒 Safety First: HTTP warnings, credential sanitization, and secure defaults
  • 🎯 Configurable: Flexible configuration for baseUrl, timeout, result count, and domain filtering
  • 📦 Zero Runtime Dependencies: Bundled for minimal footprint

Installation

From npm (Recommended)

openclaw plugins install @openclaw/litellm-search-provider

From Source

git clone https://github.com/your-org/litellm-search-provider.git
cd litellm-search-provider
npm install
npm run build
openclaw plugins install -l $(pwd)

Quick Start

1. Configure LiteLLM

Ensure your LiteLLM instance has a search tool configured. Example litellm-config.yaml:

model_list:
  - model_name: "search"
    litellm_params:
      model: "huggingface/WizardLM/WizardLM-13B-V1.0"

tools:
  - name: "search"
    backend: "brave"
    api_key: "your-brave-api-key"

2. Set Environment Variables

export LITELLM_API_KEY="your-litellm-api-key"

3. Configure OpenClaw

Add to your ~/.openclaw/openclaw.json:

{
  "tools": {
    "web": {
      "search": {
        "enabled": true,
        "provider": "litellm-search-provider",
        "maxResults": 5,
        "timeoutSeconds": 30,
        "cacheTtlMinutes": 15,
        "litellm-search-provider": {
          "baseUrl": "http://localhost:4000",
          "searchToolName": "search",
          "defaultCountry": "US",
          "passDomainFilter": true
        }
      }
    }
  },
  "plugins": {
    "entries": {
      "litellm-search-provider": {
        "enabled": true,
        "config": {
          "webSearch": {
            "apiKey": {
              "provider": "default",
              "source": "env",
              "id": "LITELLM_API_KEY"
            }
          }
        }
      }
    }
  }
}

4. Use in OpenClaw

openclaw agent --agent main --message "Search for the latest news about AI agents"

Configuration Reference

OpenClaw Configuration (openclaw.json)

tools.web.search Settings

| Field | Type | Default | Description | |-------|------|---------|-------------| | enabled | boolean | false | Enable/disable web search | | provider | string | - | Must be "litellm-search-provider" | | maxResults | number | 5 | Maximum results per search (1-20) | | timeoutSeconds | number | 30 | Search timeout in seconds | | cacheTtlMinutes | number | 15 | Cache time-to-live in minutes |

Provider-Specific Settings (tools.web.search.litellm-search-provider)

| Field | Type | Required | Description | |-------|------|----------|-------------| | baseUrl | string | Yes | LiteLLM instance URL (e.g., http://localhost:4000) | | searchToolName | string | Yes | Name of the search tool in LiteLLM config | | apiKey | SecretRef | No | API key (can use env var instead) | | defaultCountry | string | No | Default country code (e.g., "US", "DE") | | passDomainFilter | boolean | No | Enable domain filtering support | | timeoutSeconds | number | No | Override global timeout |

API Key Configuration

Three ways to configure the LiteLLM API key:

1. Environment Variable (Recommended)

export LITELLM_API_KEY="sk-..."

2. OpenClaw Config with Environment Reference

{
  "plugins": {
    "entries": {
      "litellm-search-provider": {
        "config": {
          "webSearch": {
            "apiKey": {
              "provider": "default",
              "source": "env",
              "id": "LITELLM_API_KEY"
            }
          }
        }
      }
    }
  }
}

3. Hardcoded in Config (Not Recommended)

{
  "plugins": {
    "entries": {
      "litellm-search-provider": {
        "config": {
          "webSearch": {
            "apiKey": "sk-..."
          }
        }
      }
    }
  }
}

Usage Examples

Basic Search

// In OpenClaw agent
"Search for Python async/await best practices"

Region-Specific Results

"Search for local news in Germany"
// Uses defaultCountry: "DE" if configured

Domain Filtering

"Search for React documentation on react.dev only"
// Requires passDomainFilter: true in config

Search Backends

Works with any LiteLLM-supported backend:

  • Brave Search: Privacy-focused search engine
  • Tavily: AI-optimized search API
  • Google Custom Search: Google's search API
  • Bing Search: Microsoft's search API
  • DuckDuckGo: Privacy-focused alternative
  • Custom: Any OpenAI-compatible search API

Configure backends in your LiteLLM instance, then reference by tool name in OpenClaw.

Error Handling

The plugin provides clear error messages for common issues:

| Error | Cause | Solution | |-------|-------|----------| | missing_baseUrl | LiteLLM URL not configured | Add baseUrl to config | | missing_searchToolName | Tool name not specified | Add searchToolName to config | | missing_litellm_api_key | No API key found | Set LITELLM_API_KEY env var or config | | authentication error (401/403) | Invalid API key | Verify API key is correct | | tool not found (404) | Tool doesn't exist in LiteLLM | Check searchToolName matches LiteLLM config | | upstream error (5xx) | LiteLLM server error | Check LiteLLM logs |

Security Features

HTTP Warning

If you configure a non-localhost baseUrl with HTTP (not HTTPS), the plugin warns:

WARNING: Using HTTP (not HTTPS) for non-localhost baseUrl: http://example.com:4000.
This may expose credentials to network inspection.

Credential Sanitization

Error messages automatically sanitize sensitive data:

  • API keys matching sk-[alphanumeric]{20+}sk-***
  • Bearer tokens → Bearer ***
  • API key parameters → api_key=***

Trusted Endpoints

Uses OpenClaw's withTrustedWebSearchEndpoint for secure HTTP requests with timeout enforcement.

Development

Prerequisites

  • Node.js 22+
  • npm or pnpm
  • OpenClaw installed globally
  • LiteLLM instance running

Setup

git clone https://github.com/your-org/litellm-search-provider.git
cd litellm-search-provider
npm install

Build

npm run build

Test

npm test

Lint

npm run lint

Architecture

litellm-search-provider/
├── src/
│   └── litellm-search-provider.js  # Main implementation
├── dist/
│   └── index.js                    # Bundled output
├── index.js                        # Entry point
├── openclaw.plugin.json            # Plugin manifest
├── package.json                    # Package metadata
└── README.md                       # This file

Key Components

Entry Point (index.js)

  • Exports register() function
  • Registers web search provider with OpenClaw API

Provider Implementation (src/litellm-search-provider.js)

  • Schema definition (TypeBox)
  • Configuration resolution
  • Search execution
  • Result normalization
  • Error handling
  • Caching logic

Manifest (openclaw.plugin.json)

  • Plugin metadata
  • Configuration schema
  • Provider capabilities

Troubleshooting

Plugin Not Loading

Symptom: Error Cannot find module 'openclaw/plugin-sdk/provider-web-search'

Solution: Ensure OpenClaw is installed globally and accessible:

which openclaw  # Should show path
openclaw --version

If using local installation:

cd litellm-search-provider
mkdir -p node_modules
ln -sf $(which openclaw | xargs dirname | xargs dirname)/lib/node_modules/openclaw node_modules/openclaw

No Search Results

  1. Verify LiteLLM is running: curl http://localhost:4000/health
  2. Check search tool exists: Review LiteLLM config
  3. Test search tool directly: curl -X POST http://localhost:4000/v1/search/search -H "Authorization: Bearer $LITELLM_API_KEY" -H "Content-Type: application/json" -d '{"query":"test","max_results":5}'
  4. Check OpenClaw logs: openclaw gateway logs

Slow Performance

  • Enable caching: cacheTtlMinutes: 15
  • Reduce max results: maxResults: 3
  • Check network latency to LiteLLM
  • Consider using a search backend closer to your region

Contributing

Contributions welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Support

Related Projects

Changelog

See CHANGELOG.md for version history.


Built with ❤️ for the OpenClaw community