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

v1.0.0

Published

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

Readme

opencode-models-discovery-proxy

npm version npm downloads release license OpenCode

An OpenCode plugin that bridges llama-swap-proxy and OpenCode by automatically populating your provider's model list from the /v1/opencode endpoint at startup.

A fork of opencode-models-discovery

Who is this for?

If you are running llama-swap-proxy, it exposes a /v1/opencode endpoint that returns a fully-formed OpenCode provider config describing every model it serves — including context limits, tool-calling support, reasoning mode, vision capabilities, and multimodal modalities. This plugin reads that endpoint and injects those model definitions directly into OpenCode without any manual configuration, so you never have to keep your OpenCode config in sync with your model lineup.

How it works

  1. OpenCode calls the plugin's config hook at startup with the full config before initializing providers
  2. The hook reads baseURL from your configured provider's options
  3. It fetches <baseURL>/v1/opencode and looks up the entry whose name exactly matches the configured provider name
  4. Every model from that entry is injected into config.provider[name].models — OpenCode then processes the config as if you had written those models statically in opencode.jsonc

The exact-name match means two providers sharing the same base URL but with different names will never bleed models into each other.

Installation

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

Usage

Add the plugin with the provider option set to the exact name of your provider in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    ["opencode-models-discovery-proxy", {
      "provider": "my-server"
    }]
  ],
  "provider": {
    "my-server": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "my-server",
      "options": {
        "baseURL": "http://192.168.2.44:5900/v1"
      }
    }
  }
}

The provider option must match the key used in the provider map — that's the name the plugin will look up in the /v1/opencode response. On next startup, OpenCode will have all models from your llama-swap-proxy instance available automatically.

Multiple servers

To use more than one server, add the plugin once per provider:

{
  "plugin": [
    ["opencode-models-discovery-proxy", { "provider": "my-server" }],
    ["opencode-models-discovery-proxy", { "provider": "my-other-server" }]
  ],
  "provider": {
    "my-server": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://192.168.2.44:5900/v1" }
    },
    "my-other-server": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://192.168.2.44:5901/v1" }
    }
  }
}

/v1/opencode response format

The plugin expects the endpoint to return a JSON document conforming to the OpenCode config schema. The provider section is what gets read:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my-server": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "my-server",
      "options": {
        "baseURL": "http://192.168.2.44:5900/v1"
      },
      "models": {
        "Llama-3.3-70B-Instruct-Q8_0": {
          "name": "Llama-3.3-70B-Instruct-Q8_0",
          "tool_call": true,
          "limit": { "context": 32768, "output": 32768 }
        },
        "Qwen3-8B-Q8_0": {
          "name": "Qwen3-8B-Q8_0",
          "reasoning": true,
          "tool_call": true,
          "limit": { "context": 200000, "output": 200000 }
        },
        "MiniCPM-V-4_5-Q8_0": {
          "name": "MiniCPM-V-4_5-Q8_0",
          "reasoning": true,
          "tool_call": true,
          "attachment": true,
          "limit": { "context": 200000, "output": 200000 },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        }
      }
    }
  }
}

All model fields are optional except name. The server derives these from chat templates and your config.yaml overrides — see the llama-swap-proxy README for details.

| Field | Type | Description | | ----- | ---- | ----------- | | name | string | Display name for the model | | tool_call | boolean | Model supports tool/function calling | | reasoning | boolean | Model has a reasoning/thinking mode | | attachment | boolean | Model accepts file attachments | | limit.context | number | Context window size in tokens | | limit.output | number | Maximum output tokens | | modalities.input | string[] | Accepted input types, e.g. ["text", "image"] | | modalities.output | string[] | Produced output types, e.g. ["text"] |

Plugin configuration

| Option | Required | Description | | ------ | -------- | ----------- | | provider | yes | Exact name of the provider to hook into. Must match the key in your provider map. | | models.includeRegex | no | If non-empty, only inject models whose ID matches one of these patterns | | models.excludeRegex | no | Skip models whose ID matches any of these patterns (ignored when includeRegex is set) |

Example with model filtering:

["opencode-models-discovery-proxy", {
  "provider": "my-server",
  "models": {
    "includeRegex": ["^Llama-", "^Qwen3-"]
  }
}]

Logging

Logs are emitted under the service name opencode-models-discovery-proxy via OpenCode's structured log API (client.app.log), visible with opencode --print-logs.

License

MIT

Contributing

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

Disclaimer

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