> ## Documentation Index
> Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ExaからOlostepへの移行

> Exaの検索、コンテンツ、回答からOlostepへのコード移行のためのエンドポイント、SDK、パラメータおよびレスポンスのマッピング。コーディングエージェントが切り替えを行えるように記述されています。

Exaの`/search`、`/contents`、`/answer`はOlostepの[Search](https://docs.olostep.com/features/search.md)、[Scrape](https://docs.olostep.com/features/scrapes.md)、[Answers](https://docs.olostep.com/features/answers.md)にマップされます。切り替えにはSDKまたはベースURL、APIキー、いくつかのパラメータ名が必要です。

> [!TIP]
>
> **コーディングエージェントを使用していますか？** 以下のプロンプトを与えてください：
>
> ```text theme={null}
> このコードベースを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オプション |

[olostep.com/auth](https://www.olostep.com/auth)でキーを取得してください。新しいアカウントには500クレジットが無料で提供されます。

```python Python theme={null}
# Before
from exa_py import Exa
exa = Exa()  # reads EXA_API_KEY

# After
from olostep import Olostep
client = Olostep()  # reads OLOSTEP_API_KEY
```

```javascript Node theme={null}
// Before
import Exa from "exa-js";
const exa = new Exa(process.env.EXA_API_KEY);

// After
import Olostep from "olostep";
const client = new Olostep({ apiKey: process.env.OLOSTEP_API_KEY });
```

## エンドポイントマップ

| Exa | Olostep | 備考 |
| - | - | - |
| `POST /search` | `POST /searches` | 1回の呼び出しで最大25件の結果（Exaは100件） |
| `POST /search` with `contents.text` | `POST /searches` with `scrape_options` | 各結果にページのマークダウン。詳細は[Search with page text](#search-with-page-text)を参照 |
| `POST /contents` | `POST /scrapes` (1つのURL)、または `POST /batches` (複数) | 1つのURLにつき1回のスクレイプ；Olostepには複数URLのスクレイプ呼び出しはありません |
| `POST /answer` | `POST /answers` | 同期；ソースはURLです |
| `POST /findSimilar` (非推奨) | `POST /searches` | ページを`query`で記述（Exaの推奨） |
| エージェントAPI、`/research` (削除済み) | `POST /answers` for one question; [Agents](https://docs.olostep.com/features/agents.md) for longer research | |
| Websets, Monitors | [Monitors](https://docs.olostep.com/features/monitors.md) for watching a topic or page | 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"])` per URL | `client.scrapes.create({ url, formats: ["markdown"] })` per URL |
| `exa.answer(query, output_schema=...)` | `exa.answer(query, { outputSchema })` | `client.answers.create(task=query, json_format={...})` | `client.answers.create({ task: query, jsonFormat: {...} })` |

> [!WARNING]
>
> ExaのSDKはデフォルトで`search()`からページテキストを返します（1結果あたり最大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"]` (with `scrape_options`) | `link.markdown_content` |
| `result.highlights`, `result.summary` | 対応するものはありません：`link["description"]`を使用するか、Answersを使用 | `link.description` |
| `contents.results[0].text` | `page.markdown_content` from `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]` |

### 例

```python Python theme={null}
import json
from olostep import Olostep

client = Olostep()  # reads 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)
```

```javascript Node theme={null}
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リファレンス

### 検索

```bash Exa theme={null}
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"]
  }'
```

```bash Olostep theme={null}
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` | `json_format`を使用して`POST /answers`を使用 |
| `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` (with `scrape_options`) |
| `results[].publishedDate` | `result.links[].published_at` (多くの場合`null`) |
| `results[].id`, `score`, `author`, `image`, `favicon` | 対応するものはありません |
| `requestId` | `id` |
| `costDollars.total` | `credits_consumed` |

### ページテキストを含む検索

`scrape_options`はすべての結果を並行してスクレイプし、そのマークダウンをリンクに置きます。`timeout`（秒、1–60、デフォルト25）はスクレイプフェーズ全体を制限します：その時点までに完了していないリンクは`markdown_content: null`として返されます。ページはJavaScriptでレンダリングされるため、30秒以上かかることがあります。`timeout`を45–60に設定し、`null`コンテンツを処理してください。

```json theme={null}
{
  "query": "latest Node.js release",
  "limit": 5,
  "scrape_options": { "formats": ["markdown"], "timeout": 45 }
}
```

レスポンスタイムがすべてのページを持つことよりも重要な場合は、最初に検索し、使用する結果に対してのみ`POST /scrapes`を呼び出してください。

### コンテンツ → スクレイプ

Exaの`/contents`は1回の呼び出しで最大100のURLを受け付けます。Olostepは1回の呼び出しで1つのURLをスクレイプします：並行して送信するか、大きなリストには[Batches](https://docs.olostep.com/features/batches.md)を使用してください（1バッチにつき最大100,000 URL）。

```bash Exa theme={null}
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 }'
```

```bash Olostep theme={null}
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` (1回の呼び出しにつき1つのURL) |
| `text: true` | `formats: ["markdown"]` (またはプレーンテキストの場合は`["text"]`) |
| `text.maxCharacters` | 対応するものはありません：`markdown_content`を自分で切り詰めてください |
| `text.includeHtmlTags: true` | `formats: ["html"]` |
| `extras.links` | `links_on_page: {}` |
| `subpages` / `subpageTarget` | `POST /crawls` with `start_url` and `max_pages` |
| `maxAgeHours`, `livecrawl`, `livecrawlTimeout` | 削除：Olostepはページをライブで取得します；遅いページには`wait_before_scraping`（ms）を使用 |
| レスポンス `results[].text` | `result.markdown_content` (または `result.text_content`) |
| レスポンス `statuses[].status: "error"` | そのURLに対するスクレイプ呼び出しがエラーステータスを返します |

### 回答 → 回答

```bash Exa theme={null}
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" } }
    }
  }'
```

```bash Olostep theme={null}
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` | 対応するものはありません：回答は1つのレスポンスで返されます（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](https://docs.olostep.com/features/agents.md)を参照してください。

## 移行の確認

1. Exaのインポート、パッケージ、`EXA_API_KEY`の読み取りが残っていないこと：コード内で`exa_py`、`exa-js`、`api.exa.ai`を検索してください。
2. `OLOSTEP_API_KEY`がアプリが実行される場所（ローカルの`.env`、CIのシークレット、プロダクション）で設定されていること。
3. `.results[].text`を読み取っていたコードが`scrape_options`を渡すか、必要なURLをスクレイプし、`null`コンテンツを処理すること。
4. 検索が25件以下の結果を要求していること。
5. 回答結果が解析されていること：Olostepは`json_content`を文字列として返し、ソースをURL文字列として返します。
6. デプロイ前に1つの検索、1つのスクレイプ、1つの回答をエンドツーエンドで実行すること。

## リンク

* [Olostep APIリファレンス](https://docs.olostep.com/api-reference/searches/create.md)
* [Olostep SDKs (Python / Node)](https://docs.olostep.com/sdks/overview.md)
* [Context.devからの移行](https://docs.olostep.com/migrate/context-dev.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.