@jwongart

Independent OpenRouter Perplexity Search

OpenClaw plugin that provides an independent OpenRouter Perplexity Search tool.

当前版本
v0.0.6
code-plugin社区source-linked

independent-openrouter-perplexity-search

OpenClaw tool plugin that exposes openrouter_perplexity_search, an independent OpenRouter Perplexity Search tool.

This tool consumes OpenRouter credits, but the search quality is strong. It can work independently of OpenClaw's built-in web_search. Use it when the built-in web_search results are not satisfactory and better search results are needed.

Install

openclaw plugins install npm:@jwongart/independent-openrouter-perplexity-search@0.0.6

Configuration

The tool input mirrors OpenRouter request fields, so request timeout is configured at plugin level:

{
  "plugins": {
    "entries": {
      "independent-openrouter-perplexity-search": {
        "config": {
          "timeout_ms": 120000
        }
      }
    }
  }
}
  • timeout_ms: request timeout in milliseconds, from 15000 to 300000. Default is 120000.

Tool

  • openrouter_perplexity_search: calls OpenRouter Chat Completions with model=perplexity/sonar-pro-search.

Inputs

Inputs mirror the OpenRouter perplexity/sonar-pro-search Chat Completions API fields that OpenRouter currently reports for this model. The plugin fixes model to perplexity/sonar-pro-search.

  • messages (required): OpenRouter Chat Completions messages array.
  • max_tokens: maximum output tokens. OpenRouter currently reports max_completion_tokens=8000 for this model.
  • temperature, top_p, top_k, frequency_penalty, presence_penalty: OpenRouter request parameters.
  • reasoning, include_reasoning, response_format: OpenRouter request parameters for reasoning and structured output behavior.
  • web_search_options: Perplexity/OpenRouter native web search options, including search_context_size and user_location.

OpenRouter model metadata currently lists these supported parameters for this model: frequency_penalty, include_reasoning, max_tokens, presence_penalty, reasoning, structured_outputs, temperature, top_k, top_p, and web_search_options. Perplexity direct-API fields such as search_domain_filter and search_recency_filter are not exposed here unless OpenRouter adds them to this model's supported parameters.

Output

The tool returns natural-language content for OpenClaw plus structured details:

  • content: the full Perplexity answer, a compact Resources list, plus model and any returned usage/cost summary such as Usage: 23 prompt + 28 completion = 51 tokens and Estimated cost: $0.00649. Resources prefer OpenRouter search_results when returned, then fall back to citations/annotations. Each resource uses a natural display style: title plus URL when a title exists, optional snippet text only when OpenRouter returns a real snippet-like field (snippet, content, text, or description), and URL-only citations stay URL-only. Snippets are capped to keep tool output compact.
  • details.openrouterRequest: the exact JSON body sent to OpenRouter.
  • details.openrouterResponse: the raw OpenRouter Chat Completions response, including fields such as id, model, created, choices, usage, and provider-specific fields such as citations when returned.
  • details.retryCount: retry count for transient 429/5xx/network failures.

API Key

The plugin reads the OpenRouter API key in this order:

  1. OPENROUTER_API_KEY from the Gateway process environment.
  2. env.OPENROUTER_API_KEY from ~/.openclaw/openclaw.json.
  3. models.providers.openrouter.apiKey from ~/.openclaw/openclaw.json.

The API key is never returned in tool output.

Build

npm install
npm run plugin:build
npm run plugin:validate
npm test

License

MIT

源码与版本

源码仓库

jwong-art/independent-openrouter-perplexity-search

打开仓库

源码提交

68dec6aeb945fb859e92d4da948389e6fc13351a

查看提交

安装命令

openclaw plugins install clawhub:@jwongart/independent-openrouter-perplexity-search

元数据

  • 包名: @jwongart/independent-openrouter-perplexity-search
  • 创建时间: 2026/06/02
  • 更新时间: 2026/06/02
  • 执行代码:
  • 源码标签: v0.0.6

兼容性

  • 构建于 OpenClaw: 2026.5.28
  • 插件 API 范围: >=2026.5.17
  • 标签: latest
  • 文件数: 6