使用 Claude Code CLI 或 Codex CLI 内置的 WebSearch 工具进行免费网页搜索,无需 Tavily、Brave 或 Exa API 密钥。当用户说「websea...」时激活。
Use the bundled script to search the web via Claude Code CLI (primary) or Codex CLI (fallback). Both CLIs expose a native WebSearch tool — no third-party search API key needed.
bash
# Primary (Claude Code CLI — fast, recommended)
scripts/websearch.sh "your query"
# With result count
scripts/websearch.sh "your query" --max 3
# Explicit backend
scripts/websearch.sh "your query" --backend codex
Or use the global alias (if installed):
bash
ccws "your query"
BackendCLI flagNotesclaude (default)--allowedTools "WebSearch"Fast (~5s), clean outputcodex``--search + reasoning_effort=lowSlower (~30-60s), use as fallback
The script auto-detects which CLI is available; claude is preferred when both exist.
Install the global alias ccws for quick access:
bash
ln -sf "$(pwd)/scripts/websearch.sh" ~/.local/bin/ccws
ProblemFixclaude: command not foundInstall Claude Code CLI: npm install -g @anthropic-ai/claude-code``codex: command not foundInstall Codex CLI: npm install -g @openai/codexClaude returns empty outputCheck claude auth status; re-login if expiredCodex times outNormal — use --backend claude insteadNot inside a trusted directory (Codex)Script handles this by running from a temp dir