面向程序和智能体的网页搜索 API
带网页正文的搜索、网页读取、地理编码和知识卡片,都在一个 JSON API 里。调用按计费单位从 relay.fast 余额扣费,空结果和所有错误都不收费。
POST /v1/web/search
示例来自 API 参考,并非本页加载时的实时调用。
curl https://api.websearch.fast/v1/web/search \
-H "Authorization: Bearer $WEBSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "rust async runtime comparison",
"num": 3,
"content": {"pages": 1, "max_chars_per_page": 3000}
}'import os
import httpx
response = httpx.post(
"https://api.websearch.fast/v1/web/search",
headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
json={
"q": "rust async runtime comparison",
"num": 3,
"content": {"pages": 1, "max_chars_per_page": 3000},
},
timeout=60,
)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.websearch.fast/v1/web/search", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
q: "rust async runtime comparison",
num: 3,
content: { pages: 1, max_chars_per_page: 3000 },
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());- Choosing an async runtime in 2026blog.example.comWe benchmarked four runtimes on the same HTTP workload and compared scheduling, I/O and memory use. 2026-09-14
- Async runtimes: a comparison of schedulersdocs.example.orgHow work-stealing and thread-per-core runtimes differ, with notes on when each fits. 2026-06-02
- Moving a service between async runtimeswww.example.netWhat changed in our code when we moved a Rust service from one async runtime to another. 2026-03-21
{
"object": "web.search",
"request_id": "20261128120000123456789a1b2c3d4Kx7Qm2Pz",
"created": 1795867200,
"input": {
"q": "rust async runtime comparison",
"type": "web",
"page": 1,
"num": 3,
"safe": "moderate",
"operators": {},
"content": {
"pages": 1,
"format": "markdown",
"max_chars_per_page": 3000,
"mode": "full"
},
"timeout_ms": 25000
},
"results": [
{
"position": 1,
"title": "Choosing an async runtime in 2026",
"url": "https://blog.example.com/posts/async-runtimes-2026",
"domain": "blog.example.com",
"snippet": "We benchmarked four runtimes on the same HTTP workload and compared scheduling, I/O and memory use.",
"published_at": "2026-09-14T00:00:00Z",
"origin": "index",
"content": {
"status": "ok",
"format": "markdown",
"chars": 3000,
"truncated": true,
"text": "# Choosing an async runtime in 2026\n\n...",
"fetched_at": 1795860000
}
},
{
"position": 2,
"title": "Async runtimes: a comparison of schedulers",
"url": "https://docs.example.org/rust/async/runtimes",
"domain": "docs.example.org",
"snippet": "How work-stealing and thread-per-core runtimes differ, with notes on when each fits.",
"published_at": "2026-06-02T00:00:00Z",
"origin": "live"
},
{
"position": 3,
"title": "Moving a service between async runtimes",
"url": "https://www.example.net/notes/runtime-migration",
"domain": "www.example.net",
"snippet": "What changed in our code when we moved a Rust service from one async runtime to another.",
"published_at": "2026-03-21T00:00:00Z",
"origin": "live"
}
],
"has_more": true,
"usage": {
"charged": true,
"items": [
{"unit": "search_web", "count": 1},
{"unit": "content_page", "count": 1}
]
},
"cache": {"hit": false, "data_age_seconds": 0, "fetched_at": 1795867200}
}端点
搜索
POST /search网页搜索结果,可附带排名靠前网页的正文可用POST /autocomplete根据输入的前缀给出查询建议可用POST /knowledge单个实体的知识卡片可用POST /lens找出包含相同或相似图片的网页计划中读取
POST /fetch最多 20 个网页的正文,格式为 Markdown 或纯文本可用POST /extract按 JSON Schema 从网页中提取结构化数据计划中POST /map从站点地图和链接中找出一个站点的 URL计划中POST /crawl以任务方式读取一个站点的大量网页计划中研究
POST /research针对一个问题生成附来源的报告,以任务方式运行计划中POST /batch一个请求最多包含 100 次调用可用地点
POST /places/details一个地点的完整记录计划中POST /places/reviews一个地点的评价,分页返回计划中POST /geocode把地址或地名转换成坐标可用POST /reverse-geocode把坐标转换成地址可用账户
GET /usage一个密钥在网页调用上花了多少可用GET /status哪些端点已开启可用已经在用 Serper 请求格式?
在智能体中使用
MCP 服务器以 Streamable HTTP 提供 web_search、web_fetch、geocode、reverse_geocode、autocomplete 和 knowledge 六个工具。客户端只要能填远程服务器 URL 和 Bearer 请求头,就能接入。
.mcp.json
{
"mcpServers": {
"websearch": {
"type": "http",
"url": "https://api.websearch.fast/mcp",
"headers": {"Authorization": "Bearer ${WEBSEARCH_API_KEY}"}
}
}
}会读文档的智能体可以从本站的索引开始。
curl https://websearch.fast/llms.txt计费
没有单独的订阅。每次调用按用到的计费单位折算成积分,以 USD 从 relay.fast 账户余额扣除,模型调用也从这份余额扣费。错误、空结果和没能读取的网页都不计费。
每个响应都在 usage 里列出本次的计费内容。用量接口按天和端点汇总一个密钥的用量。