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

v1.3.0

Published

Auto-discover models from local OpenAI-compatible API endpoints for OpenCode

Readme

opencode-autodiscover

Auto-discover models from local OpenAI-compatible API endpoints for OpenCode.

Features

  • Auto-discovers models from local endpoints (Ollama, LM Studio, LLM proxies)
  • Fetches metadata from Models.dev and OpenRouter (context window, capabilities, cost)
  • Caches metadata locally (24h TTL)
  • Supports multiple endpoints
  • API key authentication via config or environment variables
  • Model filtering with include/exclude patterns

Installation

opencode plugin opencode-autodiscover

Or install globally:

opencode plugin opencode-autodiscover -g

Configuration

Add provider(s) to your opencode.json:

{
  "provider": {
    "local-ollama": {
      "name": "Ollama",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      }
    },
    "local-lmstudio": {
      "name": "LM Studio",
      "options": {
        "baseURL": "http://localhost:1234/v1"
      }
    }
  }
}

With API Key

{
  "provider": {
    "local-proxy": {
      "name": "My Proxy",
      "options": {
        "baseURL": "http://localhost:8080/v1",
        "apiKey": "sk-your-key"
      }
    }
  }
}

Environment Variables

API keys can be set via environment variables:

export OPENCODE_LOCAL_MY_PROXY_API_KEY=sk-your-key

Model Overrides

Override metadata for specific models:

{
  "provider": {
    "local-ollama": {
      "options": {
        "baseURL": "http://localhost:11434/v1",
        "modelOverrides": {
          "my-custom-model": {
            "contextWindow": 128000,
            "maxOutput": 8192
          }
        }
      }
    }
  }
}

Model Filtering

Control which models are discovered using include and exclude glob patterns inside options:

{
  "provider": {
    "local-ollama": {
      "options": {
        "baseURL": "http://localhost:11434/v1",
        "include": ["qwen/*"],
        "exclude": ["*embedding*", "*test*"]
      }
    }
  }
}
  • include — if set, only models matching at least one pattern are discovered
  • exclude — models matching any pattern are skipped (applied after include)
  • * matches anything (including /)
  • Matching is case-insensitive
  • Special characters (., [, ], etc.) are treated as literals

Usage

Models are auto-discovered at startup and appear in /models natively.

To refresh models, use the refresh-local-models tool in OpenCode, then restart.

CLI Options

opencode plugin opencode-autodiscover         # Install to project config
opencode plugin opencode-autodiscover -g      # Install to global config
opencode plugin opencode-autodiscover -f      # Force update existing plugin
opencode plugin opencode-autodiscover --pure  # Run without external plugins

How It Works

  1. On startup, the plugin reads provider configs with baseURL options
  2. Fetches available models from each endpoint (/v1/models)
  3. Looks up metadata from Models.dev and OpenRouter (context window, cost, capabilities)
  4. Injects discovered models into the provider config
  5. Models appear in OpenCode's /models UI

Caching

Metadata is cached locally for 24 hours:

  • Location: ~/.cache/opencode-autodiscover/
  • Files:
    • openrouter.json — OpenRouter metadata cache
    • modelsdev.json — Models.dev metadata cache

Use the refresh-local-models tool to clear cache and re-fetch.

Development

npm install
npm test
npm run build

License

MIT