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-local-ollama

v0.1.0

Published

Native Ollama model discovery for OpenCode.

Readme

OpenCode Local Ollama Provider

Native Ollama model discovery for OpenCode.

opencode-local-ollama is a native OpenCode provider plugin. It discovers the models you already have in Ollama and registers them as ollama/<model> in OpenCode, so they show up in /models without a manual sync step.

Why

Existing Ollama/OpenCode helpers usually generate config files or require a separate sync command. This plugin runs during OpenCode startup and uses OpenCode's provider hook directly.

Features

  • Discovers local models from Ollama on OpenCode boot.
  • Uses /api/tags to list local models.
  • Uses /api/show for exact model metadata.
  • Registers models under the ollama provider.
  • Uses Ollama's OpenAI-compatible endpoint at /v1.
  • Respects OLLAMA_HOST and plugin options.
  • Model agnostic: no hardcoded Qwen, Llama, Gemma, Mistral, or DeepSeek rules.
  • Strict by default: no guessed capabilities.
  • Skips non-chat models when Ollama does not report completion or chat capability.

Install

npm install -g opencode-local-ollama

Then add it to your OpenCode config:

{
   "plugin": ["opencode-local-ollama"]
}

Restart OpenCode and run:

/models

You should see entries like:

ollama/llama3.2:latest
ollama/gemma4:31b
ollama/qwen3.5:35b

Usage

Pull a model with Ollama:

ollama pull llama3.2

Restart OpenCode. The model becomes available as:

ollama/llama3.2:latest

Configuration

Default behavior uses OLLAMA_HOST if set, otherwise http://localhost:11434.

{
   "plugin": [
      [
        "opencode-local-ollama",
        {
          "host": "http://localhost:11434"
        }
      ]
    ]
}

Options:

| Option | Default | Description | | --- | --- | --- | | host | OLLAMA_HOST or http://localhost:11434 | Ollama API host. May include a proxy path. | | baseURL | unset | Alias for host. If it ends in /v1, the plugin derives the Ollama API base from it. | | providerID | ollama | OpenCode provider ID to register. | | timeout | 5000 | Ollama request timeout in milliseconds. | | context | 4096 | Explicit context limit to expose to OpenCode. | | output | 4096 | Explicit output token limit to expose to OpenCode. | | useModelInfoContext | false | Use GGUF architecture context from model_info when num_ctx is not configured. Disabled by default because it can be larger than the runtime context Ollama actually uses. |

Capability Mapping

The plugin treats Ollama as the source of truth.

| Ollama capability | OpenCode mapping | | --- | --- | | completion or chat | text input/output model | | tools | tool calling enabled | | vision or image | image attachments enabled | | thinking or reasoning | reasoning enabled |

If Ollama does not report a capability, this plugin does not invent it from the model name.

Context Limits

Ollama model metadata can report very large architecture context windows, such as 131072, while runtime num_ctx may still be much smaller. To avoid overfilling local models, this plugin uses this priority:

  1. Explicit plugin context option
  2. num_ctx from /api/show parameters or Modelfile
  3. model_info.*.context_length only when useModelInfoContext is true
  4. Safe default 4096

Development

npm install
npm test
npm run typecheck
npm run build

License

MIT