npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-tool-kagi

v2.0.0

Published

OpenCode custom tools powered by the Kagi API — replaces built-in websearch with Kagi's premium search

Readme

opencode-tool-kagi

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

OpenCode v2 required. This release ships an OpenCode v2 plugin that registers Kagi as a websearch provider and stores the API key in OpenCode's credential store. The .opencode/tools/ copy install from the 1.x line is deprecated and will be removed in a future release.

| Tool | Replaces built-in | Description | |------|-------------------|-------------| | websearch | ✅ websearch | Premium web search via Kagi (registered as the default websearch provider) | | webfetch | ✅ webfetch | Fetch and extract markdown from a URL | | kagi_extract | — | Explicit extract markdown content from 1–10 URLs |

Setup

OpenCode v2 (recommended)

Install the plugin through OpenCode:

opencode plugin add opencode-tool-kagi

Or add it to opencode.jsonc yourself:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-tool-kagi"],
}

Then connect your Kagi account from the TUI — the key is stored in opencode's credential store, not in a plaintext file:

/connect
# Select Kagi, then paste your API key.

Plugin options can disable individual pieces:

{
  "plugins": [
    {
      "package": "opencode-tool-kagi",
      "options": { "websearch": true, "webfetch": true, "extract": true },
    },
  ],
}

OpenCode v1 (legacy)

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

  • OpenCode v2 (plugin) or v1 (copied tools)
  • Node.js >= 18 for the v1 wizard
  • A Kagi API key

API key resolution

The key is looked up in this order:

  1. The Kagi credential stored by opencode (/connect, or KAGI_API_KEY exposed as an integration connection)
  2. KAGI_API_KEY environment variable
  3. ~/.config/opencode/kagi-api-key (global, written by the v1 installer)
  4. .opencode/kagi-api-key (per-project)

On OpenCode v2 the plugin registers a kagi integration, so /connect manages the key through opencode's auth system. The file/env fallbacks remain for the v1 tools.

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

Replaces the built-in websearch with Kagi's premium search by registering Kagi as the default websearch provider.

webfetch

Replaces the built-in webfetch with Kagi Extract.

| Arg | Type | Required | Description | |-----|------|----------|-------------| | url | string | ✅ | A single URL to fetch | | format | enum | — | Accepted for compatibility; Kagi always returns markdown | | timeout | number | — | Time budget in seconds for the extraction |

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) |