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-models-discovery-v2

v0.0.7

Published

OpenCode plugin for auto-discovery of OpenAI-compatible models with dynamic provider configuration

Readme

opencode-models-discovery-v2

npm version npm downloads release license OpenCode

A universal OpenCode plugin for dynamic model discovery across any OpenAI-compatible provider.

Originally inspired by opencode-lmstudio, this project has been refactored into a general-purpose model discovery plugin with provider-level discovery controls, model filtering, metadata enrichment, and /connect-backed credential support.

Features

  • Works with any OpenAI-compatible provider
  • Discovers models dynamically from provider model endpoints
  • Injects discovered models into OpenCode provider config automatically
  • Supports provider-level include, exclude, and endpoint overrides
  • Supports regex-based model filtering
  • Can enrich model limits and reasoning metadata from provider-specific endpoints
  • Supports OpenCode /connect credentials for custom providers

Installation

npm install opencode-models-discovery-v2
# or
bun add opencode-models-discovery-v2

Quick Start

Add the plugin to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "opencode-models-discovery-v2@latest"
  ],
  "provider": {
    "lmstudio": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LM Studio (local)",
      "options": {
        "baseURL": "http://127.0.0.1:1234/v1",
        "modelsDiscovery": {
          "enabled": true
        }
      }
    }
  }
}

On startup, the plugin will query the provider's models endpoint and merge discovered models into the active OpenCode config.

Upgrade Note

If you upgrade the plugin and OpenCode still behaves like it is using an older build, refresh the OpenCode plugin cache and restart OpenCode.

This can happen because OpenCode may continue using a previously cached package after the npm package itself has been updated.

/connect Support

For custom OpenAI-compatible providers, you still define the provider in opencode.json so OpenCode and this plugin know the provider id, npm package, and baseURL.

If the API credential is managed through OpenCode /connect, you do not need to duplicate the same key in provider.<name>.options.apiKey.

Discovery auth precedence is:

  1. provider.<name>.options.apiKey
  2. OpenCode resolved provider key, when available during plugin startup
  3. OpenCode /connect auth store for same-id type: "api" credentials

Details and examples: docs/connect-and-auth.md

Mimocode Compatibility

This plugin is also compatible with Mimocode as an OpenCode-compatible host.

When startup-time discovery needs to recover /connect-managed API credentials from the local auth store, the plugin selects the host data directory from runtime environment markers:

  • OPENCODE=1 or no host marker: ~/.local/share/opencode/auth.json
  • MIMOCODE=1: ~/.local/share/mimocode/auth.json

This keeps the same provider configuration model while allowing the plugin to work in both OpenCode and Mimocode environments.

Documentation

Requirements

  • OpenCode with plugin support
  • At least one OpenAI-compatible provider running locally or remotely
  • Provider API accessible through either a /v1-style base URL or an explicitly configured discovery endpoint

Logging

When available, the plugin writes logs through OpenCode's structured server log API via client.app.log(...) using the service name opencode-models-discovery-v2.

If structured logging is unavailable in the runtime, the plugin falls back to prefixed console.* output. Key log categories are emitted through metadata such as plugin, config, discovery, event, and filtering to make local debugging easier with opencode --print-logs.

Star History

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

License

MIT

Disclaimer

This project is not built by the OpenCode team and is not affiliated with OpenCode in any way.