#Web Tools Question

1 messages · Page 1 of 1 (latest)

toxic crescent
#

Hi, I want to ask, in here (https://docs.openclaw.ai/tools/web), it says we can either use a Brave Search approach or a Perplexity Sonar one right? Or is it strictly only for Brave?

red nebulaBOT
#
      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).

toxic crescent
#

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

red nebulaBOT
#

If you’re running the Gateway in Docker on GCP and already use OpenRouter for LLM models, the “web tools” setup is basically:

  1. make sure the Gateway container has OPENROUTER_API_KEY
  2. tell OpenClaw that web_search should use Perplexity (via OpenRouter)

0) Quick sanity check

What version are you on? (this matters for config keys)

  • run: openclaw --version (or docker compose run --rm openclaw-cli openclaw --version depending 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.

toxic crescent
#

Hmm, but I've already configured the model via the docker compose command. is there anyway we could od this in a cleaner way?

red nebulaBOT
#

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.

toxic crescent
#

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
red nebulaBOT
#

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 like config 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.

toxic crescent
#

yeah it only has openclaw-gateway, no openclaw-cli

red nebulaBOT
#

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.

toxic crescent
#

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}",
      ]
red nebulaBOT
#

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

toxic crescent
#

wait but after I change the content of the docker-compose.yml file, do I need to restart the containers or do anything?

red nebulaBOT
#

Yes.

  • If you only add the new openclaw-cli service: you don’t need to restart the running openclaw-gateway container just for that. The new service will be picked up the next time you run it with docker 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.

toxic crescent
#

Ok done. ÆŻhat do I nĂȘd to do náșœt?

red nebulaBOT
#

Next steps are basically: verify config → restart gateway → test the tool.

  1. 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
  1. Restart the gateway to pick up the config change
#
docker compose restart openclaw-gateway
  1. Test from chat
    Send a message to your OpenClaw chat like:
  • “Use web_search to 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.

toxic crescent
#

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

red nebulaBOT
#

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_search to find the official docs for Perplexity Sonar on OpenRouter, and return 5 results.”

If it errors, paste:

toxic crescent
#

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!
red nebulaBOT
#

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_search for: openrouter perplexity sonar-pro and 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).

toxic crescent
#

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
red nebulaBOT
#

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_search for: openrouter perplexity sonar-pro and 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.)

toxic crescent
#

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!
red nebulaBOT
#

Yep — that message is correct: Perplexity web_search needs an API key, either:

  • OPENROUTER_API_KEY (if you’re using Perplexity via OpenRouter), or
  • PERPLEXITY_API_KEY (direct Perplexity), or
  • tools.web.search.perplexity.apiKey in config.

If you’re doing Perplexity via OpenRouter (recommended in your setup)

  1. 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'
  1. If it’s missing: add it to your .env (the one referenced by env_file: - .env):
#
OPENROUTER_API_KEY=sk-or-...


and restart:

docker compose up -d
# or:
docker compose restart openclaw-gateway
  1. 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"