npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-exa-search-api

v2.0.1

Published

Exa for pi across seven tools: search, contents, find similar, answer, code context, agent runs, and scheduled monitors. Structured output with field-level citations and confidence.

Readme

pi-exa-search-api

npm CI license

Exa for pi across seven tools: search, contents, find similar, answer, code context, agent runs, and scheduled monitors. Structured output with field-level citations and confidence, plus multi-key rotation and custom TUI rendering.

pi install npm:pi-exa-search-api

Published on npm, which is what makes it discoverable in the pi package catalog. Or install from source:

pi install git:github.com/william-wei-zhu/pi-exa-search-api

Setup

pi-exa-search-api requires an Exa API key. Get one at dashboard.exa.ai/api-keys. New accounts include $20 of credits (roughly 2,800 searches), and the free tier adds $10 every month.

Then either:

export EXA_API_KEY="your-key"

or run /exa inside pi to add keys interactively. Keys are stored at ~/.pi/exa-config.json with 0600 permissions and are never written to logs, errors, or the transcript. Only the last four characters are ever displayed.

Add more than one key and pi-exa-search-api will rotate between them automatically.

Tools

| Tool | Endpoint | Use for | Indicative price | |------|----------|---------|------------------| | exa_search | POST /search | Discovering pages: docs, news, facts, companies, people | $7 / 1k base; deep-lite/deep $12 / 1k; deep-reasoning $15 / 1k | | exa_fetch | POST /contents | Reading full content for known URLs | $1 / 1k pages per content type (text + highlights bills 2×) | | exa_similar | POST /findSimilar | Finding pages like a known good one† | See current Exa pricing | | exa_answer | POST /answer | A short answer with citations | $5 / 1k | | exa_code | POST /context | Real code examples and correct API syntax | ~$1 / 1k | | exa_agent | POST /agent/runs | Multi-hop research, list building, enrichment | $0.012-$1.00 / run | | exa_monitors | /monitors | Scheduled recurring searches with semantic dedup | $15 / 1k runs |

Contents requested with search are free for the first 10 results. Prices change: see Exa's current pricing. Exa returns actual costDollars with each supported response, and pi-exa-search-api exposes it as costUsd in tool details.

† Exa has deprecated findSimilar in exa-js with no announced replacement. The endpoint is still live, so exa_similar remains available, but it may be removed in a future API version.

exa_agent and exa_monitors are metered per run and are gated behind /exa-advanced.

Commands

| Command | Description | |---------|-------------| | /exa | Interactive key manager: add, reorder, test, remove | | /exa-status | Keys available, tools active, cooldown state | | /exa-enable | Enable all Exa tools | | /exa-disable | Disable all Exa tools | | /exa-advanced on\|off | Toggle the metered tools (exa_agent, exa_monitors) |

Usage

Search

Search for recent benchmarks comparing vector databases for RAG workloads.

Code, before writing code

Use exa_code to get the correct syntax for streaming with tool calls in the Vercel AI SDK.

Deep research in one call. deep-reasoning replaced Exa's retired /research endpoint:

Use exa_search with type="deep-reasoning" to compare Bun 2.0 and Deno 2.0 for production API servers.

Structured output with citations. Works on every search type, not just the deep ones:

Find the 5 largest AI infrastructure Series B rounds this year. Use outputSchema so I get
JSON with company, amount, and date.

Results come back with output.grounding: a citation list and a low/medium/high confidence label per field, rendered inline so you can see which values are actually supported.

Agent for list building

Use exa_agent with effort="low" and maxCostDollars=2 to find engineering leaders at AI
infra companies that raised a Series A in the last 6 months.

Search types

| Type | Latency | Price | Best for | |------|---------|-------|----------| | instant | ~250 ms | $7 / 1k | Real-time apps, autocomplete | | fast | ~450 ms | $7 / 1k | Low latency with good relevance | | auto | ~1 s | $7 / 1k | Default; right for almost everything | | deep-lite | ~4 s | $12 / 1k | Lightweight synthesis | | deep | 4-15 s | $12 / 1k | Multi-step reasoning with structured output | | deep-reasoning | 12-40 s | $15 / 1k | Hardest research tasks |

Key rotation

Every request goes through one chokepoint that rotates across configured keys and applies a cooldown per failure mode. Cooldowns are held in memory only and never persisted.

| Response | Action | Cooldown | |----------|--------|----------| | 429 | Next key | Retry-After if present (capped at 5 min), else 60s | | 401 / 403 | Next key | 60 min, likely an invalid key | | 402 | Next key | 10 min, out of credits | | 5xx / 408 / 425 | Retry same key at 300ms, 900ms, then next key | n/a | | Other 4xx | Fail immediately, no rotation | n/a |

A malformed request fails identically on every key, so pi-exa-search-api does not burn the rest of your keys proving it.

Architecture

extensions/
├── index.ts        # registration, commands, tool gating, session lifecycle
├── api.ts          # single HTTP chokepoint: rotation, backoff, truncation, formatting
├── keys.ts         # key store (0600), cooldown ledger, timeouts
├── config.ts       # persisted UI state
├── key-manager.ts  # /exa TUI
└── tools/
    ├── search.ts   ├── fetch.ts    ├── similar.ts   ├── answer.ts
    ├── code.ts     ├── agent.ts    └── monitors.ts

Output is capped at ~45KB with the overflow written to a temp file, so a large crawl cannot blow out the context window.

Why not exa-js?

pi-exa-search-api calls the API over raw fetch rather than the official SDK. The rotation layer needs direct access to Retry-After headers, per-key AbortSignal composition, and raw response bodies, none of which a single-key SDK instance exposes cleanly. The tradeoff is deliberate; if you only need one key, exa-js is the better choice.

Development

npm install
npm run typecheck    # tsc --noEmit
npm test             # mocked unit tests, no API key needed
npm run check        # both

PI_EXA_LIVE=1 npm run test:live   # live smoke test, costs ~$0.05

The mocked suite (62 tests) covers the full rotation matrix (429 with and without Retry-After, 401, 402, 5xx backoff, key exhaustion, cooldown skipping, abort, malformed JSON), the parsing and grounding helpers, extension registration, and the published tarball (that files ships every runtime source, and that the catalog metadata is intact). The live suite hits every endpoint once and asserts the real response shapes. Both run in CI on Node 20 and 22.

Contributions welcome: see CONTRIBUTING.md.

License

MIT