# Tavily

> Use the Tavily SDKs and Tavily-based integrations with Search1API by changing the API base URL and key.

Canonical URL: https://s1.dev/docs/compatibility/tavily

Search1API answers Tavily's `POST /search` and `POST /extract`. Set the Tavily base URL to:

```text
https://api.search1api.com/compat/tavily
```

Authenticate with your Search1API key as `Authorization: Bearer YOUR_API_KEY`, as the Tavily SDKs do. An `api_key` field in the request body, used by older clients, is also accepted.

## Configure your client

<Tabs items={['Python', 'JavaScript', 'Open WebUI']}>

<Tab value="Python">

```python
from tavily import TavilyClient

client = TavilyClient(
    api_key="YOUR_API_KEY",
    api_base_url="https://api.search1api.com/compat/tavily",
)
response = client.search("hono cloudflare workers", max_results=5)
pages = client.extract(urls=["https://hono.dev/docs/"])
```

</Tab>

<Tab value="JavaScript">

```ts
import { tavily } from '@tavily/core';

const client = tavily({
  apiKey: process.env.SEARCH1API_KEY,
  apiBaseURL: 'https://api.search1api.com/compat/tavily',
});
const response = await client.search('hono cloudflare workers', { maxResults: 5 });
const pages = await client.extract(['https://hono.dev/docs/']);
```

</Tab>

<Tab value="Open WebUI">

Choose **tavily** as the web search engine, enter your Search1API key as the Tavily API key, and set:

```bash
TAVILY_API_BASE_URL="https://api.search1api.com/compat/tavily"
```

</Tab>

</Tabs>

## Search

| Field | Behavior |
| --- | --- |
| `query` | Required. |
| `max_results` | Default `10`, up to `50`. |
| `topic` | `news` searches news. `general` and `finance` search the web. |
| `time_range` | `day`, `week`, `month`, `year` or `d`, `w`, `m`, `y`. |
| `days`, `start_date` | Converted to the shortest of day, week, month or year that covers the period. |
| `include_domains`, `exclude_domains` | Restrict or exclude sites. |
| `include_raw_content` | `true`, `"markdown"` or `"text"` reads the full page of every result into `raw_content`, as Markdown. |

`search_depth`, `chunks_per_source`, `include_answer`, `include_images`, `country`, `auto_parameters` and other options are accepted and ignored.

The response has Tavily's fields: `query`, `results`, `answer`, `images`, `follow_up_questions`, `response_time` and `request_id`. Each result has `title`, `url`, `content` (the search snippet), `score`, `raw_content` and, when known, `published_date`.

- `answer` and `follow_up_questions` are `null`, and `images` is empty.
- `score` is derived from the result's rank, from `1` for the first result down.
- `usage` is not returned.

## Extract

`urls` takes one URL or a list of up to 20. Each page is returned in `results` as `{ url, raw_content, images }`, with `raw_content` in Markdown. Pages that cannot be read appear in `failed_results` as `{ url, error }`; the request still returns `200`. `extract_depth`, `format`, `query` and `timeout` are ignored.

## Credits

| Request | Credits |
| --- | --- |
| Search | 1 |
| Search with `include_raw_content` | 1, plus 1 for each page read |
| Extract | 1 for each page read |

## Errors

Errors return `{ "detail": { "error": "message" } }` with the status code, which the Tavily SDKs turn into their own exceptions. Extract returns an error instead of `failed_results` only when no page was read because of the key, credits or rate limit.