@tian.zuo/pi-web-search
v0.1.0
Published
Web search (OpenAI Responses with simple prompt, Exa, Firecrawl, Ollama) and web fetch for the pi coding agent.
Maintainers
Readme
@tian.zuo/pi-web-search
Clean, lightweight web search and fetch tools for the pi coding agent.
Supports OpenAI Responses (with simple, concise system instructions and automatic pi/Codex OAuth reuse), Exa, Firecrawl, and Ollama (local/cloud), plus built-in direct HTML-to-Markdown fetch fallback.
Features
web_searchTool: Queries live web sources and returns concise summaries with cited source links.- OpenAI Responses (
/v1/responsesor Codex): Uses OpenAI's server-side web search with a simple, clean prompt. Reuses your active pi login (openai-codexoropenai), or usesOPENAI_API_KEY. - Exa: High quality search results via
EXA_API_KEY. - Firecrawl: Clean search output via
FIRECRAWL_API_KEY. - Ollama: Local (
http://localhost:11434) or cloud web search.
- OpenAI Responses (
web_fetchTool: Reads web pages and documentation as clean Markdown.- Native scrapers for Firecrawl (
/v1/scrape), Exa (/contents), and Ollama (/api/web_fetch). - Direct Fetch Fallback: High-performance HTML-to-Markdown extraction when no scraping key is provided.
- Native scrapers for Firecrawl (
- Session Fallback Chains: Every call walks an ordered fallback chain — search:
openai → exa → firecrawl → ollama; fetch:firecrawl → exa → ollama → direct. When a provider runs out of usage (402/403, out of credits, usage limits) it is skipped for the rest of the session, so the next search/fetch goes straight to the next healthy provider. Plain rate limits (429) only apply a short cooldown. Successful responses report which providers they fell back from.
Installation
pi install npm:@tian.zuo/pi-web-searchOr try in a live session without installing:
pi -e ./packages/pi-web-searchConfiguration
Precedence: Environment Variables > ~/.config/@tian.zuo/pi-web-search/config.json > ~/.pi/agent/auth.json (Codex / OpenAI login).
Environment Variables
| Variable | Description | Default |
| :--- | :--- | :--- |
| OPENAI_API_KEY | OpenAI API key or Codex JWT | Reused from Pi login if available |
| OPENAI_BASE_URL | Custom OpenAI Responses endpoint | https://api.openai.com/v1/responses |
| OPENAI_SEARCH_MODEL | Model for OpenAI Responses search | gpt-5.6-luna |
| EXA_API_KEY | Exa API key | - |
| FIRECRAWL_API_KEY | Firecrawl API key | - |
| FIRECRAWL_BASE_URL | Custom Firecrawl API URL | https://api.firecrawl.dev/v1 |
| OLLAMA_HOST | Ollama host URL | http://localhost:11434 |
| OLLAMA_API_KEY | Ollama API key (for cloud endpoints) | - |
License
MIT
