An OpenCode plugin for Anthropic web search with citations
npm install opencode-anthropic-websearchAn OpenCode plugin for Anthropic web search with citations.
- Uses Anthropic's native web_search_20250305 tool
- Supports both API key and OAuth authentication
- Automatically refreshes OAuth tokens when expired
- Formats responses with numbered citations and sources
``bash`
bun install opencode-anthropic-websearch
Or for local development:
`bash`
git clone
cd opencode-anthropic-websearch
bun install
bun run build
Add the plugin to your ~/.config/opencode/opencode.json:
`json`
{
"plugins": [
"file:///path/to/opencode-anthropic-websearch"
]
}
Once configured, the anthropic_web_search tool is automatically available to the LLM. It will be used when Claude needs to search the web for current information.
The LLM can call the tool with a query:
``
anthropic_web_search({ query: "latest news about AI developments" })
The response includes the search results with numbered citations:
`
According to recent reports, AI developments have accelerated... [1][2]
---
Sources:
[1] Article Title: https://example.com/article1
[2] Another Article: https://example.com/article2
`
The plugin supports two authentication methods:
1. API Key: Use your Anthropic API key
2. OAuth: Use Claude Pro/Max subscription via OAuth (automatically refreshes tokens)
Authenticate via opencode auth login and select your preferred method.
`bashInstall dependencies
bun install
MIT