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

@abyssal-labs/opencode-models-discovery

v0.1.2

Published

opencode plugin that refreshes OpenAI-compatible model metadata from /models endpoints

Readme

opencode-models-discovery

Local opencode plugin that refreshes model metadata from OpenAI-compatible /models endpoints and applies it to opencode provider config.

This is for OpenAI-compatible wrappers/proxies that set provider.<name>.options.baseURL. Native OpenAI OAuth is skipped because it does not use a custom baseURL and opencode already handles Codex OAuth model limits internally.

It targets custom-baseURL providers using the OpenAI SDK paths:

  • Provider id openai
  • npm: "@ai-sdk/openai"
  • npm: "@ai-sdk/openai-compatible"

All matching providers are included by default. Use providers.include as an optional allowlist; when it is empty or omitted, all matching providers are included. Use providers.exclude to skip a provider.

For every discovered model, it maps endpoint metadata into opencode model config:

  • metadata.context_window -> limit.context
  • metadata.context_length or top-level context_length -> limit.context
  • metadata.input_context_window -> limit.input
  • metadata.max_output_tokens -> limit.output
  • metadata.display_name -> name
  • metadata.input_modalities -> modalities.input
  • metadata.output_modalities -> modalities.output
  • architecture.input_modalities -> modalities.input
  • architecture.output_modalities -> modalities.output

Existing models are overridden by default so the wrapper/proxy /models metadata wins over models.dev metadata. With the default overrideExisting: true, providers expose only models returned by the /models endpoint. This is especially useful for custom openai base URLs because opencode otherwise starts from its built-in OpenAI model catalog.

If the model list does not expose max output tokens, the plugin uses 128000 as limit.output.

Usage

{
  "plugin": ["@abyssal-labs/opencode-models-discovery"],
  "provider": {
    "openai": {
      "options": {
        "modelsDiscovery": {
          "refreshIntervalHours": 24
        }
      }
    },
    "my-openai-compatible-provider": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://example.com/v1",
        "apiKey": "{env:MY_PROVIDER_API_KEY}"
      }
    }
  }
}

Options

Default refresh interval is 24 hours. Cached values are still applied on startup when the cache is fresh; the endpoint is only rechecked after the interval.

{
  "plugin": [
    [
      "@abyssal-labs/opencode-models-discovery",
      {
        "refreshIntervalHours": 12,
        "overrideExisting": true,
        "providers": {
          "include": [],
          "exclude": ["provider-to-skip"]
        }
      }
    ]
  ]
}

Provider-level overrides can live under provider.<name>.options.modelsDiscovery:

{
  "provider": {
    "my-openai-compatible-provider": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://example.com/v1",
        "apiKey": "{env:MY_PROVIDER_API_KEY}",
        "modelsDiscovery": {
          "refreshIntervalHours": 6,
          "overrideExisting": true
        }
      }
    }
  }
}

Supported options:

  • enabled: set false to disable globally.
  • refreshIntervalHours: defaults to 24.
  • refreshIntervalMs: millisecond form, takes precedence over hours.
  • cachePath: global option for cache file location.
  • providers.include: optional allowlist; empty or omitted means include all matching providers.
  • providers.exclude: skip these provider ids.
  • overrideExisting: defaults to true; when true, providers expose only discovered models. When false, discovered models are merged into the existing model catalog without replacing existing definitions.

Default cache path:

~/.cache/opencode-models-discovery/models-cache.json

Restart opencode after changing plugin or config files.