# OpenCode

> Give OpenCode live web search, agentic search, news, page retrieval, sitemap discovery, and trending topics with the native opencode-search1api plugin.

Canonical URL: https://s1.dev/docs/integrations/opencode

`opencode-search1api` is a native OpenCode plugin that gives the agent live web access through Search1API — web search, agentic search, news search, readable page retrieval, sitemap discovery, and trending topics.

Unlike an MCP bridge, the plugin registers these as **first-class OpenCode tools**.

## Install

Install for the current project:

```bash
opencode plugin opencode-search1api
```

Or install globally:

```bash
opencode plugin opencode-search1api --global
```

## Authentication

Use one of these methods:

1. Set `SEARCH1API_KEY` in the OpenCode environment.
2. Install `search1api-cli` and run `s1 login` once; the plugin reuses the same OAuth session.
3. Pass an `apiKey` in `opencode.json`:

```json
{
  "plugin": [
    ["opencode-search1api", { "apiKey": "your-api-key" }]
  ]
}
```

Prefer an environment variable or secret manager over committing credentials. Create a key in the [Search1API dashboard](https://app.s1.dev) if you need one.

## What the agent can do

| Tool | What it does |
| --- | --- |
| `search1api_search` | Live web search |
| `search1api_ask` | Agentic search with only `query` (five credits, 45-second timeout) |
| `search1api_news` | News search |
| `search1api_crawl` | Read a public URL as clean Markdown |
| `search1api_sitemap` | Enumerate a site's URLs |
| `search1api_trending` | Trending GitHub repos or Hacker News stories |

`search1api_ask` accepts only `query` (1-500 characters). Its response preserves
`query`, `intent`, result `source` and `relevance`, and optional `errors`.
See [Ask](https://s1.dev/docs/basic/ask).

## Credits

Search and news requests cost one credit each; crawling a page costs one additional credit per successfully crawled page. Agentic search costs five credits per request. New accounts receive 100 credits without a credit card. See [Credits and limits](https://s1.dev/docs/essentials/credits-and-limits) for current rates.

## Search filters and result fields

Version **0.2.0** supports all 19 [search engines](https://s1.dev/docs/basic/search) and all six
[news sources](https://s1.dev/docs/basic/news), including Bing China, Yandex, Grokipedia, and Reuters.
`time_range` supports `day`, `week`, `month`, and `year`; `page` supports search
pagination. These filters apply to search/news; agentic search accepts only `query`.

Engine-specific result fields live in optional `metadata`: GitHub search exposes
`metadata.kind`, `metadata.stars`, `metadata.language`, and `metadata.num_comments`;
Hacker News search exposes `metadata.story_url`, `metadata.points`, and
`metadata.num_comments`. Optional `published_date` stays at the result top level.
The response-level `searchParameters` describes the executed request. These paths
apply to search/news; [trending](https://s1.dev/docs/advanced/trending) keeps its separate response shape.

## Source

[github.com/superagents-lab/opencode-search1api](https://github.com/superagents-lab/opencode-search1api)