> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tavily.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Add real-time web search, extraction, crawling, and deep research to OpenCode, the open-source terminal coding agent, through the official Tavily plugin.

Give [OpenCode](https://opencode.ai), the open-source terminal coding agent, live web search, extraction, crawling, and research through the official Tavily plugin, [`@tavily/opencode-plugin`](https://www.npmjs.com/package/@tavily/opencode-plugin). The plugin drives the [Tavily CLI](https://docs.tavily.com/documentation/tavily-cli.md).

**1. Install the Tavily CLI**

```bash theme={null}
curl -fsSL https://cli.tavily.com/install.sh | bash
```

Or install it with Python: `uv tool install tavily-cli` or `pip install tavily-cli`.

**2. Sign in to Tavily**

```bash theme={null}
tvly login
```

This opens Tavily's sign-in in your browser. Alternatively, set an API key from the [Tavily dashboard](https://app.tavily.com):

```bash theme={null}
export TAVILY_API_KEY=tvly-your-api-key
```

If `TAVILY_API_KEY` is set in your environment, the plugin passes it through to shell commands.

**3. Add the plugin**

Add `@tavily/opencode-plugin` to the `plugin` array in your `opencode.json`:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@tavily/opencode-plugin"]
}
```

On OpenCode 2, the key is `plugins` instead of `plugin`. OpenCode installs npm plugins automatically on next launch.

> [accordion] Don't have OpenCode yet?
>
> ```bash theme={null}
> curl -fsSL https://opencode.ai/install | bash
> ```
>
> Or via npm:
>
> ```bash theme={null}
> npm install -g opencode-ai
> ```

**4. Try it**

Start OpenCode and ask a current-events question:

```text theme={null}
Use Tavily to search for the latest Model Context Protocol announcements and cite the sources.
```

The agent should load the `tavily-search` skill, run `tvly search`, and return results with sources.

> [accordion] Watch the setup
>
> <video controls preload="metadata" aria-label="Installing and using the Tavily plugin in OpenCode">
>   <source src="https://mintcdn.com/tavilyai/g9uv41B01nVMuWqZ/images/opencode.mp4?fit=max&auto=format&n=g9uv41B01nVMuWqZ&q=85&s=3325d940e4b402425ca19a2f84cba9d8" type="video/mp4" />
> </video>

## What the plugin adds

The plugin registers the Tavily [Agent Skills](https://docs.tavily.com/documentation/agent-skills.md) from [tavily-ai/skills](https://github.com/tavily-ai/skills):

* `tavily-search` runs web search, reads URLs, and maps or crawls sites with the Tavily CLI.
* `tavily-research` writes multi-source research reports with citations.
* `tavily-entity` fills in a company or person record from the web.
* `tavily-list` builds a deduplicated table of matches.
* `tavily-monitor` sets up recurring checks for new information on a topic.
* `tavily-sdk` helps the agent add Tavily to your application code.

> [accordion] Install the skills without the plugin
>
> OpenCode also loads Agent Skills directly. After installing the CLI and signing in, add the skills to your project:
>
> ```bash theme={null}
> npx skills add tavily-ai/skills --skill '*' --agent opencode
> ```
>
> Add `--global` to install them for all projects. Start a new OpenCode session to load them.

## Example prompts

```text theme={null}
Search for the latest changes to the Model Context Protocol and cite the primary sources.
```

```text theme={null}
Extract https://docs.tavily.com/documentation/api-reference/endpoint/search and summarize the request parameters.
```

```text theme={null}
Crawl the LangChain docs section on retrieval and save the pages locally.
```

```text theme={null}
Research the leading agent observability platforms and compare their capabilities with citations.
```

## Troubleshooting

If the agent cannot access the web or Tavily commands fail, check these in order:

1. Is the plugin listed in `opencode.json`?
   ```json theme={null}
   { "plugin": ["@tavily/opencode-plugin"] }
   ```
2. Is the Tavily CLI installed and authenticated?
   ```bash theme={null}
   tvly --status
   ```

## Learn more

* [OpenCode ecosystem](https://opencode.ai/ecosystem)
* [OpenCode plugin docs](https://opencode.ai/docs/plugins)
* [Tavily plugin for OpenCode on GitHub](https://github.com/tavily-ai/skills/tree/main/.opencode-plugin)
* [Tavily CLI documentation](https://docs.tavily.com/documentation/tavily-cli.md)
* [Tavily API Reference](https://docs.tavily.com/documentation/api-reference/endpoint/search.md)
