SuperAPI AI 工具集

pplx-cli

通用与其它

查看项目

更新于 10-16 07:58

技能介绍

用途:在终端调用 Perplexity 的 pplx CLI,执行实时网页搜索(pplx search web)和获取与查询相关的页面摘录(pplx content snippets),输出结构化 JSON,便于脚本或智能体消费。

安装:若 pplx --version 已可用则跳过。安装命令为 curl -fsSL https://github.com/perplexityai/perplexity-cli/releases/latest/download/install.sh | sh,经 SHA-256 校验、无需 sudo,安装到 ~/.local/bin/pplx(可用 PPLX_INSTALL_PATH 覆盖),需确保该目录在 PATH 中。支持 macOS arm64、Linux x86_64、Linux arm64。用 pplx update 更新,pplx update --check 仅检查是否有新版本。

认证:交互式运行 pplx auth login(需终端,密钥来自 https://www.perplexity.ai/account/api)。非交互场景(智能体、CI)改用环境变量 PERPLEXITY_API_KEY,因为 auth login 拒绝管道输入。环境变量优先于交互登录保存的凭据。未配置密钥时首个真实命令会返回 AUTHENTICATION 错误。密钥在输出中被脱敏,CLI 访问 https://api.perplexity.ai。

搜索:pplx search web "查询",stdout 返回 {hits, total, saved_to?}。可用 --output-dir 与 --stdout-preview 降低 token 占用,完整 JSON 保存到 out/web/{rand}.json。更多范围参数见 pplx search web --help。

片段:pplx content snippets "<query>" <url>...,接受 1-50 个 http(s) URL,额外位置参数是更多页面而非查询改写。stdout 返回 {results, saved_to?},每个 URL 一条结果,需逐条检查 error 字段。token 预算由 --max-tokens(默认 4096)和 --max-tokens-per-page 控制。

限制:auth login 仅限 TTY;--stdout-preview 无保存目录时不生效;search web 的额外位置参数是同一问题的改写而非独立搜索;失败时退出码 1、stdout 为空、stderr 输出一个 JSON 错误对象;日期格式为 MM/DD/YYYY;--recency-filter 不能与日期范围同用;content snippets 退出 0 不代表每个 URL 都成功;v0.2.2 及更早版本不支持 content snippets,需先 pplx update;content fetch 已移除。