[Integrations](/integrations/) / Tavily-compatible

# Tavily-compatible search and extract API for existing Tavily SDK code

If your code already calls Tavily, through the Python or JavaScript SDK or over HTTP, you can send the same requests to FastAF. Change two things, the base URL and the API key, and keep the rest. Search results come from Google through the FastAF [SERP API](/apis/google-serp-api/), and page content from the [web scraping API](/apis/web-scraping-api/). You pay with credits (see [pricing](/pricing/)) or per call with [x402](/x402/), and the same key works on every endpoint in the [FastAF API catalog](/apis/).

## Which base URL do you use?

How you pay

Base URL

Key

FastAF API key (credits)

`https://api.fastaf.co/tavily`

Your FastAF API key in place of the Tavily key

x402, per call in USDC

`https://api.fastaf.co/x402/tavily`

No key; an x402 v2 client signs the payment

The client appends `/search` and `/extract` to the base URL. The key goes in `Authorization: Bearer`, which is what the SDKs send; older clients that put `api_key` in the JSON body work too.

## Python

With the official `tavily-python` package (checked with version 0.8.5):

```
from tavily import TavilyClient

client = TavilyClient(
    api_key="YOUR_FASTAF_API_KEY",
    api_base_url="https://api.fastaf.co/tavily",
)
response = client.search("best espresso machine for home", max_results=5)
for result in response["results"]:
    print(result["title"], result["url"])

pages = client.extract(urls=["https://example.com/"])
print(pages["results"][0]["raw_content"])
```

`AsyncTavilyClient` takes the same `api_base_url` argument.

## JavaScript

With the official `@tavily/core` package (checked with version 0.7.14):

```
import { tavily } from "@tavily/core";

const client = tavily({
  apiKey: process.env.FASTAF_API_KEY,
  apiBaseURL: "https://api.fastaf.co/tavily",
});
const response = await client.search("best espresso machine for home", { maxResults: 5 });
console.log(response.results.map((r) => r.url));

const pages = await client.extract(["https://example.com/"]);
console.log(pages.results[0].rawContent);
```

## curl

```
curl -X POST https://api.fastaf.co/tavily/search \
  -H "Authorization: Bearer $FASTAF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "best espresso machine for home", "max_results": 5}'

curl -X POST https://api.fastaf.co/tavily/extract \
  -H "Authorization: Bearer $FASTAF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://example.com/"]}'
```

A search answers in the same shape as Tavily:

```
{
  "query": "best espresso machine for home",
  "answer": null,
  "images": [],
  "results": [
    {
      "title": "Best espresso machines for home brewing",
      "url": "https://example.com/guides/espresso-machines",
      "content": "Compare compact espresso machines by pressure, grinder and milk-steaming features.",
      "score": 1,
      "raw_content": null
    }
  ],
  "response_time": 1.42,
  "request_id": "0834e596-379c-43b6-97fc-850432abd73d"
}
```

## What does it cost?

The same as calling the FastAF endpoints directly. Failed calls are never charged: with a key the credits come back, and with x402 the payment does not settle.

Call

With an API key

With x402

search

5 credits ($2.50 per 1,000 searches on Starter)

$0.003 per search

search with include\_raw\_content

5 credits + 1 credit per result page fetched

Not available: send the result URLs to `/extract`

extract, basic

1 credit per URL extracted

$0.005 per URL

extract, advanced

5 credits per URL extracted

$0.005 per URL, the same as basic

With a key, a page that cannot be fetched is listed in `failed_results` (or has `raw_content: null` in a search) and costs nothing. With x402, one payment covers the whole extract call and settles only if every URL succeeds. On x402 the scrape price already covers JavaScript rendering, so an advanced extract costs the same as a basic one, as on `/x402/v1/scrape`. Credit packs are on the [pricing page](/pricing/) and x402 prices on the [x402 price list](/pricing/x402-price-list/).

## Which search fields are supported?

Field

Status

Notes

`query`

Supported

Required, up to 400 characters.

`max_results`

Supported

0 to 20, default 10. One Google results page holds about 10 results, so asking for more returns at most that page.

`include_raw_content`

Supported

true or "markdown" returns each result page as Markdown; "text" returns plain text. Adds one page fetch per result (see pricing).

`include_domains, exclude_domains`

Supported

Sent to Google as site: filters, up to 10 domains each.

`time_range, start_date, end_date`

Supported

Google date filters (past day, week, month, year, or a custom range).

`country, language`

Supported

Country by English name (for example "italy") or two-letter code; language as a two-letter code. Unknown names are ignored.

`include_usage`

Supported

usage.credits reports FastAF credits used (API key only).

`include_favicon`

Partial

Returns favicon only when Google provides one, otherwise null.

`include_answer`

Not supported

Accepted; answer is always null. FastAF returns search results, not generated answers.

`include_images, include_image_descriptions`

Not supported

Accepted; images is always an empty list.

`search_depth, chunks_per_source`

Ignored

Every search runs the same way and costs the same. content is the Google snippet, not ranked chunks.

`topic`

Ignored

Every search is a Google web search, also for news and finance.

`days, include_published_date, filter_by_published_date, include_domains_mode, filter_by_language, auto_parameters, exact_match, safe_search, max_age_hours, fetch_timeout, cache_fallback`

Ignored

Accepted, like any unknown field, so existing calls keep working, with no effect on the results.

`score (response)`

Different meaning

Derived from the Google rank (1 for the first result, then 0.05 lower per position, minimum 0.05), not a semantic relevance score.

`auto_parameters, usage (response)`

Partial

auto\_parameters is never returned; usage only with include\_usage and an API key.

The response has `query`, `answer`, `images`, `results` (`title`, `url`, `content`, `score`, `raw_content`), `response_time` and `request_id`.

## Which extract fields are supported?

Field

Status

Notes

`urls`

Supported

One URL or a list of up to 20.

`extract_depth`

Supported

"basic" fetches the page; "advanced" renders JavaScript first (5 credits per URL with an API key; with x402 the same $0.005 per URL as basic).

`format`

Supported

"markdown" (default) or "text".

`include_usage`

Supported

usage.credits reports FastAF credits used (API key only).

`include_favicon`

Not supported

Accepted; favicon is null.

`include_images`

Not supported

Accepted; images is always an empty list.

`query, chunks_per_source`

Ignored

The whole page is returned, not reranked chunks.

`timeout`

Ignored

Accepted, like any unknown field, so existing calls keep working, with no effect on the results.

The response has `results` (`url`, `raw_content`, `images`), `failed_results` (`url`, `error`), `response_time` and `request_id`. Private addresses and login pages are refused, as on every FastAF endpoint.

## What is not supported?

*   The `/crawl`, `/map`, `/research` and `/usage` endpoints.
*   Generated answers, images, and news or finance topics: `topic` is accepted but every search is a Google web search. For news, use the [Google News API](/apis/google-news-api/).
*   Keyless mode. Without a key the SDKs send no credentials and get `401`.

## How do errors look?

Errors use Tavily's format, `{"detail": {"error": "..."}}`, with a FastAF `code` next to the message. The status codes match what the SDKs expect: `400` for invalid input, `401` for a missing or wrong key, `403` for a suspended account or an unverified email, `429` for rate limits (with `Retry-After`), and `432` when the account has no credits left. In Python they raise `BadRequestError`, `InvalidAPIKeyError`, `ForbiddenError` and `UsageLimitExceededError`. Temporary failures of the data source return `502` or `503` and are not charged.

## How do you start?

[Create an account](/signup/): your API key arrives by email, and you get 500 free credits every month after you verify your address. Then pay per call, with [credits](/pricing/) or [x402](/x402/). See an example output with [`?sample=1`](/docs/#sample) ([search](https://api.fastaf.co/v1/serp?sample=1), [page content](https://api.fastaf.co/v1/scrape?sample=1), in the FastAF format); you only pay for 200 responses. Building with a framework instead of the Tavily SDK? See the [LangChain](/integrations/langchain/), [OpenAI Agents SDK](/integrations/openai-agents-sdk/) and [Vercel AI SDK integrations](/integrations/vercel-ai-sdk/). More options are on the [integrations page](/integrations/) and in the [documentation](/docs/); for how the two services differ, see [FastAF vs Tavily](/compare/tavily/).

## FAQ

### Is FastAF a drop-in Tavily alternative?

For `/search` and `/extract`, yes: keep `tavily-python` or `@tavily/core`, set the base URL to `https://api.fastaf.co/tavily` and use a FastAF key. `/crawl`, `/map` and `/research` are not supported.

### Do I need to change my code?

Only the API key and the base URL: `api_base_url` in Python (`TavilyClient` and `AsyncTavilyClient`), `apiBaseURL` in JavaScript (`tavily({ apiKey, apiBaseURL })`).

### How much does it cost?

One search costs the same as a FastAF SERP call ($0.003 with x402, or 5 credits with an API key). See [FastAF vs Tavily](/compare/tavily/).

### Can I test before paying?

See an example output with [`?sample=1`](/docs/#sample) on the SERP and scrape endpoints; you only pay for 200 responses. After email verification you get 500 free credits every month (a search is 5 credits).

### Is FastAF affiliated with Tavily?

No. It is compatible with the request format only.

_Tavily is a trademark of its respective owner. FastAF is not affiliated with, endorsed by or sponsored by Tavily. "Compatible" means that FastAF accepts the same request format; it does not imply any partnership._

## Related

*   [FastAF vs Tavily](/compare/tavily/)
*   [Google SERP API](/apis/google-serp-api/)
*   [Web Scraping API](/apis/web-scraping-api/)
