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

@aiand/opencode-plugin

v0.1.0

Published

ai& provider plugin for OpenCode — live model catalog + API-key auth via the ai& gateway

Readme

ai& for OpenCode

Add ai& as a provider in OpenCode with a single plugin.

What you get

An ai& provider in OpenCode that:

  1. Routes to the ai& gatewayhttps://api.aiand.com/v1 (OpenAI-compatible).
  2. Logs in cleanlyopencode auth loginai& → paste your sk-... key.
  3. Lists the live catalog — the model picker is populated straight from ai&'s public /v1/api.json, so new models show up without touching the plugin.

Requires OpenCode (curl -fsSL https://opencode.ai/install | bash).

Install

Reference the npm package in your opencode.json (per-project) or ~/.config/opencode/opencode.jsonc (global) — OpenCode installs it automatically on first run:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@aiand/opencode-plugin"],
  "model": "aiand/zai-org/glm-5.2"
}

Then log in and run:

opencode auth login                 # choose ai& → paste your sk-... key
opencode                            # TUI
opencode run "say hi in one word"   # one-shot

(Non-interactive alternative: export AIAND_API_KEY=sk-... instead of auth login.)

Version pinning: a bare "@aiand/opencode-plugin" installs the latest version on first run and keeps using that cached copy afterwards. To pin (or force an upgrade), use an explicit version — "@aiand/[email protected]" — which OpenCode caches separately per version.

Auth

  • Main path: opencode auth login → choose ai& → paste your sk-... key. The key is stored by OpenCode and used for every project.
  • Alternative (non-interactive / CI): export AIAND_API_KEY=sk-....

The model picker and catalog populate without a key (/v1/api.json is public); a key is only needed to actually send a message. Get one at aiand.com.

How it works

The plugin uses two OpenCode hooks:

| Hook | What it does | |---|---| | config | fetches ai&'s public /v1/api.json and registers the aiand provider (@ai-sdk/openai-compatible, baseURL) with the live model list injected inline | | auth | adds the "ai& API Key" login method; injects the stored key as Bearer |

Why inline models (not the provider.models() hook)? OpenCode only runs provider.models() for providers already known to models.dev; a brand-new provider's models must be declared in config. The config hook runs before OpenCode reads cfg.provider, so fetching the catalog there and setting provider.aiand.models is what makes the picker show ai&'s live models.

Configuration

| Env var | Default | Purpose | |---|---|---| | AIAND_API_KEY | — | Your ai& API key (alternative to opencode auth login). | | AIAND_BASE_URL | https://api.aiand.com/v1 | Override the gateway base URL. |

Contributing / local development

The plugin is a single module, src/index.ts. The repo's own opencode.json loads it as a file plugin, so you can test changes without building or publishing:

git clone [email protected]:aiandlabs/aiand-opencode-plugin.git
cd aiand-opencode-plugin
opencode run "say hi in one word"   # loads ./src/index.ts directly

To use your checkout from other projects, reference it by absolute path in your global config:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["/absolute/path/to/aiand-opencode-plugin/src/index.ts"]
}

Build and check the published artifact shape (also run in CI):

npm install
npm run build        # tsc → dist/
npm run check:dist   # asserts the compiled entry satisfies OpenCode's plugin loader

Releasing

Bump version in package.json, then publish a GitHub Release tagged v<version> — the Publish workflow builds, smoke-tests, verifies the tag matches package.json, and runs npm publish with provenance.

Next steps

  • Add an OAuth login method as an alternative to API keys.