← Home

Setup Guide

How to Get a Tavily API Key

Tavily is an AI-optimized search API that gives developers and AI agents structured web search results. This guide walks you through creating a free Tavily account, getting your API key, and using it in your projects.

What Is Tavily?

Tavily is a search API built specifically for AI applications. Unlike traditional search engines that return a list of links, Tavily returns clean, structured content — extracted text, direct answers, and organized data — making it ideal for LLMs, AI agents, and RAG pipelines.

The Tavily API is widely used in AI agent frameworks like LangChain, CrewAI, and OpenClaw. It powers web search capabilities for thousands of AI applications, from research assistants to automated fact-checkers. To use it, you need a Tavily API key (also referred to as TAVILY_API_KEY or tavily_api_key in most configurations).

How to Get a Tavily API Key (Step-by-Step)

Getting your Tavily API key takes less than 2 minutes. Follow these steps:

  1. Go to tavily.com — Open tavily.com in your browser and click “Get API Key” or “Sign Up”.
  2. Create an account — Sign up with your email address or use Google/GitHub OAuth. No credit card is required for the free tier.
  3. Open your dashboard — After signing in, you will land on the Tavily dashboard. Your API key is displayed on the main dashboard page.
  4. Copy your API key — Your Tavily API key starts with tvly- (for example, tvly-AbCdEfGh12345678). Click the copy button to copy it to your clipboard.
  5. Store it securely — Add the key to your .env file or secrets manager. Never commit API keys to version control.

Tavily Free Tier Details

Tavily offers a generous free tier that works well for personal projects and prototyping:

  • 1,000 API calls per month — Enough for most personal AI agents and development workflows
  • No credit card required — Sign up and start searching immediately
  • Full API access — The free tier includes both basic and advanced search depth, answer extraction, and domain filtering
  • Rate limit — Free tier is limited to a reasonable number of requests per minute to prevent abuse

If you exceed 1,000 searches per month, Tavily offers paid plans with higher limits and priority support.

How to Use Your Tavily API Key

Environment Variable

The standard way to configure your Tavily API key is via an environment variable. Most AI frameworks and SDKs look for TAVILY_API_KEY automatically:

# Add to your .env file
TAVILY_API_KEY=tvly-your-api-key-here

# Or export in your terminal
export TAVILY_API_KEY="tvly-your-api-key-here"

Python SDK

Install the official Tavily Python client and make your first search:

pip install tavily-python
from tavily import TavilyClient

# Uses TAVILY_API_KEY env var automatically
client = TavilyClient()

# Or pass the key directly
client = TavilyClient(api_key="tvly-your-api-key-here")

# Basic search
results = client.search("latest AI news 2026")

for result in results["results"]:
    print(result["title"])
    print(result["url"])
    print(result["content"][:200])
    print("---")

Node.js / JavaScript

Use the Tavily API directly with fetch or install the tavily npm package:

npm install tavily
import { TavilyClient } from "tavily";

const client = new TavilyClient({
  apiKey: process.env.TAVILY_API_KEY,
});

const results = await client.search("latest AI news 2026");

for (const result of results.results) {
  console.log(result.title);
  console.log(result.url);
}

Direct API Call (cURL)

You can also call the Tavily API directly without any SDK:

curl -X POST https://api.tavily.com/search \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "tvly-your-api-key-here",
    "query": "latest AI news",
    "search_depth": "basic",
    "max_results": 5
  }'

Using Your Tavily API Key with OpenClaw

If you are building an AI agent with OpenClaw, Tavily is one of the most popular search skills you can add. The OpenClaw Tavily integration guide covers the full setup, but here is the quick version:

  1. Install the skill: /skill install @anthropic/tavily-search
  2. Enter your Tavily API key when prompted
  3. Your agent can now search the web with AI-optimized results

With OpenClaw Launch, you can skip the manual setup entirely. Just paste your Tavily API key into the configurator, and your AI agent deploys with Tavily search pre-configured — no command line or JSON editing needed.

Tavily API Key Troubleshooting

401 Unauthorized / Invalid API Key

  • Verify your key starts with tvly- — if it does not, you may have copied the wrong value from the dashboard
  • Check for trailing spaces or newline characters in your .env file
  • Make sure the environment variable name is exactly TAVILY_API_KEY (case-sensitive)

429 Rate Limit Exceeded

  • You have hit the per-minute rate limit — wait a moment and retry
  • If this happens frequently, consider upgrading to a paid plan for higher limits
  • Add retry logic with exponential backoff in your application

Monthly Quota Exhausted

  • Free tier allows 1,000 searches per month — check your usage on the Tavily dashboard
  • Usage resets on the 1st of each month
  • Upgrade your plan or wait for the reset if you have exceeded the limit

Key Not Being Picked Up

  • Restart your application after adding the TAVILY_API_KEY environment variable
  • If using Docker, make sure the env var is passed via -e TAVILY_API_KEY=... or your docker-compose.yml
  • In Python, verify with import os; print(os.environ.get("TAVILY_API_KEY"))

Frequently Asked Questions

Is the Tavily API key free?

Yes. Tavily offers a free tier that includes 1,000 API calls per month. You can create an account and get your API key at tavily.com without entering any payment information. The free tier includes full access to search features including advanced search depth and answer extraction.

What does a Tavily API key look like?

A Tavily API key is a string that starts with the prefix tvly-, followed by a series of alphanumeric characters (for example, tvly-AbCdEfGh12345678). You can find it on your Tavily dashboard after signing in. If your key does not start with tvly-, you may be looking at the wrong value.

Where do I put my Tavily API key?

The most common approach is to set it as an environment variable named TAVILY_API_KEY. Add TAVILY_API_KEY=tvly-your-key to your .env file, or export it in your terminal. Most Tavily SDKs and AI frameworks (LangChain, CrewAI, OpenClaw) will automatically read this environment variable.

Can I use one Tavily API key for multiple projects?

Yes. A single Tavily API key can be used across multiple projects and applications. All usage counts toward the same monthly quota. If you need separate usage tracking, you can create multiple API keys from your Tavily dashboard — each key shares the same account-level quota.

What's Next?

  • OpenClaw + Tavily guide — Set up Tavily search for your OpenClaw AI agent with advanced configuration options
  • Explore all skills — Browse 3,200+ skills beyond search — coding, automation, image generation, and more
  • Compare AI models — Choose the best model to pair with Tavily search
  • See pricing — Deploy an AI agent with Tavily pre-configured, starting at $3/month

Skip the Setup

Deploy an AI agent with Tavily search already configured. Just paste your API key and launch.

Deploy with OpenClaw Launch