npm.io
1.1.0 • Published 5m agoCLI

opencode-tool-kagi

Licence
MIT
Version
1.1.0
Deps
2
Size
18 kB
Vulns
0
Weekly
0
Stars
1

opencode-tool-kagi

OpenCode custom tools powered by the Kagi API — replaces built-in websearch/webfetch with Kagi's premium search and extraction.

Tool Replaces built-in Description
websearch websearch Premium web search via Kagi
webfetch webfetch Fetch and extract markdown from URLs
kagi_extract Explicit extract markdown content from URLs

Setup

npx opencode-tool-kagi

Or locally:

npm run setup

The interactive wizard guides you through:

  • Install scope — per-project (.opencode/tools/) or global (~/.config/opencode/tools/)
  • Tools selection — all tools with built-in overrides, or just kagi_extract
  • API key — optional; set it now or later via KAGI_API_KEY env var

Requirements

API key resolution

The key is looked up in this order:

  1. KAGI_API_KEY environment variable
  2. ~/.config/opencode/kagi-api-key (global, written by the installer)
  3. .opencode/kagi-api-key (per-project)

Usage

Once installed, use the tools directly in opencode:

> websearch "latest ai research papers 2026"
> webfetch https://example.com/article
> kagi_extract urls: ["https://example.com/article"]

Tools

websearch

Overrides the built-in websearch with Kagi's premium search.

Arg Type Required Description
query string Search query
limit number Max results (1–1024, default 10)
workflow enum search, images, videos, news, podcasts
lens_id string Kagi Lens for focused results
safe_search boolean Filter NSFW content
webfetch

Overrides the built-in webfetch with Kagi Extract.

Arg Type Required Description
url string A single URL to fetch
kagi_extract

Explicit extract tool — clean markdown from URLs.

Arg Type Required Description
urls string[] 1–10 URLs to extract
timeout number Time budget in seconds for the bulk extraction (clamped by Kagi)
max_chars number Max characters per URL (truncated locally)