Today someone asked me: OpenClaw is configured with the Bocha API, but the web_search tool uses Brave Search format. What to do?
Problem Analysis
OpenClaw has built-in support for two search providers:
- Brave Search (default)
- Perplexity
Bocha (api.bocha.cn) is not a built-in provider. The config only specified apiKey without a provider field, so OpenClaw defaulted to Brave's API format — which failed.
Solution: Create a Custom Skill
The fastest approach — create a Skill to wrap the Bocha API calls.
Step 1: Verify the API
First, call it directly with curl to confirm it works:
curl --location 'https://api.bocha.cn/v1/web-search' \
--header 'Authorization: Bearer YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data '{
"query": "latest AI news",
"summary": true,
"freshness": "noLimit",
"count": 5
}'
Step 2: Create Skill Structure
/root/.openclaw/skills/bocha-search/
├── SKILL.md # Documentation
└── scripts/
└── bocha_search.sh # Search script
Step 3: Write the Script
#!/bin/bash
QUERY="${1:-search query}"
COUNT="${2:-5}"
FRESHNESS="${3:-noLimit}"
API_KEY="${BOCHA_API_KEY:-sk-xxx}"
curl -s --location 'https://api.bocha.cn/v1/web-search' \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data "{
\"query\": \"$QUERY\",
\"summary\": true,
\"freshness\": \"$FRESHNESS\",
\"count\": $COUNT
}"
Step 4: Usage
# Search for latest AI news
/root/.openclaw/skills/bocha-search/scripts/bocha_search.sh "latest AI news" 5
# Search for today's news
/root/.openclaw/skills/bocha-search/scripts/bocha_search.sh "today's news" 10 "pd"
Parameters
| Parameter | Description | Default |
|---|---|---|
| query | Search keywords | Required |
| count | Number of results (1-10) | 5 |
| freshness | Time filter: noLimit, pd (24h), pw (week), pm (month) | noLimit |
| summary | AI-generated summary | true |
Conclusion
When built-in tools don't meet your needs, Skills are the most flexible extension method. Bocha API supports Chinese search with a friendly response format — perfect as a Chinese search supplement for OpenClaw.
Next time you encounter a similar problem, remember: first verify with Plan 1 (direct API call), then wrap it as a Skill. Fastest and most reliable approach.
🚀 Bazinga!