Tavily-compatible search
Point tavily-python or @tavily/core at https://api.contextfetch.dev/tavily and keep your code.
POST/tavily/search
Credits: 1 (basic or advanced)
Tavily-compatible search. tavily-python and @tavily/core use the base URL https://api.contextfetch.dev/tavily.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| query | body | string | yes | Search query. |
| api_key | body | string | no | Optional when a header carries the key. |
| search_depth | body | "basic" | "advanced" | no | Both cost 1 credit. |
| max_results | body | int | no | Default 5, capped at 25. |
| include_raw_content | body | bool | no | Adds raw_content as Markdown. |
| include_answer | body | bool | no | Adds answer quoted from the most relevant passages, or null. No generative model runs. |
| include_domains / exclude_domains | body | string[] | no | Domain filters. |
Example request
curl -s https://api.contextfetch.dev/tavily/search \ -H "Content-Type: application/json" \ -d '{"api_key":"YOUR_API_KEY","query":"vector database benchmarks 2026","max_results":3,"include_raw_content":true}'# pip install tavily-pythonfrom tavily import TavilyClient tavily = TavilyClient( api_key="YOUR_API_KEY", # or "keyless" for the free tier api_base_url="https://api.contextfetch.dev/tavily",) res = tavily.search("vector database benchmarks 2026", max_results=5, include_raw_content=True)for r in res["results"]: print(r["url"], r["score"])// npm i @tavily/coreimport { tavily } from "@tavily/core"; const tvly = tavily({ apiKey: "YOUR_API_KEY", apiBaseURL: "https://api.contextfetch.dev/tavily",}); const res = await tvly.search("vector database benchmarks 2026", { searchDepth: "basic", maxResults: 5 });for (const r of res.results) console.log(r.url, r.score);Example response
{
"query": "vector database benchmarks 2026",
"results": [
{
"title": "Vector database benchmarks",
"url": "https://example.com/blog/vector-database-benchmarks",
"content": "We measured recall and p99 latency for...",
"raw_content": "# Vector database benchmarks\n\n...",
"score": 0.93
}
],
"response_time": 0.84
}Response headers
| Header | Meaning |
|---|---|
| X-Credits-Remaining | On every billable response: free requests left today for keyless calls, credits left for a paid key. |
Errors
| Status | Body | When |
|---|---|---|
| 401 | {"detail": {"error": "invalid_api_key"}} | The key is unknown. |
| 422 | - | Request validation failed, e.g. a query over 2,000 characters or a threshold outside 100 to 100,000. |
| 432 | {"detail": {"error": "..."}} | /tavily/* only: out of credits (Tavily's own status), with the same X-Payment-URL header. Other /tavily/* errors also use this body shape. |
On /tavily/*, running out of credits returns 432 with {"detail": {"error": "..."}}, as tavily-python expects, plus the same X-Payment-URL header.