Get API Key
Sign up at tavily.com
Introduction
OpenCode is an open-source AI coding agent for the terminal. It runs as a TUI that understands your codebase, edits files, runs shell commands, and supports plugins, custom agents, and skills. Tavily integrates with OpenCode through the officialopencode-tavily plugin. The plugin registers the Tavily skill with OpenCode, giving the agent reliable web search, content extraction, crawling, URL discovery, and deep research with citations — powered by the Tavily CLI under the hood.
What the plugin adds
Once installed, the agent can:- Search the web with optional content extraction
- Extract any webpage to clean markdown or text
- Map all URLs on a website
- Crawl entire websites recursively
- Research — AI-powered deep research with citations
All output is written to a
.tavily/ directory to avoid flooding the agent’s context.Requirements
- OpenCode installed locally
- The Tavily CLI (
tvly) - A Tavily account
Setup
Step 1: Install OpenCode
Step 1: Install OpenCode
If OpenCode is not installed yet, install it first:Or via npm:
Step 2: Install the Tavily CLI
Step 2: Install the Tavily CLI
The plugin drives Tavily through the Or via Python:
tvly CLI:Step 3: Add the plugin to your OpenCode config
Step 3: Add the plugin to your OpenCode config
Add OpenCode installs npm plugins automatically on next launch.
opencode-tavily to the plugin array in your opencode.json:Step 4: Authenticate with Tavily
Step 4: Authenticate with Tavily
Browser login is recommended — it opens Tavily’s OAuth flow automatically:Alternatively, set an API key from the Tavily Dashboard:
Step 5: Verify the plugin is working
Step 5: Verify the plugin is working
Start OpenCode and ask a current-events question, for example:The agent should run
tvly search and return grounded results with sources.Example prompts
Troubleshooting
If the agent cannot access the web or Tavily commands fail, check these in order:- Is the plugin listed in
opencode.json? - Is the Tavily CLI installed and authenticated?