Serper Search Plugin for OpenClaw
🚀 Google Search API via Serper.dev — fast, cheap, structured SERP results for your OpenClaw agents.
Features
- Dual mode: Registers as both a
web-searchprovider (can replace Brave/Tavily as default) and a standaloneserper_searchtool - Config-based API key: Store your key in plugin config, not in environment variables
- Google-quality results: Powered by Serper.dev's Google Search API
- Caching: Built-in result caching with configurable TTL
- Country & language: Supports
gl(country) andhl(language) parameters - Related searches: Returns "People Also Ask" suggestions
- 2500 free queries: Serper.dev free tier included
Requirements
- OpenClaw >= 2026.3.24-beta.2
- A Serper.dev API key (get one here)
Installation
Option 1: Install from local path
git clone https://github.com/conanwhf/serper-search-openclaw-plugin.git
openclaw plugins install /path/to/serper-search-openclaw-plugin
Option 2: Install directly from GitHub
openclaw plugins install https://github.com/conanwhf/serper-search-openclaw-plugin.git
Configuration
Step 1: Add your API key
Edit ~/.openclaw/openclaw.json and add your Serper API key to the plugin config:
{
"plugins": {
"entries": {
"serper": {
"enabled": true,
"config": {
"webSearch": {
"apiKey": "your-serper-api-key"
}
}
}
}
}
}
Or use the CLI:
openclaw configure --section web
Step 2: Restart the gateway
openclaw gateway restart
Optional: Set as default search provider
To make Serper your default web_search backend:
{
"tools": {
"web": {
"search": {
"provider": "serper"
}
}
}
}
Optional: Default country and language
{
"plugins": {
"entries": {
"serper": {
"enabled": true,
"config": {
"webSearch": {
"apiKey": "your-serper-api-key",
"defaultGl": "sg",
"defaultHl": "en"
}
}
}
}
}
}
Usage
As a standalone tool (serper_search)
The plugin registers a serper_search tool that is always available, regardless of which search provider is set as default:
# In your agent conversation:
Search the web for "OpenAI GPT-5 release date" using serper_search
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | ✅ | Search query string |
count | number | ❌ | Number of results (1-10, default: 10) |
gl | string | ❌ | Country code (e.g., us, sg, cn) |
hl | string | ❌ | Language code (e.g., en, zh, ja) |
As the default web_search provider
When set as the default search provider (tools.web.search.provider: "serper"), all web_search tool calls will route through Serper.
As a web-search provider (non-default)
Even when not the default, the provider is registered and available. Other plugins or tools can reference it by id serper.
Architecture
serper-search-openclaw-plugin/
├── index.js # Plugin entry point
├── openclaw.plugin.json # Plugin manifest
├── package.json # NPM package config
├── src/
│ └── serper-web-search-provider.js # Core provider + tool logic
└── README.md # This file
How it works
-
index.js— Plugin entry usingdefinePluginEntry(). Registers both a web-search provider and a standalone tool. -
src/serper-web-search-provider.js— Contains:createSerperWebSearchProvider()— Registers theserperweb-search provider with credential management, onboarding UI hints, and scoped config resolution.createSerperSearchToolDefinition()— Creates the standaloneserper_searchtool.callSerperSearch()— Core HTTP client calling Serper.dev's/searchendpoint.- Built on OpenClaw's
plugin-sdk/provider-web-searchfor caching, content wrapping, and config helpers.
-
openclaw.plugin.json— Manifest declaring the plugin id, capabilities, config schema, and UI hints.
Serper.dev API Reference
This plugin uses the Serper.dev Google Search API:
- Endpoint:
POST https://google.serper.dev/search - Auth:
X-API-KEYheader - Free tier: 2,500 queries
- Pricing: $2 per 1,000 queries after free tier
Comparison with Other Search Providers
| Feature | Serper | Brave | Tavily |
|---|---|---|---|
| Backend | Brave Index | Multiple | |
| Free tier | 2,500 queries | 2,000 queries | 1,000 queries |
| Chinese queries | Moderate | Good | Good |
| English queries | Excellent | Good | Good |
| Related searches | ✅ People Also Ask | ❌ | ✅ |
| Country/language params | ✅ gl, hl | ✅ country, search_lang | ❌ |
| Price (after free) | $2/1K | $3/1K | Variable |
Troubleshooting
Plugin not loading
openclaw plugins list | grep -i serper
Check status is loaded. If failed, check logs:
openclaw gateway logs | grep serper
API key not found
Make sure the key is in either:
- Plugin config:
plugins.entries.serper.config.webSearch.apiKey - Environment variable:
SERPER_API_KEY
"dangerous code patterns" error
This can happen if the plugin source directory contains raw fetch + process.env patterns. Use the installed version from ~/.openclaw/extensions/serper/ instead of the source directory.
License
MIT
Links
- Serper.dev — Get your API key
- Serper.dev Docs — API documentation
- OpenClaw Docs — OpenClaw documentation
- OpenClaw Plugin SDK — Plugin development guide