网络搜索 API (Exa)
为 AI Agent 设计的神经网络搜索引擎。通过神经嵌入进行语义排序(不仅仅是关键词匹配),发现相似页面用于竞品研究,全文页面内容提取,以及带来源引用的 AI 综合回答。按类别过滤:公司、研究论文、新闻、GitHub、Twitter 等。
基础 URL: https://api.jarvisclaw.ai/v1/marketplace/exa
认证
两种方式均支持:
| 方式 | Header | 描述 |
|---|---|---|
| API Key | Authorization: Bearer sk-... | 平台自动从你的 HD 钱包签名 x402 |
| 私钥 (x402) | SDK 自动处理 | Agent 直接用自己的钱包签名 x402 |
定价
参考价(每次请求)。精确扣费金额请读响应中的 price.amount。
| 端点 | 价格 | 描述 |
|---|---|---|
/search | $0.012/次 | 神经语义搜索 |
/contents | $0.004/次 | 提取页面全文内容 |
/find-similar | $0.012/次 | 发现相似页面(暂未开放) |
/answer | $0.012/次 | AI 综合回答 + 来源引用 |
/highlights | $0.002/次 | 相关段落抽取 |
端点
| 方法 | 端点 | 描述 |
|---|---|---|
| POST | /search | 语义搜索 |
| POST | /contents | 提取页面内容 |
| POST | /answer | AI 综合回答 |
| POST | /find-similar | 查找相似页面(暂未开放,返回 404) |
POST /search
使用神经嵌入进行语义搜索。比传统关键词搜索更准确地理解查询意图。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
query | string | 是 | 搜索查询(自然语言或关键词) |
num_results | integer | 否 | 结果数量。默认:10,最大:30 |
type | string | 否 | 搜索类型:neural(默认)、keyword、auto |
category | string | 否 | 类别过滤:company、research_paper、news、github、tweet、pdf、personal_site |
include_domains | string[] | 否 | 仅搜索这些域名 |
exclude_domains | string[] | 否 | 排除这些域名 |
start_published_date | string | 否 | 发布日期起始(ISO 8601) |
end_published_date | string | 否 | 发布日期截止(ISO 8601) |
include_text | string | 否 | 页面必须包含的文本 |
exclude_text | string | 否 | 页面不能包含的文本 |
响应
{
"results": [
{
"title": "Understanding Transformer Architecture",
"url": "https://example.com/transformers-explained",
"published_date": "2026-05-15",
"author": "Dr. Smith",
"score": 0.95,
"snippet": "Transformers use self-attention mechanisms to process sequential data..."
}
],
"autoprompt_string": "Here is a research paper about transformer architecture:",
"total": 10
}POST /contents
提取一个或多个 URL 的全文内容。适用于 RAG(检索增强生成)管道。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
ids | string[] | 是 | 要提取内容的 URL 列表 |
text | boolean | 否 | 返回纯文本内容。默认:true |
highlights | boolean | 否 | 返回关键段落高亮。默认:false |
字段名是 ids,不是 urls
Exa 把这个字段命名为 ids,尽管它装的是 URL。两个 SDK 都发送 ids;传 urls 取不到内容。
响应
{
"results": [
{
"id": "https://example.com/transformers-explained",
"url": "https://example.com/transformers-explained",
"title": "Understanding Transformer Architecture",
"text": "Full article text here... The transformer model was introduced in 2017...",
"publishedDate": "2026-05-10T00:00:00Z"
}
]
}结果在 results 数组里。Python SDK 的 contents() 读取 results(回退到 data), 因此不要按 contents 解析。
POST /find-similar 暂未开放
给定一个 URL,发现内容相似的页面。适用于竞品分析和相关内容推荐。
该端点尚不可用
上游供应商未注册此端点,调用会返回 404。可用 /search 配合描述性查询作为替代。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
url | string | 是 | 源 URL(必须是公开可访问的) |
num_results | integer | 否 | 结果数量。默认:10 |
category | string | 否 | 类别过滤 |
include_domains | string[] | 否 | 仅搜索这些域名 |
exclude_domains | string[] | 否 | 排除这些域名 |
响应
{
"results": [
{
"title": "Attention Is All You Need - Original Paper",
"url": "https://arxiv.org/abs/1706.03762",
"score": 0.92,
"snippet": "We propose a new simple network architecture, the Transformer..."
},
{
"title": "BERT: Pre-training Deep Bidirectional Transformers",
"url": "https://arxiv.org/abs/1810.04805",
"score": 0.88,
"snippet": "We introduce BERT, which stands for Bidirectional Encoder Representations..."
}
]
}POST /answer
基于搜索结果的 AI 综合回答。自动搜索、阅读相关页面并生成带来源引用的答案。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
query | string | 是 | 问题(自然语言) |
响应
{
"answer": "检索增强生成(RAG)是一种结合信息检索和文本生成的AI技术。它先从外部知识库中检索相关文档,然后将检索到的上下文与用户查询一起输入到语言模型中生成答案。这种方法解决了LLM的知识截止问题,使模型能够访问最新信息...",
"sources": [
{
"url": "https://example.com/rag-explained",
"title": "What is Retrieval Augmented Generation?",
"snippet": "RAG combines retrieval and generation..."
},
{
"url": "https://example.com/rag-implementation",
"title": "Building a RAG Pipeline",
"snippet": "The key components of a RAG system..."
}
]
}代码示例
# 语义搜索
curl -X POST https://api.jarvisclaw.ai/v1/marketplace/exa/search \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query": "latest advances in AI agents for software development",
"num_results": 5,
"category": "research_paper",
"start_published_date": "2026-01-01"
}'
# 提取页面内容(字段是 "ids",不是 "urls")
curl -X POST https://api.jarvisclaw.ai/v1/marketplace/exa/contents \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"ids": ["https://example.com/article1", "https://example.com/article2"],
"highlights": true
}'
# 相似页面发现(暂未开放,会返回 404)
# curl -X POST https://api.jarvisclaw.ai/v1/marketplace/exa/find-similar \
# -H "Authorization: Bearer sk-your-api-key" \
# -H "Content-Type: application/json" \
# -d '{"url": "https://stripe.com", "num_results": 10}'
# AI 综合回答
curl -X POST https://api.jarvisclaw.ai/v1/marketplace/exa/answer \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"query": "What is retrieval augmented generation and how does it work?"}'import requests
BASE = "https://api.jarvisclaw.ai/v1/marketplace/exa"
HEADERS = {
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
}
# 1. 语义搜索
resp = requests.post(f"{BASE}/search", headers=HEADERS, json={
"query": "AI agent frameworks for autonomous coding",
"num_results": 5,
"category": "github",
})
results = resp.json()["results"]
for r in results:
print(f"[{r['score']:.2f}] {r['title']}")
print(f" {r['url']}")
# 2. 提取全文内容(用于 RAG)—— 字段是 "ids"
resp = requests.post(f"{BASE}/contents", headers=HEADERS, json={
"ids": [r["url"] for r in results[:3]],
"highlights": True,
})
for content in resp.json().get("results", []):
print(f"\n--- {content.get('title')} ---")
print(content.get("text", "")[:200] + "...")
# 3. AI 综合回答
resp = requests.post(f"{BASE}/answer", headers=HEADERS, json={
"query": "什么是检索增强生成,它是如何工作的?",
})
data = resp.json()
print(f"\n回答: {data['answer']}")
for source in data["sources"]:
print(f" 来源: {source['url']}")from jarvisclaw import SearchClient
# --- 方式 A: Base 链 (EVM) ---
# 十六进制私钥 -> Base 上的 USDC (Chain ID 8453)
search = SearchClient(private_key="0x<evm-private-key>")
# --- 方式 B: Solana ---
# Base58 密钥对 -> Solana 主网上的 USDC SPL
# search = SearchClient(private_key="<base58-keypair>")
# SDK 从密钥格式自动识别链,无需额外参数
# 通用搜索 —— 方法名是 query(),走 /v1/search,返回 AI 摘要
for r in search.query("autonomous AI agents that can write and deploy code", num_results=5):
print(f"{r.title}: {r.snippet[:80]}")
# 提取内容 —— contents() 接收 URL 列表(内部发送为 ids)
for c in search.contents(["https://example.com/article1"]):
print(c)
# 相似页面(暂未开放,调用会返回 404)
# similar = search.find_similar("https://github.com/langchain-ai/langchain", num_results=5)
# 需要带 URL 的结构化结果,或 AI 回答,请直接调 Exa 端点:
import requests
HEADERS = {"Content-Type": "application/json"}
resp = requests.post(
"https://api.jarvisclaw.ai/v1/marketplace/exa/answer",
headers=HEADERS,
json={"query": "What are the best practices for building RAG systems?"},
)
print(resp.json()["answer"])SDK 只有 query()、contents()、find_similar() 三个方法
没有 search()、get_contents()、answer() 这些方法,也没有 solana_keypair 参数。 query() 走 /v1/search(智能路由摘要),返回的 SearchResult 常常 url="" —— 需要逐条 URL 请直接调用 POST /v1/marketplace/exa/search。
package main
import (
"context"
"fmt"
jc "github.com/api-jarvisclaw/go-sdk/v2"
)
func main() {
ctx := context.Background()
mc, _ := jc.NewMarketplaceClient(jc.WithAPIKey("sk-your-api-key"))
// 语义搜索
results, _ := mc.Post(ctx, "exa", "/search", map[string]interface{}{
"query": "AI agent frameworks",
"num_results": 5,
"category": "github",
})
fmt.Printf("搜索结果: %v\n", results["results"])
// AI 回答
answer, _ := mc.Post(ctx, "exa", "/answer", map[string]interface{}{
"query": "What is RAG?",
})
fmt.Printf("回答: %s\n", answer["answer"])
}package main
import (
"context"
"fmt"
jc "github.com/api-jarvisclaw/go-sdk/v2"
)
func main() {
ctx := context.Background()
// x402 Agent 钱包 — 自动按次付费 USDC
mc, _ := jc.NewMarketplaceClient(jc.WithPrivateKey("0x<evm-private-key>"))
// 语义搜索
results, _ := mc.Post(ctx, "exa", "/search", map[string]interface{}{
"query": "autonomous coding agents 2026",
"num_results": 10,
})
fmt.Printf("结果: %v\n", results["results"])
// 提取页面内容(字段是 ids)
contents, _ := mc.Post(ctx, "exa", "/contents", map[string]interface{}{
"ids": []string{"https://example.com/article"},
})
fmt.Printf("正文: %v\n", contents["results"])
}:::
两套不同的搜索入口
本页记录的是 /v1/marketplace/exa/* 下的 Exa 端点,返回带独立标题、URL 和分数的结构化结果。
此外还有 POST /v1/search —— 即 model: auto/search 背后的智能路由入口。它返回带内联引用的 AI 摘要,而不是排序列表:
{
"query": "...",
"summary": "检索增强生成是……[1](https://example.com)……",
"citations": [],
"sources_used": 10
}| 需求 | 使用 |
|---|---|
| 带 URL 和分数的排序链接 | POST /v1/marketplace/exa/search |
| 带引用的成文回答 | POST /v1/search 或 /v1/marketplace/exa/answer |
SDK 方法也沿这条线划分:SearchClient.query() 请求 /v1/search,而 contents() 和 find_similar() 请求 Exa 端点。详见智能路由 → auto/search。
限制
- 查询长度上限 10,000 字符 — 超过此长度的查询会被拒绝并返回
query_too_long - 仅限公开页面 — 无法访问需要登录认证或付费墙后的内容
- 并发上限 — 大量并行调用可能返回
429,退避后重试即可 - find-similar 暂未开放 — 上游未注册该端点,调用返回
404 - answer 耗时 3-8 秒 — AI 综合步骤增加了额外延迟
- 非实时数据 — 搜索索引有 1-24 小时延迟,不适合实时新闻追踪