#Web Tools Question
1 messages · Page 1 of 1 (latest)
Yep â web_search is not Brave-only.
OpenClawâs web_search tool supports two providers:
- Brave Search API (default) â classic structured search results (title/url/snippet)
- Perplexity Sonar â AI-synthesized answer + citations (either direct Perplexity API or via OpenRouter)
Docs: https://docs.openclaw.ai/tools/web
Provider pages: https://docs.openclaw.ai/brave-search and https://docs.openclaw.ai/perplexity
To switch, set:
{
tools: {
web: {
search: {
provider: "perplexity" // or "brave"
}
}
}
}
For Perplexity youâll need either PERPLEXITY_API_KEY (direct) or OPENROUTER_API_KEY (OpenRouter). web_fetch is separate and doesnât require Brave (itâs just HTTP fetch + readability extraction).
Hmm, ok so I install openclaw on GCP via docker. And I use openrouter as my model provider. How should I proceed with this? Can you give me clearer instructions? Thanks
If youâre running the Gateway in Docker on GCP and already use OpenRouter for LLM models, the âweb toolsâ setup is basically:
- make sure the Gateway container has
OPENROUTER_API_KEY - tell OpenClaw that
web_searchshould use Perplexity (via OpenRouter)
0) Quick sanity check
What version are you on? (this matters for config keys)
- run:
openclaw --version(ordocker compose run --rm openclaw-cli openclaw --versiondepending on your compose setup)
1) Put your OpenRouter key into the Gateway container env
In docker-compose.yml (service name may differ), add:
services:
openclaw-gateway:
environment:
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
Then in a .env file next to your compose file:
OPENROUTER_API_KEY=sk-or-...
(Alternative: you can also put it in ~/.openclaw/.env inside whatever volume you mount for OpenClaw state, but compose env is usually the clearest.)
Docs: https://docs.openclaw.ai/help/environment
2) Switch web_search to Perplexity Sonar (via OpenRouter)
In your OpenClaw config (~/.openclaw/openclaw.json in the container / mounted state dir), set:
{
tools: {
web: {
search: {
provider: "perplexity",
// optional but explicit:
perplexity: {
baseUrl: "https://openrouter.ai/api/v1"
// model is optional (defaults to sonar-pro)
}
}
}
}
}
Docs: https://docs.openclaw.ai/tools/web and https://docs.openclaw.ai/perplexity
3) Restart the gateway container
docker compose restart openclaw-gateway
4) Test
In chat, ask it something that forces a search like: âUse web_search to find âŠâ and you should see it route through the Perplexity provider.
If you paste (1) your openclaw --version and (2) the relevant parts of your docker-compose.yml + your tools.web.search config block (redact keys), I can tell you exactly where to put what for your current layout.
Hmm, but I've already configured the model via the docker compose command. is there anyway we could od this in a cleaner way?
Yep â if you already have OPENROUTER_API_KEY set for your model provider, the cleanest way is: donât touch Docker env again. Just flip the web_search provider in OpenClaw config.
Clean / minimal (reuse your existing OpenRouter key)
Run this via the CLI container:
docker compose run --rm openclaw-cli openclaw config set tools.web.search.provider "perplexity"
# optional (usually not needed if your key is sk-or-...):
docker compose run --rm openclaw-cli openclaw config set tools.web.search.perplexity.baseUrl "https://openrouter.ai/api/v1"
# optional (defaults to sonar-pro):
docker compose run --rm openclaw-cli openclaw config set tools.web.search.perplexity.model "perplexity/sonar-pro"
docker compose restart openclaw-gateway
Thatâs it. Now web_search will use Perplexity Sonar via OpenRouter, using the same OPENROUTER_API_KEY you already configured for LLM calls.
Why this is âcleanâ
- Secrets stay where they already are (compose env /
.env) - Only behavior change is in config (
tools.web.search.provider) - No manual editing of JSON5 needed
Docs:
- Web tools: https://docs.openclaw.ai/tools/web
- Perplexity Sonar: https://docs.openclaw.ai/perplexity
openclaw config set: https://docs.openclaw.ai/cli/config
Hmm, when I run this: docker compose run --rm openclaw-gateway openclaw config set tools.web.search.provider "perplexity", it's giving me the following error:
Container openclaw-openclaw-gateway-run-734cc04baf4f Creating
Container openclaw-openclaw-gateway-run-734cc04baf4f Created
node:internal/modules/cjs/loader:1386
throw err;
^
Error: Cannot find module '/app/openclaw'
at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
at Function._load (node:internal/modules/cjs/loader:1192:37)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at node:internal/main/run_main_module:36:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.22.0
That error is coming from how your openclaw-gateway container is built/started: its ENTRYPOINT is trying to run node /app/openclaw, but your image doesnât actually have /app/openclaw in it. So when you do:
docker compose run openclaw-gateway openclaw config set ...
âŠitâs not running the âopenclaw binaryâ, itâs feeding args to that (broken) entrypoint.
Cleanest way (recommended): use the openclaw-cli service
In the official Docker setup there are two services:
openclaw-gateway(long-running server)openclaw-cli(for one-off commands likeconfig set,devices,dashboard, etc.)
So the command should be:
docker compose run --rm openclaw-cli config set tools.web.search.provider "perplexity"
docker compose restart openclaw-gateway
(Notice: no extra openclaw in there â the CLI containerâs entrypoint already is OpenClaw.)
You can verify it worked with:
docker compose run --rm openclaw-cli config get tools.web.search.provider
If you donât have an openclaw-cli service
Then do it inside the running gateway container instead (this avoids the ârun a new container with a weird entrypointâ problem):
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.provider "perplexity"
docker compose restart openclaw-gateway
Quick check
Run this and paste the output (no secrets) and Iâll tell you which path youâre on:
docker compose config --services
If it doesnât list openclaw-cli, I can show the minimal snippet to add it cleanly to your compose file.
yeah it only has openclaw-gateway, no openclaw-cli
That error basically means your gateway image/compose is wired to start OpenClaw via node /app/openclaw, but the file /app/openclaw doesnât exist in that container. docker compose run ⊠openclaw config ⊠ends up going through that same (broken) entrypoint.
Youâve got two good options:
Option A (fastest): run the config command inside the running gateway container
If openclaw-gateway is already up:
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.provider "perplexity"
docker compose restart openclaw-gateway
(If dist/index.js doesnât exist in your image, tell me what docker compose exec openclaw-gateway ls -áá shows for /app and Iâll adjust the command.)
Option B (cleanest long-term): add an openclaw-cli service to your compose
Add a second service that uses the same image + same mounts/env as the gateway, but overrides the entrypoint to the CLI:
services:
openclaw-cli:
image: <same image as openclaw-gateway>
entrypoint: ["node", "dist/index.js"]
volumes:
# copy the same volumes as openclaw-gateway so it edits the same ~/.openclaw config
- ...
environment:
# copy the same env as openclaw-gateway (OPENROUTER_API_KEY, etc.)
- ...
Then you can do the âniceâ commands the docs mention:
docker compose run --rm openclaw-cli config set tools.web.search.provider "perplexity"
docker compose restart openclaw-gateway
This matches the intended Docker flow in the docs: https://docs.openclaw.ai/install/docker
If you paste your docker-compose.yml service block for openclaw-gateway (just the image:, command:/entrypoint:, volumes:, environment: â redact keys), I can give you an exact openclaw-cli block that fits your setup.
Here's my docker-compose.yml file content:
services:
openclaw-gateway:
image: ${OPENCLAW_IMAGE}
build: .
restart: unless-stopped
env_file:
- .env
environment:
- HOME=/home/node
- NODE_ENV=production
- TERM=xterm-256color
- OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND}
- OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT}
- OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN}
- GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD}
- XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
- PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes:
- ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw
- ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace
ports:
# Recommended: keep the Gateway loopback-only on the VM; access via SSH tunnel.
# To expose it publicly, remove the `127.0.0.1:` prefix and firewall accordingly.
- "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789"
command:
[
"node",
"dist/index.js",
"gateway",
"--bind",
"${OPENCLAW_GATEWAY_BIND}",
"--port",
"${OPENCLAW_GATEWAY_PORT}",
]
Your compose looks totally fine (you do have dist/index.js), so the clean fix is: add a tiny openclaw-cli service that uses the same image/mounts/env, but overrides the imageâs entrypoint.
1) Add this service to your docker-compose.yml
services:
openclaw-gateway:
# ... your existing gateway service unchanged ...
openclaw-cli:
image: ${OPENCLAW_IMAGE}
build: .
env_file:
- .env
environment:
- HOME=/home/node
- NODE_ENV=production
- TERM=xterm-256color
- OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND}
- OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT}
- OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN}
- GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD}
- XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
- PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes:
- ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw
- ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace
entrypoint: ["node", "dist/index.js"]
This bypasses the â/app/openclaw module not foundâ entrypoint youâre hitting when using docker compose run.
2) Run the config change via the CLI container
docker compose run --rm openclaw-cli config set tools.web.search.provider "perplexity"
# (optional, explicit OpenRouter base URL)
docker compose run --rm openclaw-cli config set tools.web.search.perplexity.baseUrl "https://openrouter.ai/api/v1"
docker compose restart openclaw-gateway
Verify:
docker compose run --rm openclaw-cli config get tools.web.search.provider
That should print perplexity.
One-off alternative (no compose changes)
If you just want to do it once without adding openclaw-cli, you can override entrypoint inline:
docker compose run --rm --entrypoint "node" openclaw-gateway dist/index.js config set tools.web.search.provider "perplexity"
docker compose restart openclaw-gateway
Docs ref: https://docs.openclaw.ai/install/docker and https://docs.openclaw.ai/tools/web
wait but after I change the content of the docker-compose.yml file, do I need to restart the containers or do anything?
Yes.
-
If you only add the new
openclaw-cliservice: you donât need to restart the runningopenclaw-gatewaycontainer just for that. The new service will be picked up the next time you run it withdocker compose run ....You can just do:
docker compose run --rm openclaw-cli config set tools.web.search.provider "perplexity" -
After you run any
openclaw config set ...that changes gateway behavior: restart the gateway so it reloads config:docker compose restart openclaw-gateway
Thatâs the only restart you need for this change.
Ok done. ÆŻhat do I nĂȘd to do náșœt?
Next steps are basically: verify config â restart gateway â test the tool.
- Verify the setting stuck
docker compose run --rm openclaw-cli config get tools.web.search.provider
Should print perplexity.
(Optional but useful)
docker compose run --rm openclaw-cli config get tools.web.search.perplexity.baseUrl
docker compose run --rm openclaw-cli config get tools.web.search.perplexity.model
- Restart the gateway to pick up the config change
docker compose restart openclaw-gateway
- Test from chat
Send a message to your OpenClaw chat like:
- âUse
web_searchto find ⊠and include the sources.â
If it fails, paste the error text and also run:
docker compose logs -n 200 openclaw-gateway
Common gotcha: make sure your Gateway environment really has OPENROUTER_API_KEY available (and your OpenRouter account has credits), since Perplexity-via-OpenRouter uses that key.
hmm, I only set the provider, I haven't set the model or anything. Can you give me back the concrete instructions to set perplexity and its model and how we can test it? Thanks
Do this in order (assuming you want Perplexity Sonar via OpenRouter, since you already have OpenRouter set up):
1) Set Perplexity as the web_search provider
docker compose run --rm openclaw-cli config set tools.web.search.provider "perplexity"
2) (Recommended) Force it to use OpenRouterâs endpoint
This removes any ambiguity and guarantees it uses your OPENROUTER_API_KEY:
docker compose run --rm openclaw-cli config set tools.web.search.perplexity.baseUrl "https://openrouter.ai/api/v1"
3) Set the Perplexity model (pick one)
Most people start with sonar-pro:
docker compose run --rm openclaw-cli config set tools.web.search.perplexity.model "perplexity/sonar-pro"
Other options:
- fast/cheaper-ish:
docker compose run --rm openclaw-cli config set tools.web.search.perplexity.model "perplexity/sonar" - deeper research:
docker compose run --rm openclaw-cli config set tools.web.search.perplexity.model "perplexity/sonar-reasoning-pro"
4) Verify the config
docker compose run --rm openclaw-cli config get tools.web.search.provider
docker compose run --rm openclaw-cli config get tools.web.search.perplexity.baseUrl
docker compose run --rm openclaw-cli config get tools.web.search.perplexity.model
5) Restart the gateway
docker compose restart openclaw-gateway
6) Test it
In your OpenClaw chat, ask something that forces web search, e.g.:
âUse
web_searchto find the official docs for Perplexity Sonar on OpenRouter, and return 5 results.â
If it errors, paste:
- the chat error message, and
docker compose logs -n 200 openclaw-gateway
Docs references:
Hmm, openclaw is responding like this:
That's great to hear you've enabled Perplexity!
However, the web_search tool I have access to is specifically configured to use the Brave Search API. I don't have a direct way to verify or switch to using Perplexity through this tool.
Could you tell me how you enabled Perplexity? If you've set it up in a way that I can access it via a specific command or a new skill, I'd be happy to try using it.
In the meantime, if you'd like me to check the weather for Hanoi, I can try using Brave Search. We'll just need to make sure the Brave Search API key is configured first, as we encountered an issue with that earlier. Let me know how you'd like to proceed!
That reply youâre seeing is almost certainly the LLM getting confused by the tool description (older wording says âBraveâ), not the gateway actually being locked to Brave.
Letâs verify what the gateway is actually configured to do, and then do a ârealâ test.
1) Verify the running gateway sees your config
Run these on the VM:
docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.provider
docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.perplexity
You want:
- provider =
perplexity - perplexity block shows your
model/baseUrl(if you set them)
2) Verify the gateway has an OpenRouter key available (for Perplexity-via-OpenRouter)
docker compose exec openclaw-gateway sh -lc 'echo ${OPENROUTER_API_KEY:+OPENROUTER_API_KEY_IS_SET}'
If that prints nothing, your models might be using an auth profile, but web_search(perplexity via OpenRouter) still needs OPENROUTER_API_KEY (or you set tools.web.search.perplexity.apiKey in config).
3) Restart gateway (after any config changes)
docker compose restart openclaw-gateway
4) Test it (and confirm via logs)
In one terminal:
docker compose logs -f openclaw-gateway
Then in chat, send something very explicit like:
âCall
web_searchfor:openrouter perplexity sonar-proand paste the raw tool output.â
If itâs actually using Perplexity, you should see tool output that looks like an answer with citations, not just a list of Brave-style results â and the gateway logs should show requests going to OpenRouter/Perplexity.
If you paste the output of step (1) + step (2) (no secrets), I can tell you exactly whatâs missing (most common is simply OPENROUTER_API_KEY not present in the gateway container env).
Ahh, it's saying like this:
mike@openclaw:~/openclaw$ docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.provider
đŠ OpenClaw 2026.2.13 (unknown) â Ship fast, log faster.
Config path not found: tools.web.search.provider
mike@openclaw:~/openclaw$ docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.perplexity
đŠ OpenClaw 2026.2.13 (unknown) â We ship features faster than Apple ships calculator updates.
Config path not found: tools.web.search.perplexity
config get ... saying âConfig path not foundâ just means: those keys arenât currently written into your openclaw.json file (OpenClaw can still have defaults at runtime, but config get wonât show defaults).
So the fix is: write the keys explicitly, then verify.
1) Set Perplexity (via OpenRouter) + model (run on the VM)
# provider switch
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.provider "perplexity"
# force OpenRouter endpoint (recommended since you already use OpenRouter)
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.perplexity.baseUrl "https://openrouter.ai/api/v1"
# choose the model
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.perplexity.model "perplexity/sonar-pro"
2) Verify itâs now in config
docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.provider
docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.perplexity.baseUrl
docker compose exec openclaw-gateway node dist/index.js config get tools.web.search.perplexity.model
After you set them, these should return values (not âpath not foundâ).
3) Restart gateway (safe)
docker compose restart openclaw-gateway
4) Test it (and watch logs)
In one terminal:
docker compose logs -f openclaw-gateway
Then in chat send something explicit like:
âUse
web_searchfor:openrouter perplexity sonar-proand include citations.â
If anything errors, paste:
- the error message from chat, and
- the relevant lines from
docker compose logs -f openclaw-gateway
(That earlier âitâs Brave-onlyâ response is just the model talking â the real source of truth is what the gateway logs show + what config get returns.)
Hmm,. ok one last thing I think:
It seems like even though the web_search tool can use Perplexity, it still requires an API key for it. You might need to set the PERPLEXITY_API_KEY or OPENROUTER_API_KEY environment variable for the Gateway, or configure it via tools.web.search.perplexity.apiKey.
If you're able to set that up, I can try fetching the weather for Hanoi again!
Yep â that message is correct: Perplexity web_search needs an API key, either:
OPENROUTER_API_KEY(if youâre using Perplexity via OpenRouter), orPERPLEXITY_API_KEY(direct Perplexity), ortools.web.search.perplexity.apiKeyin config.
If youâre doing Perplexity via OpenRouter (recommended in your setup)
- Make sure the Gateway container actually has
OPENROUTER_API_KEY
Run (prints only set/missing, not the key):
docker compose exec openclaw-gateway sh -lc 'test -n "$OPENROUTER_API_KEY" && echo OPENROUTER_API_KEY=set || echo OPENROUTER_API_KEY=missing'
- If itâs missing: add it to your
.env(the one referenced byenv_file: - .env):
OPENROUTER_API_KEY=sk-or-...
âŠand restart:
docker compose up -d
# or:
docker compose restart openclaw-gateway
- Keep these config values (so it uses OpenRouter + the model you chose):
docker compose exec openclaw-gateway node dist/index.js config set tools.web.search.provider "perplexity"