{"_id":"@bluelovers/opencode-lmstudio","name":"@bluelovers/opencode-lmstudio","dist-tags":{"latest":"0.3.4"},"versions":{"0.3.4":{"name":"@bluelovers/opencode-lmstudio","version":"0.3.4","private":false,"description":"OpenCode plugin for enhanced LM Studio support with auto-detection and dynamic model discovery","keywords":["opencode","lmstudio","lm-studio","plugin","local-llm","openai-compatible"],"repository":{"type":"git","url":"git+https://github.com/bluelovers/opencode-lmstudio.git"},"license":"MIT","author":"","type":"module","exports":{".":"./src/index.ts"},"main":"./src/index.ts","scripts":{"lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","test":"vitest","test:coverage":"vitest run --coverage","test:run":"vitest run","test:watch":"vitest watch","build":"npm run typecheck && npm run test:run","npm:publish:bump":"node --run version:bump && npm publish","preversion":"echo preversion && pnpm run build","version":"echo version","version:bump":"ynpx yarn-tool version","prepublishOnly":"pnpm run preversion","postpublish":"node --run postpublish:changelog && node --run postpublish:git:commit && node --run postpublish:git:tag && node --run postpublish:git:push","postpublish:changelog":"ynpx --quiet @yarn-tool/changelog && git add ./CHANGELOG.md","postpublish:git:commit":"git add ./test/__file_snapshots__ & git commit -m \"chore(release): publish\" . & echo postpublish:git:commit","postpublish:git:push":"git push --follow-tags","postpublish:git:tag":"ynpx --quiet @yarn-tool/tag","release":"bun scripts/release.ts","typecheck":"tsc --noEmit","validate":"npm run lint && npm run typecheck && npm run test:run","validate:config":"bun scripts/validate-config.ts"},"dependencies":{"@opencode-ai/plugin":"^1.14.33"},"devDependencies":{"@types/node":"^25.6.0","@vitest/coverage-v8":"^4.1.5","eslint":"^10.3.0","typescript":"^6.0.3","vitest":"^4.1.5"},"publishConfig":{"access":"public"},"gitHead":"53b646c8a063d4e4af35ed34e40e551c00a4c3a4","_id":"@bluelovers/opencode-lmstudio@0.3.4","bugs":{"url":"https://github.com/bluelovers/opencode-lmstudio/issues"},"homepage":"https://github.com/bluelovers/opencode-lmstudio#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-r1/JDjdeN3fharTEepI9gLBCgyPrbmt5QVpn7vazWmgpdgUICo41BxIXRhJTRIDziTZGg4u1UXtYzj7jISbE9A==","shasum":"d3caebefe79ff47bc0bab7694c2a345b39e870a9","tarball":"https://registry.npmjs.org/@bluelovers/opencode-lmstudio/-/opencode-lmstudio-0.3.4.tgz","fileCount":24,"unpackedSize":86855,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBemblgz04SnYwFKpVuPMPGtjz6a4dvhphggPMrN8xFAIgfkNtNLLri2BdPb1nrJphfVoY7p+eZxJ8BPLQxbyHmjU="}]},"_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"directories":{},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-lmstudio_0.3.4_1777979505284_0.07541840508750641"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-05T11:11:45.189Z","0.3.4":"2026-05-05T11:11:45.424Z","modified":"2026-05-05T11:11:45.586Z"},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"description":"OpenCode plugin for enhanced LM Studio support with auto-detection and dynamic model discovery","homepage":"https://github.com/bluelovers/opencode-lmstudio#readme","keywords":["opencode","lmstudio","lm-studio","plugin","local-llm","openai-compatible"],"repository":{"type":"git","url":"git+https://github.com/bluelovers/opencode-lmstudio.git"},"bugs":{"url":"https://github.com/bluelovers/opencode-lmstudio/issues"},"license":"MIT","readme":"# opencode-lmstudio\n\nOpenCode plugin for enhanced LM Studio support with auto-detection and dynamic model discovery.\n\n## Features\n\n- **Auto-detection**: Automatically detects LM Studio running on common ports (1234, 8080, 11434)\n- **Dynamic Model Discovery**: Queries LM Studio's `/v1/models` endpoint to discover available models\n- **Smart Model Formatting**: Automatically formats model names for better readability (e.g., \"Qwen3 30B A3B\" instead of \"qwen/qwen3-30b-a3b\")\n- **Organization Owner Extraction**: Extracts and sets `organizationOwner` field from model IDs\n- **Health Check Monitoring**: Verifies LM Studio is accessible before attempting operations\n- **Automatic Configuration**: Auto-creates `lmstudio` provider if detected but not configured\n- **Model Merging**: Intelligently merges discovered models with existing configuration\n- **Comprehensive Caching**: Reduces API calls with intelligent caching system\n- **Error Handling**: Smart error categorization with auto-fix suggestions\n\n## Installation\n\n```bash\nnpm install opencode-lmstudio\n# or\nbun add opencode-lmstudio\n```\n\n## Usage\n\nAdd the plugin to your `opencode.json`:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\n    \"opencode-lmstudio@latest\"\n  ],\n  \"provider\": {\n    \"lmstudio\": {\n      \"npm\": \"@ai-sdk/openai-compatible\",\n      \"name\": \"LM Studio (local)\",\n      \"options\": {\n        \"baseURL\": \"http://127.0.0.1:1234/v1\"\n      }\n    }\n  }\n}\n```\n\n### Auto-detection\n\nIf you don't configure the `lmstudio` provider, the plugin will automatically detect LM Studio if it's running on one of the common ports and create the provider configuration for you.\n\n### Manual Configuration\n\nYou can also manually configure the provider with specific models:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\n    \"opencode-lmstudio@latest\"\n  ],\n  \"provider\": {\n    \"lmstudio\": {\n      \"npm\": \"@ai-sdk/openai-compatible\",\n      \"name\": \"LM Studio (local)\",\n      \"options\": {\n        \"baseURL\": \"http://127.0.0.1:1234/v1\"\n      },\n      \"models\": {\n        \"google/gemma-3n-e4b\": {\n          \"name\": \"Gemma 3n-e4b (local)\"\n        }\n      }\n    }\n  }\n}\n```\n\nThe plugin will automatically discover and add any additional models available in LM Studio that aren't already configured.\n\n### Auto Model (Use Last Loaded Model)\n\nThe plugin automatically adds an `auto` model to your LM Studio provider configuration. The `auto` model tells LM Studio to use whichever model is currently loaded (the last loaded model).\n\n#### Configuration\n\n**Option 1: Automatic (Recommended)**\n\nThe plugin automatically adds the `auto` model to your configuration. You don't need to manually configure it—just select \"Auto (Use Last Loaded Model)\" from the model selector in OpenCode.\n\n**Option 2: Manual Configuration**\n\nYou can also manually add the `auto` model to your `opencode.jsonc`:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\n    \"opencode-lmstudio@latest\"\n  ],\n  \"provider\": {\n    \"lmstudio\": {\n      \"npm\": \"@ai-sdk/openai-compatible\",\n      \"name\": \"LM Studio (local)\",\n      \"options\": {\n        \"baseURL\": \"http://127.0.0.1:1234/v1\"\n      },\n      \"models\": {\n        \"auto\": {\n          \"name\": \"Auto (Use Last Loaded Model)\"\n        }\n      }\n    }\n  }\n}\n```\n\n**Option 3: Direct Model Reference**\n\nAlternatively, you can reference the auto model directly using the `lmstudio/auto` model ID:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"model\": \"lmstudio/auto\"\n}\n```\n\n**⚠️ Critical Note:** The `auto` model does **NOT** automatically load models in LM Studio. It simply tells the plugin to use whatever model is **currently already loaded** in LM Studio. You must manually load a model in the LM Studio application first. If no model is loaded, requests will fail.\n\n## How It Works\n\n1. On OpenCode startup, the plugin's `config` hook is called\n2. If an `lmstudio` provider is found, it checks if LM Studio is accessible\n3. If not configured, it attempts to auto-detect LM Studio on common ports\n4. If accessible, it queries the `/v1/models` endpoint\n5. Discovered models are merged into your configuration\n6. The enhanced configuration is used for the current session\n\n## Requirements\n\n- OpenCode with plugin support\n- LM Studio running locally (default port: 1234)\n- LM Studio server API accessible at `http://127.0.0.1:1234/v1`\n\n## License\n\nMIT\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n","readmeFilename":"README.md","_rev":"1-b6c5c013b3992b7b738b21fdc71b882d"}