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

@hellogravel/opencode-lms

v0.2.2

Published

An LM Studio provider plugin for OpenCode — dynamic model discovery, streaming auto-load, and full LM Studio REST API integration

Downloads

935

Readme

@hellogravel/opencode-lms

An LM Studio provider plugin for OpenCode.

What it does

  • Discovers the chat models your LM Studio server is hosting and exposes them in OpenCode. Embedding models are filtered out by default (OpenCode has no slot that consumes them); list one in provider.lmstudio.models to opt it back in.
  • Loads an unloaded LLM on first reference; load progress is logged to the OpenCode server log.
  • Forwards an Authorization: Bearer … header to LM Studio when apiKey is set.
  • Demotes reasoning_effort: "max" to "xhigh" before requests leave OpenCode, since LM Studio rejects max.
  • Sets each model's OpenCode capability flags from what LM Studio reports — reasoning, tool_call, attachment (vision models), temperature, family, etc. — and marks reasoning-capable models with interleaved: { field: "reasoning_content" } so OpenCode renders the streaming reasoning trace live in the TUI.
  • Suppresses OpenCode's auto-generated reasoning-effort picker (low/medium/high) for models that only support binary on/off reasoning, since every choice would route to "on" inside LM Studio anyway. Graduated reasoning models keep the picker.

Set up

Add the plugin and provider to ~/.config/opencode/opencode.jsonc:

{
  "provider": {
    "lmstudio": {
      "name": "LM Studio",
      "options": {
        "baseURL": "http://127.0.0.1:1234",
        "apiKey": "sk-lm-..."
      }
    }
  },
  "model": "lmstudio/google/gemma-4-26b-a4b",
  "plugin": ["@hellogravel/opencode-lms"]
}

Start LM Studio's server (lms server start) and restart OpenCode.

  • This plugin extends OpenCode's built-in lmstudio provider in place — it supplies the live model list via OpenCode's provider.models hook. Do not add lmstudio to disabled_providers, or the plugin's models get disabled too.
  • apiKey is only needed when LM Studio has API token auth enabled.
  • baseURL should not include a /v1 suffix — the plugin appends it.

Upgrading from a pre-0.2 build? The provider id changed from lms to lmstudio. Rename the provider.lms config key to provider.lmstudio, update any "model": "lms/…" reference to "lmstudio/…", and drop the old "disabled_providers": ["lmstudio"] line.

Options

Under provider.lmstudio.options:

| Option | Type | Default | Description | |---|---|---|---| | baseURL | string | "http://127.0.0.1:1234" | LM Studio server URL | | apiKey | string | — | Bearer token sent in the Authorization header | | autoDetect | boolean | true | When baseURL is not set, probe localhost ports 1234, 8080, 11434 | | disableAutoLoad | boolean | false | Skip the auto-load step on first model reference | | autoDownload | boolean | false | Download a missing model on first reference (off by default — a typo could trigger a multi-GB download) | | loadTimeout | number | 600000 | Load/unload timeout in ms | | downloadTimeout | number | 1800000 | Download timeout in ms | | timeout | number | 600000 | Overall chat-completion request timeout in ms | | chunkTimeout | number | 120000 | Inter-chunk (time-to-next-token) timeout in ms — raise for SWA models (see note) |

SWA models (e.g. Gemma) and chunkTimeout: llama.cpp can't reuse the prompt cache for sliding-window-attention models, so every turn reprocesses the entire prompt from scratch. No streamed chunks are emitted during that prompt-processing phase, so a large prompt can exceed chunkTimeout before the first token — the request aborts and retries, reprocessing from 0% again, looping indefinitely. If you see prompt processing restart from 0% repeatedly, raise chunkTimeout (e.g. to match timeout) and/or shrink the prompt by disabling unused tools/MCP servers.

Model overrides

Override per-model metadata under provider.lmstudio.models[<id>]:

"models": {
  "google/gemma-4-e4b": {
    "name": "Gemma 4 E4B",
    "reasoning": true,
    "limit": { "context": 131072, "output": 131072 }
  }
}

| Field | Type | Description | |---|---|---| | id | string | LM Studio model identifier (e.g. google/gemma-4-e4b) | | name | string | Display name | | reasoning | boolean | Mark the model as reasoning-capable | | tool_call | boolean | Mark the model as supporting tool calls | | modalities | object | e.g. { input: ["text","image"], output: ["text"] } | | limit | object | { context: <ctx>, output: <out> } |

Overrides merge on top of discovered models.

Development

git clone https://github.com/hellogravel/opencode-lms
cd opencode-lms
npm install
npm run build       # Compile TypeScript → dist/
npm run typecheck
npm run test:run

For a containerized OpenCode runtime with this plugin loaded, see docker/.

test-live.mjs exercises the plugin against a live LM Studio server:

npm run build
LMS_BASE_URL=http://192.168.1.10:1234 \
LMS_API_KEY=sk-lm-... \
  node test-live.mjs

License

MIT