> ## 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.

# Migrare da Exa a Olostep

> Mappatura di endpoint, SDK, parametri e risposte per spostare il codice da Exa search, contents e answer a Olostep, scritto in modo che un agente di codifica possa effettuare il passaggio.

Le API `/search`, `/contents` e `/answer` di Exa si mappano su [Search](https://docs.olostep.com/features/search.md), [Scrape](https://docs.olostep.com/features/scrapes.md) e [Answers](https://docs.olostep.com/features/answers.md) di Olostep. Il passaggio richiede l'SDK o l'URL base, la chiave API e alcuni nomi di parametri.

> [!TIP]
>
> **Stai usando un agente di codifica?** Forniscigli questo prompt:
>
> ```text theme={null}
> Migra questo codice da Exa a Olostep. Segui
> https://docs.olostep.com/migrate/exa.md esattamente: sostituisci l'SDK e la chiave API, mappa ogni
> chiamata Exa al suo equivalente Olostep e aggiorna il codice che legge le risposte.
> Leggi OLOSTEP_API_KEY dall'ambiente. Elenca tutto ciò che non ha un equivalente Olostep
> invece di indovinare.
> ```

## Scambio rapido

| | Exa | Olostep |
| - | - | - |
| Pacchetto Python | `pip install exa-py` | `pip install olostep` |
| Pacchetto Node | `npm install exa-js` | `npm install olostep` |
| Variabile chiave API | `EXA_API_KEY` | `OLOSTEP_API_KEY` |
| URL base | `https://api.exa.ai` | `https://api.olostep.com/v1` |
| Header di autenticazione | `x-api-key: ...` (o `Authorization: Bearer ...`) | `Authorization: Bearer $OLOSTEP_API_KEY` |
| Stile dei campi | camelCase | snake\_case in HTTP e Python, opzioni camelCase in Node |

Ottieni una chiave su [olostep.com/auth](https://www.olostep.com/auth). I nuovi account ricevono 500 crediti gratuiti.

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

# Dopo
from olostep import Olostep
client = Olostep()  # legge OLOSTEP_API_KEY
```

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

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

## Mappa degli endpoint

| Exa | Olostep | Note |
| - | - | - |
| `POST /search` | `POST /searches` | Fino a 25 risultati per chiamata (Exa: 100) |
| `POST /search` con `contents.text` | `POST /searches` con `scrape_options` | Markdown della pagina su ogni risultato. Vedi [Search with page text](#search-with-page-text) |
| `POST /contents` | `POST /scrapes` (un URL), o `POST /batches` (molti) | Una scrape per URL; Olostep non ha una chiamata di scrape multi-URL |
| `POST /answer` | `POST /answers` | Sincrono; le fonti sono URL |
| `POST /findSimilar` (deprecato) | `POST /searches` | Descrivi la pagina in `query` (consiglio di Exa) |
| API Agent, `/research` (rimosso) | `POST /answers` per una domanda; [Agents](https://docs.olostep.com/features/agents.md) per ricerche più lunghe | |
| Websets, Monitors | [Monitors](https://docs.olostep.com/features/monitors.md) per monitorare un argomento o una pagina | Nessun equivalente per i websets |

## Mappa dei metodi 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]
>
> Gli SDK di Exa restituiscono il testo della pagina da `search()` per impostazione predefinita (fino a 10.000 caratteri per risultato). La ricerca di Olostep restituisce solo titoli, URL e descrizioni. Se il tuo codice legge `result.text` dopo una semplice `search()`, aggiungi `scrape_options` (vedi sotto), o esegui lo scrape dei risultati di cui hai bisogno.

**Lettura dei risultati**

| 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"]` (con `scrape_options`) | `link.markdown_content` |
| `result.highlights`, `result.summary` | nessun equivalente: usa `link["description"]`, o Answers | `link.description` |
| `contents.results[0].text` | `page.markdown_content` da `scrapes.create` | `page.markdown_content` |
| `answer.answer` | `json.loads(answer.json_content)` | `JSON.parse(answer.json_content)` |
| `answer.citations[i].url` | `answer.sources[i]` (stringhe URL) | `answer.sources[i]` |

### Esempio

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

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

***

## Riferimento API HTTP

### Search

```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"]
  }'
```

**Parametri della richiesta**

| Exa | Olostep |
| - | - |
| `query` | `query` |
| `numResults` (1–100, predefinito 10) | `limit` (**1–25**, predefinito 12) |
| `includeDomains` / `excludeDomains` | `include_domains` / `exclude_domains` (host semplici come `nodejs.org`; Exa accetta anche prefissi di percorso e caratteri jolly) |
| `type: "fast"` / `"instant"` / `"lite"` | `fast_mode: true` |
| `type: "auto"` | predefinito (omesso) |
| `type: "deep"` / `"deep-lite"` | usa `POST /answers` per una risposta approfondita |
| `category: "company"` | `category: { "type": "companies" }` (ricerca aziendale, 40 crediti) |
| `category: "people"` | `category: { "type": "people" }` (ricerca persone, 40 crediti) |
| `category` (altri valori) | nessun equivalente: metti l'argomento in `query` |
| `startPublishedDate` / `endPublishedDate` | nessun equivalente: aggiungi il periodo di tempo a `query` (es. "nel 2026") |
| `userLocation` | nessun equivalente nella ricerca |
| `outputSchema`, `systemPrompt` | usa `POST /answers` con `json_format` |
| `contents.text` | `scrape_options: { "formats": ["markdown"], "timeout": 45 }` |
| `contents.highlights`, `contents.summary` | nessun equivalente |
| `contents.maxAgeHours`, `livecrawl` | rimuovi: Olostep recupera le pagine in tempo reale |
| — | `zero_data_retention: true` (non memorizzare la query o i risultati) |

**Risposta**

| Exa | Olostep |
| - | - |
| `results[]` | `result.links[]` |
| `results[].url`, `title` | `result.links[].url`, `title` |
| `results[].text` | `result.links[].markdown_content` (con `scrape_options`) |
| `results[].publishedDate` | `result.links[].published_at` (spesso `null`) |
| `results[].id`, `score`, `author`, `image`, `favicon` | nessun equivalente |
| `requestId` | `id` |
| `costDollars.total` | `credits_consumed` |

### Search with page text

`scrape_options` esegue lo scrape di ogni risultato in parallelo e inserisce il suo markdown sul link. `timeout` (secondi, 1–60, predefinito 25) limita l'intera fase di scrape: i link che non hanno finito entro quel tempo tornano con `markdown_content: null`. Le pagine vengono renderizzate con JavaScript, quindi questo può richiedere 30 secondi o più. Imposta `timeout` su 45–60 e gestisci il contenuto `null`.

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

Quando il tempo di risposta è più importante dell'avere ogni pagina, cerca prima e chiama `POST /scrapes` solo per i risultati che utilizzi.

### Contents → Scrape

L'API `/contents` di Exa accetta fino a 100 URL in una chiamata. Olostep esegue lo scrape di un URL per chiamata: inviali in parallelo, o usa [Batches](https://docs.olostep.com/features/batches.md) per liste grandi (fino a 100.000 URL per batch).

```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[]` (o `ids[]`) | `url_to_scrape` (un URL per chiamata) |
| `text: true` | `formats: ["markdown"]` (o `["text"]` per testo semplice) |
| `text.maxCharacters` | nessun equivalente: tronca `markdown_content` da solo |
| `text.includeHtmlTags: true` | `formats: ["html"]` |
| `extras.links` | `links_on_page: {}` |
| `subpages` / `subpageTarget` | `POST /crawls` con `start_url` e `max_pages` |
| `maxAgeHours`, `livecrawl`, `livecrawlTimeout` | rimuovi: Olostep recupera le pagine in tempo reale; usa `wait_before_scraping` (ms) per pagine lente |
| Risposta `results[].text` | `result.markdown_content` (o `result.text_content`) |
| Risposta `statuses[].status: "error"` | la chiamata di scrape restituisce uno stato di errore per quell'URL |

### Answer → Answers

```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`: un oggetto di esempio con valori vuoti (`{ "version": "" }`), o una descrizione in testo semplice |
| `systemPrompt` | metti le istruzioni in `task` |
| `text: true` (testo completo delle citazioni) | nessun equivalente: esegui lo scrape degli URL delle fonti |
| `stream: true` | nessun equivalente: le risposte vengono restituite in una risposta unica (3–30 s) |
| `model` | nessun equivalente |
| Risposta `answer` (stringa o oggetto) | `result.json_content` (**stringa**: analizzala). Senza `json_format`, è `{"result": "..."}` |
| Risposta `citations[]` (`url`, `title`, ...) | `result.sources[]` (stringhe URL) |

***

## Non coperto uno-a-uno

Queste funzionalità di Exa non hanno un equivalente diretto in Olostep: filtri per data di pubblicazione, contenuti `highlights` e `summary`, websets, risposte in streaming, `score` dei risultati di ricerca e ricerca per `ids` dei risultati Exa. Per ricerche che si svolgono in più passaggi, vedi [Agents](https://docs.olostep.com/features/agents.md).

## Verifica della migrazione

1. Non ci sono più importazioni di Exa, pacchetti o letture di `EXA_API_KEY`: cerca nel codice `exa_py`, `exa-js` e `api.exa.ai`.
2. `OLOSTEP_API_KEY` è impostato ovunque l'app venga eseguita (locale `.env`, segreti CI, produzione).
3. Il codice che leggeva `.results[].text` passa `scrape_options` o esegue lo scrape degli URL di cui ha bisogno, e gestisce il contenuto `null`.
4. Le ricerche richiedono 25 risultati o meno.
5. I risultati delle risposte sono analizzati: Olostep restituisce `json_content` come stringa, e le fonti come stringhe URL.
6. Esegui una ricerca, uno scrape e una risposta end-to-end prima di distribuire.

## Link

* [Riferimento API Olostep](https://docs.olostep.com/api-reference/searches/create.md)
* [SDK Olostep (Python / Node)](https://docs.olostep.com/sdks/overview.md)
* [Migrare da 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.