Looking for the JavaScript SDK Reference? Head to our JavaScript SDK Reference and learn how to use tavily-js.

Introduction

Tavily’s JavaScript SDK allows for easy interaction with the Tavily API, offering the full range of our search and extract functionalities directly from your JavaScript and TypeScript programs. Easily integrate smart search and content extraction capabilities into your applications, harnessing Tavily’s powerful search and extract features.

GitHub

/tavily-ai/tavily-js

Dive into our source code!

Quickstart

Get started with our JavaScript SDK in less than 5 minutes!

Get your free API key

You get 1,000 free API Credits every month. No credit card required.

Installation

You can install the Tavily JavaScript SDK using the following:

npm i @tavily/core

Usage

With Tavily’s Python SDK, you can search the web in only 4 lines of code:

const { tavily } = require("@tavily/core");

const tvly = tavily({ apiKey: "tvly-YOUR_API_KEY" });
const response = await tvly.search("Who is Leo Messi?");

console.log(response);

You can also easily extract content from URLs:

const { tavily } = require("@tavily/core");

const tvly = tavily({ apiKey: "tvly-YOUR_API_KEY" });
const response = await tvly.extract("https://en.wikipedia.org/wiki/Lionel_Messi");

console.log(response);

Features

Our JavaScript SDK supports the full feature range of our REST API. Our JavaScript client is asynchronous by default.

  • The search function lets you harness the full power of Tavily Search.
  • The extract function allows you to easily retrieve web content with Tavily Extract.