exa-cli
CLI for the Exa AI search API. All commands support --json for structured output and --plaintext for piping.
bash
exa search "hottest AI startups" -n 5 --json --fields title,url,score
Output:
json
[
{"title": "Adept: Useful General Intelligence", "url": "https://www.adept.ai/", "score": 0.95},
{"title": "Home | Tenyx, Inc.", "url": "https://www.tenyx.com/", "score": 0.89}
]
bash
exa answer "What is the capital of France?" --json
Output:
json
{
"answer": "The capital of France is Paris...",
"citations": [{"title": "...", "url": "https://..."}],
"costDollars": {"total": 0.005}
}
bash
exa similar "https://arxiv.org/abs/2307.06435" -n 5 --exclude-source --json
bash
exa contents https://example.com --summary --json --fields title,url,summary
bash
exa search "machine learning" -n 10 --category research_paper --start-date 2025-01-01 --json --jq '.results | length'
Output:
code
10
Quick Start
bash
# Install brew install roboalchemist/tap/exa-cli # Authenticate export EXA_API_KEY="your-key-here" # Or: exa auth # Search exa search "query" -n 10 --type auto
Commands
| Command | Description |
|---|---|
search [query] | Web search (types: auto, fast, deep, neural) |
answer [query] | AI answer with citations (supports --stream) |
similar [url] | Find semantically similar pages |
contents [urls...] | Retrieve page text, highlights, summaries |
context [query] | Code context from Exa Code |
usage | API usage stats and costs |
auth | Configure API key |
Output Formats
- •
--json(-j) — Structured JSON (all commands) - •
--plaintext(-p) — Tab-separated for piping - •
--fields title,url,score— Filter JSON fields - •
--jq '.results[] | .url'— Built-in JQ filtering
Search Types
| Type | Latency | Use |
|---|---|---|
auto | Medium | Default, combines methods with reranker |
fast | <400ms | Real-time applications |
deep | Higher | Comprehensive, query expansion |
neural | Medium | Pure semantic/embeddings search |
Authentication
Priority: EXA_API_KEY env var > ~/.exa-auth.json config file.
For Agents
- •Always use
--jsonfor programmatic parsing - •Use
--fieldsto reduce output:--json --fields title,url - •Use
--jqfor inline filtering:--json --jq '.results[0].url' - •Cost is included in JSON responses under
costDollars.total - •Errors output structured JSON to stderr with
--json
See reference/commands.md for complete flag reference.