Tavily Search
Execute a search query using Tavily Search.
Dynamic pricing
body.auto_parameters ? 0.02 : (lower(body.search_depth) == 'advanced' ? 0.02 : 0.01)
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "tavily",
path: "/search",
body: {
"query": "example"
}
});
console.log(output);Body parameters
The search query to execute with Tavily.
Controls the latency vs. relevance tradeoff and how results[].content is generated: advanced: Highest relevance with increased latency. Best for detailed, high-precision queries. Returns multiple semantically relevant snippets per URL (configurable via chunks_per_source). basic: A balanced option for relevance and latency. Ideal for general-purpose searches. Returns one NLP summary per URL. fast: Prioritizes lower latency while maintaining good relevance. Returns multiple semantically relevant snippets per URL (configurable via chunks_per_source). ultra-fast: Minimizes latency above all else. Best for time-critical use cases. Returns one NLP summary per URL. Cost: basic, fast, ultra-fast: 1 API Credit advanced: 2 API Credits See Search Best Practices for guidance on choosing the right search depth.
Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use chunks_per_source to define the maximum number of relevant chunks returned per source and to control the content length. Chunks will appear in the content field as: <chunk 1> [...] <chunk 2> [...] <chunk 3>. Available only when search_depth is advanced.
The maximum number of search results to return.
The category of the search.news is useful for retrieving real-time updates, particularly about politics, sports, and major current events covered by mainstream media sources. general is for broader, more general-purpose searches that may include a wide range of sources.
The time range back from the current date to filter results based on publish date or last updated date. Useful when looking for sources that have published or updated data.
Will return all results after the specified start date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD
Will return all results before the specified end date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD
Include an LLM-generated answer to the provided query. basic or true returns a quick answer. advanced returns a more detailed answer.
Include the cleaned and parsed HTML content of each search result. markdown or true returns search result content in markdown format. text returns the plain text from the results and may increase latency.
Also perform an image search and include the results in the response.
When include_images is true, also add a descriptive text for each image.
Whether to include the favicon URL for each result.
A list of domains to specifically include in the search results. Maximum 300 domains.
A list of domains to specifically exclude from the search results. Maximum 150 domains.
Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is general.
When auto_parameters is enabled, Tavily automatically configures search parameters based on your query's content and intent. You can still set other parameters manually, and your explicit values will override the automatic ones. The parameters include_answer, include_raw_content, and max_results must always be set manually, as they directly affect response size. Note: search_depth may be automatically set to advanced when it's likely to improve results. This uses 2 API credits per request. To avoid the extra cost, you can explicitly set search_depth to basic.
Response