Skip to main content
The Tavily CLI (tvly) brings the full Tavily API to your command line. Run web searches, extract content from URLs, crawl websites, discover sitemaps, and launch deep research — all from a single tool. Every command supports --json for machine-readable output, making it easy to integrate into scripts, pipelines, and AI agent workflows.

Installation

Install from PyPI with pip (requires Python 3.10+):
pip install tavily-cli
Verify the install:
tvly --version

Authentication

You need a Tavily API key to use the CLI. Get one for free at tavily.com.

Option 1: Login with an API key (recommended)

tvly login
This opens your browser for authentication. Tokens are stored in ~/.mcp-auth/.
OAuth login requires Node.js/npx to be available on your system.
export TAVILY_API_KEY=tvly-YOUR_API_KEY

Check Your Auth Status

tvly auth

Log Out

tvly logout
This removes stored credentials from disk.

Commands

Extract clean, readable content from one or more URLs.
tvly extract <url> [<url> ...]
You can pass up to 20 URLs at once.

Options

OptionTypeDefaultDescription
--querystringRerank extracted chunks by relevance to this query.
--chunks-per-source1–5Number of content chunks per URL (requires --query).
--extract-depthbasic | advancedbasicExtraction depth. advanced handles JavaScript-rendered pages.
--formatmarkdown | textmarkdownOutput format for extracted content.
--include-imagesflagfalseInclude image URLs found on the page.
--timeout1–60Maximum wait time in seconds.
-o / --outputfile pathSave output to a file.
--jsonflagfalseOutput raw JSON.

Examples

# Extract content from a URL
tvly extract https://example.com/article

# Extract multiple URLs
tvly extract https://example.com/page1 https://example.com/page2

# Extract with relevance filtering
tvly extract https://docs.python.org/3/tutorial/ --query "list comprehensions" --chunks-per-source 3

# Extract JavaScript-rendered content
tvly extract https://example.com/spa-page --extract-depth advanced
Crawl a website starting from a URL and extract content from every discovered page.
tvly crawl <url>

Options

OptionTypeDefaultDescription
--max-depth1–51How many levels deep to crawl from the start URL.
--max-breadthinteger20Maximum links to follow per page.
--limitinteger50Total page cap for the crawl.
--instructionsstringNatural language guidance for the crawler (e.g., “only follow documentation pages”).
--chunks-per-source1–5Chunks per page (requires --instructions).
--extract-depthbasic | advancedbasicExtraction depth for crawled pages.
--formatmarkdown | textmarkdownOutput format for extracted content.
--select-pathscomma-separated regexOnly crawl paths matching these patterns.
--exclude-pathscomma-separated regexSkip paths matching these patterns.
--select-domainscomma-separated regexOnly follow links to matching domains.
--exclude-domainscomma-separated regexSkip links to matching domains.
--allow-external / --no-externalflagWhether to follow links to external domains.
--include-imagesflagfalseInclude images found on pages.
--timeout10–150Maximum wait time in seconds.
-o / --outputfile pathSave full JSON output to a file.
--output-dirdirectory pathSave each crawled page as a separate .md file.
--jsonflagfalseOutput raw JSON.

Examples

# Crawl a docs site (1 level deep)
tvly crawl https://docs.example.com

# Deep crawl with a page limit
tvly crawl https://docs.example.com --max-depth 3 --limit 100

# Crawl only blog posts
tvly crawl https://example.com --select-paths "/blog/.*"

# Save each page as a markdown file
tvly crawl https://docs.example.com --output-dir ./docs-mirror

# Guided crawl
tvly crawl https://docs.example.com --instructions "focus on API reference pages"
Discover all URLs on a website without extracting content. Useful for building sitemaps or understanding site structure.
tvly map <url>

Options

OptionTypeDefaultDescription
--max-depth1–51How many levels deep to discover links.
--max-breadthinteger20Maximum links to follow per page.
--limitinteger50Maximum total URLs to discover.
--instructionsstringNatural language guidance for URL discovery.
--select-pathscomma-separated regexOnly include URLs matching these path patterns.
--exclude-pathscomma-separated regexExclude URLs matching these path patterns.
--select-domainscomma-separated regexOnly include URLs from matching domains.
--exclude-domainscomma-separated regexExclude URLs from matching domains.
--allow-external / --no-externalflagWhether to include external domain links.
--timeout10–150Maximum wait time in seconds.
-o / --outputfile pathSave output to a file.
--jsonflagfalseOutput raw JSON.

Examples

# Discover URLs on a site
tvly map https://example.com

# Deep URL discovery
tvly map https://docs.example.com --max-depth 3 --limit 200

# Only find API doc URLs
tvly map https://docs.example.com --select-paths "/api/.*"

# Save URL list to a file
tvly map https://example.com -o urls.txt
Launch deep, multi-step research on any topic. Tavily’s research engine searches the web, synthesizes sources, and produces a comprehensive report with citations.
tvly research "your research topic"
This is equivalent to tvly research run "your research topic".Reading from stdin:
echo "your topic" | tvly research -

Options

OptionTypeDefaultDescription
--modelmini | pro | autoautoResearch model. mini is faster, pro is more thorough, auto picks the best fit.
--no-waitflagfalseReturn the request_id immediately without waiting for completion.
--streamflagfalseStream results in real-time as the research progresses.
--output-schemafile pathPath to a JSON schema file for structured output.
--citation-formatnumbered | mla | apa | chicagoCitation style for the research report.
--poll-intervalseconds10How often to check for completion.
--timeoutseconds600Maximum time to wait for results.
-o / --outputfile pathSave the report to a file.
--jsonflagfalseOutput raw JSON.

Subcommands

Check status of a running research task:
tvly research status <request_id>
Poll a research task until it completes:
tvly research poll <request_id>
The poll subcommand accepts --poll-interval, --timeout, -o, and --json.

Examples

# Quick research
tvly research "comparison of React vs Vue in 2025"

# Thorough research with the pro model
tvly research "impact of AI on healthcare" --model pro

# Stream results as they come in
tvly research "quantum computing breakthroughs" --stream

# Fire-and-forget: get the ID, poll later
tvly research "market analysis of EVs" --no-wait
# ... later:
tvly research poll <request_id>

# Save the report to a file with APA citations
tvly research "effects of remote work on productivity" --citation-format apa -o report.md

Interactive Mode

Run tvly with no arguments to enter an interactive REPL where you can run commands without the tvly prefix:
tvly
❯ search "latest AI news"
❯ extract https://example.com
❯ exit

Global Options

These options work with the top-level tvly command:
OptionDescription
--versionPrint the CLI version and exit.
--statusPrint the version and authentication status.
--jsonOutput as JSON (applies to --version and --status).
--helpShow help for any command.
tvly --version
tvly --status
tvly search --help

JSON Mode

Add --json to any command to get machine-readable JSON output. This is useful for piping into other tools like jq, or for integration with scripts and AI agents.
# Pipe search results through jq
tvly search "AI news" --json | jq '.results[].title'

# Use in a shell script
RESULTS=$(tvly search "latest papers on RAG" --json)
All human-readable output (spinners, status messages) is written to stderr, so stdout contains only the clean JSON when --json is used.

Environment Variables

VariableDescription
TAVILY_API_KEYYour Tavily API key. Takes precedence over stored credentials.
CodeMeaning
0Success.
2Invalid input or usage error (e.g., missing required argument).
3Authentication error (no API key found, or login failed).
4API error (rate limit, invalid request, server error).

Uninstall

pip uninstall tavily-cli
To also remove stored credentials:
rm -rf ~/.tavily ~/.mcp-auth