Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

opencode-plugin-litellm

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-plugin-litellm - npm Package Compare versions

Comparing version
0.4.1
to
0.4.2
+1
-1
package.json
{
"$schema": "https://json.schemastore.org/package.json",
"name": "opencode-plugin-litellm",
"version": "0.4.1",
"version": "0.4.2",
"description": "OpenCode plugin for LiteLLM proxy support with auto-detection and dynamic model discovery",

@@ -6,0 +6,0 @@ "type": "module",

@@ -49,6 +49,22 @@ <div align="center">

"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-litellm@latest"]
"plugin": ["opencode-plugin-litellm@latest"],
"provider": {
"litellm": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:4000/v1"
},
"models": {
"_": { "name": "seed" }
}
}
}
}
```
> **Why the `"_"` seed model?** OpenCode only activates the plugin's
> model-discovery hook when the provider already has at least one model
> entry. The seed is replaced at startup by the full list from your
> LiteLLM proxy.
```bash

@@ -62,4 +78,2 @@ # 3. Start LiteLLM (if it isn't already)

That's it. No provider block required.
## 🎯 Features

@@ -84,10 +98,21 @@

### Zero-config (recommended)
### Minimal config (recommended)
If LiteLLM is on `localhost:4000`, `:8000`, or `:8080`, the plugin self-configures:
Point at your LiteLLM proxy and include a seed model so OpenCode registers the provider:
```json
```jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-litellm@latest"]
"plugin": ["opencode-plugin-litellm@latest"],
"provider": {
"litellm": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:4000/v1"
},
"models": {
"_": { "name": "seed" }
}
}
}
}

@@ -94,0 +119,0 @@ ```

@@ -1,2 +0,2 @@

import type { Plugin, PluginInput, Config } from '@opencode-ai/plugin'
import type { Plugin, PluginInput } from '@opencode-ai/plugin'
import { discoverBucket } from './discover'

@@ -8,23 +8,2 @@

/**
* Ensure a provider entry has a `models` map so OpenCode registers it.
*
* OpenCode skips providers that have no models defined in the config,
* which means the `provider.models` hook would never be called. By
* seeding an empty `models` map we guarantee the provider is created
* and the hook has a chance to populate it with discovered models.
*/
function ensureProviderHasModels(config: Config, providerID: string): void {
if (!config.provider) return
const entry = config.provider[providerID]
if (!entry) return
if (!entry.models || Object.keys(entry.models).length === 0) {
entry.models = {
'_litellm-discovery-pending': {
name: 'Discovering models…',
},
}
}
}
/**
* LiteLLM Plugin for OpenCode.

@@ -34,4 +13,10 @@ *

* `litellm` provider's model list from a live LiteLLM proxy at
* startup. No models need to be hand-defined in `opencode.json`.
* startup.
*
* **Important:** OpenCode only calls `provider.models` when the
* provider has at least one model defined in `opencode.json`. You
* must include a seed model entry — it can be any model id your
* proxy exposes. The plugin will discover and add all remaining
* models automatically.
*
* By default, every discovered model is registered under the

@@ -57,2 +42,5 @@ * `litellm` provider — including OpenAI reasoning-tier models like

* "apiKey": "{env:LITELLM_API_KEY}"
* },
* "models": {
* "_": { "name": "seed" }
* }

@@ -65,5 +53,2 @@ * }

return {
config: async (config: Config) => {
ensureProviderHasModels(config, CHAT_PROVIDER_ID)
},
provider: {

@@ -119,5 +104,2 @@ id: CHAT_PROVIDER_ID,

return {
config: async (config: Config) => {
ensureProviderHasModels(config, RESPONSES_PROVIDER_ID)
},
provider: {

@@ -124,0 +106,0 @@ id: RESPONSES_PROVIDER_ID,