/search、/contents 和 /answer 映射到 Olostep 的 Search、Scrape 和 Answers。切换需要 SDK 或基础 URL、API 密钥和一些参数名称。
使用编码代理? 给它这个提示:
将此代码库从 Exa 迁移到 Olostep。严格遵循
https://docs.olostep.com/migrate/exa.md:交换 SDK 和 API 密钥,将每个
Exa 调用映射到其 Olostep 等价物,并更新读取响应的代码。
从环境中读取 OLOSTEP_API_KEY。列出没有 Olostep 等价物的任何内容,
而不是猜测。
快速切换
| Exa | Olostep | |
|---|---|---|
| Python 包 | pip install exa-py | pip install olostep |
| Node 包 | npm install exa-js | npm install olostep |
| API 密钥变量 | EXA_API_KEY | OLOSTEP_API_KEY |
| 基础 URL | https://api.exa.ai | https://api.olostep.com/v1 |
| 认证头 | x-api-key: ... (或 Authorization: Bearer ...) | Authorization: Bearer $OLOSTEP_API_KEY |
| 字段风格 | camelCase | HTTP 和 Python 中为 snake_case,Node 中为 camelCase 选项 |
# 之前
from exa_py import Exa
exa = Exa() # 读取 EXA_API_KEY
# 之后
from olostep import Olostep
client = Olostep() # 读取 OLOSTEP_API_KEY
// 之前
import Exa from "exa-js";
const exa = new Exa(process.env.EXA_API_KEY);
// 之后
import Olostep from "olostep";
const client = new Olostep({ apiKey: process.env.OLOSTEP_API_KEY });
端点映射
| Exa | Olostep | 备注 |
|---|---|---|
POST /search | POST /searches | 每次调用最多 25 个结果(Exa:100) |
POST /search 与 contents.text | POST /searches 与 scrape_options | 每个结果的页面 markdown。参见 Search with page text |
POST /contents | POST /scrapes(一个 URL),或 POST /batches(多个) | 每个 URL 一次抓取;Olostep 没有多 URL 抓取调用 |
POST /answer | POST /answers | 同步;来源是 URL |
POST /findSimilar(已弃用) | POST /searches | 在 query 中描述页面(Exa 自己的建议) |
Agent API,/research(已移除) | POST /answers 用于一个问题;Agents 用于更长的研究 | |
| Websets,Monitors | Monitors 用于监控主题或页面 | 没有 websets 的等价物 |
SDK 方法映射
| Exa Python | Exa Node | Olostep Python | Olostep Node |
|---|---|---|---|
exa.search(query, num_results=5) | exa.search(query, { numResults: 5 }) | client.searches.create(query=query, limit=5) | client.searches.create({ query, limit: 5 }) |
exa.search(query, contents={"text": True}), search_and_contents(query, text=True) | exa.search(query, { contents: { text: true } }), searchAndContents | client.searches.create(query=query, scrape_options={"formats": ["markdown"], "timeout": 45}) | client.searches.create({ query, scrapeOptions: { formats: ["markdown"], timeout: 45 } }) |
exa.get_contents([url], text=True) | exa.getContents([url], { text: true }) | client.scrapes.create(url_to_scrape=url, formats=["markdown"]) 每个 URL | client.scrapes.create({ url, formats: ["markdown"] }) 每个 URL |
exa.answer(query, output_schema=...) | exa.answer(query, { outputSchema }) | client.answers.create(task=query, json_format={...}) | client.answers.create({ task: query, jsonFormat: {...} }) |
Exa 的 SDK 默认从
search() 返回页面文本(每个结果最多 10,000 个字符)。Olostep 的搜索仅返回标题、URL 和描述。如果你的代码在普通 search() 后读取 result.text,请添加 scrape_options(见下文),或抓取你需要的结果。| Exa | Olostep Python | Olostep Node |
|---|---|---|
response.results | results.links | results.links |
result.url / result.title | link["url"] / link["title"] | link.url / link.title |
result.text | link["markdown_content"](有 scrape_options) | link.markdown_content |
result.highlights,result.summary | 没有等价物:使用 link["description"],或 Answers | link.description |
contents.results[0].text | page.markdown_content 来自 scrapes.create | page.markdown_content |
answer.answer | json.loads(answer.json_content) | JSON.parse(answer.json_content) |
answer.citations[i].url | answer.sources[i](URL 字符串) | answer.sources[i] |
示例
import json
from olostep import Olostep
client = Olostep() # 读取 OLOSTEP_API_KEY
results = client.searches.create(query="latest Node.js release", limit=5)
for link in results.links:
print(link["url"], link["title"])
page = client.scrapes.create(url_to_scrape="https://nodejs.org/en/blog", formats=["markdown"])
print(page.markdown_content[:500])
answer = client.answers.create(
task="What is the latest Node.js LTS version?", json_format={"version": ""}
)
print(json.loads(answer.json_content), answer.sources)
import Olostep from "olostep";
const client = new Olostep({ apiKey: process.env.OLOSTEP_API_KEY });
const results = await client.searches.create({ query: "latest Node.js release", limit: 5 });
for (const link of results.links) console.log(link.url, link.title);
const page = await client.scrapes.create({ url: "https://nodejs.org/en/blog", formats: ["markdown"] });
console.log(page.markdown_content.slice(0, 500));
const answer = await client.answers.create({
task: "What is the latest Node.js LTS version?",
jsonFormat: { version: "" },
});
console.log(JSON.parse(answer.json_content), answer.sources);
HTTP API 参考
搜索
curl -X POST https://api.exa.ai/search \
-H "x-api-key: $EXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "latest Node.js release",
"numResults": 5,
"includeDomains": ["nodejs.org"]
}'
curl -X POST https://api.olostep.com/v1/searches \
-H "Authorization: Bearer $OLOSTEP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "latest Node.js release",
"limit": 5,
"include_domains": ["nodejs.org"]
}'
| Exa | Olostep |
|---|---|
query | query |
numResults (1–100,默认 10) | limit (1–25,默认 12) |
includeDomains / excludeDomains | include_domains / exclude_domains(裸主机如 nodejs.org;Exa 也接受路径前缀和通配符) |
type: "fast" / "instant" / "lite" | fast_mode: true |
type: "auto" | 默认(省略) |
type: "deep" / "deep-lite" | 使用 POST /answers 获取研究答案 |
category: "company" | category: { "type": "companies" }(公司搜索,40 积分) |
category: "people" | category: { "type": "people" }(人物搜索,40 积分) |
category(其他值) | 没有等价物:将主题放在 query 中 |
startPublishedDate / endPublishedDate | 没有等价物:将时间框架添加到 query(例如 “in 2026”) |
userLocation | 搜索中没有等价物 |
outputSchema,systemPrompt | 使用 POST /answers 和 json_format |
contents.text | scrape_options: { "formats": ["markdown"], "timeout": 45 } |
contents.highlights,contents.summary | 没有等价物 |
contents.maxAgeHours,livecrawl | 移除:Olostep 实时抓取页面 |
| — | zero_data_retention: true(不存储查询或结果) |
| Exa | Olostep |
|---|---|
results[] | result.links[] |
results[].url,title | result.links[].url,title |
results[].text | result.links[].markdown_content(有 scrape_options) |
results[].publishedDate | result.links[].published_at(通常为 null) |
results[].id,score,author,image,favicon | 没有等价物 |
requestId | id |
costDollars.total | credits_consumed |
带页面文本的搜索
scrape_options 并行抓取每个结果并将其 markdown 放在链接上。timeout(秒,1–60,默认 25)限制整个抓取阶段:在此之前未完成的链接返回 markdown_content: null。页面使用 JavaScript 渲染,因此可能需要 30 秒或更长时间。将 timeout 设置为 45–60 并处理 null 内容。
{
"query": "latest Node.js release",
"limit": 5,
"scrape_options": { "formats": ["markdown"], "timeout": 45 }
}
POST /scrapes。
内容 → 抓取
Exa 的/contents 一次调用最多接受 100 个 URL。Olostep 每次调用抓取一个 URL:并行发送它们,或使用 Batches 处理大列表(每个批次最多 100,000 个 URL)。
curl -X POST https://api.exa.ai/contents \
-H "x-api-key: $EXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "urls": ["https://nodejs.org/en/blog"], "text": true }'
curl -X POST https://api.olostep.com/v1/scrapes \
-H "Authorization: Bearer $OLOSTEP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url_to_scrape": "https://nodejs.org/en/blog", "formats": ["markdown"] }'
| Exa | Olostep |
|---|---|
urls[](或 ids[]) | url_to_scrape(每次调用一个 URL) |
text: true | formats: ["markdown"](或 ["text"] 用于纯文本) |
text.maxCharacters | 没有等价物:自行截断 markdown_content |
text.includeHtmlTags: true | formats: ["html"] |
extras.links | links_on_page: {} |
subpages / subpageTarget | POST /crawls 与 start_url 和 max_pages |
maxAgeHours,livecrawl,livecrawlTimeout | 移除:Olostep 实时抓取页面;使用 wait_before_scraping(毫秒)处理慢速页面 |
响应 results[].text | result.markdown_content(或 result.text_content) |
响应 statuses[].status: "error" | 抓取调用返回该 URL 的错误状态 |
答案 → 答案
curl -X POST https://api.exa.ai/answer \
-H "x-api-key: $EXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What is the latest Node.js LTS version?",
"outputSchema": {
"type": "object",
"properties": { "version": { "type": "string" } }
}
}'
curl -X POST https://api.olostep.com/v1/answers \
-H "Authorization: Bearer $OLOSTEP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "What is the latest Node.js LTS version?",
"json_format": { "version": "" }
}'
| Exa | Olostep |
|---|---|
query | task |
outputSchema(JSON Schema) | json_format:一个具有空值的示例对象({ "version": "" }),或纯文本描述 |
systemPrompt | 将指令放在 task 中 |
text: true(引用的全文) | 没有等价物:抓取源 URL |
stream: true | 没有等价物:答案在一个响应中返回(3–30 秒) |
model | 没有等价物 |
响应 answer(字符串或对象) | result.json_content(字符串:解析它)。没有 json_format 时,它是 {"result": "..."} |
响应 citations[](url,title,…) | result.sources[](URL 字符串) |
没有一对一覆盖
这些 Exa 功能没有直接的 Olostep 等价物:发布日期过滤器,highlights 和 summary 内容,websets,流式答案,搜索结果 score,以及通过 Exa 结果 ids 搜索。对于需要多步运行的研究,请参见 Agents。
验证迁移
- 没有 Exa 导入、包或
EXA_API_KEY读取:在代码中搜索exa_py、exa-js和api.exa.ai。 OLOSTEP_API_KEY在应用程序运行的任何地方设置(本地.env,CI 机密,生产环境)。- 读取
.results[].text的代码要么传递scrape_options,要么抓取所需的 URL,并处理null内容。 - 搜索请求 25 个结果或更少。
- 答案结果被解析:Olostep 返回
json_content作为字符串,来源为 URL 字符串。 - 在部署之前,端到端运行一次搜索、一次抓取和一次答案。