@staticeng/opencode-litellm 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,12 +48,15 @@ Shared or synchronized OpenCode configuration should use the published package n
48
48
  | `providerOverrides` | `{}` | Provider-level deep-merge overrides. |
49
49
  | `includeModes` | `chat`, `responses` | LiteLLM modes to include. |
50
50
  | `includeModels` | all included modes | Optional allowlist by model name. |
51
+ | `includeBackends` | unset | Optional exact allowlist by `model_info.backend`, unioned with `includeModels` pins. |
51
52
  | `excludeModels` | none | Optional denylist by model name. |
52
53
  | `timeoutMs` | `30000` | Per-request discovery timeout. |
53
54
  | `strict` | `false` | Throw on fetch/mapping failures instead of warning. |
54
55
 
55
56
  The LiteLLM key must have permission to call `GET /model/info` and root `GET /model_group/info`.
56
57
 
58
+ When `includeBackends` is present, models are candidates when `model_info.backend` exactly and case-sensitively matches an entry or their exact model name is pinned by `includeModels`. Backend values are not trimmed, normalized, or partially matched; missing and non-string values do not match. An empty `includeBackends` matches no backends, so without model pins it includes no models. `excludeModels` always wins over backend matches and pins, and candidates must still pass `includeModes` (or the default `chat` and `responses` modes). When `includeBackends` is omitted, `includeModels` retains its historical behavior: a non-empty array is a model-name allowlist, while an omitted or empty array imposes no model-name allowlist.
59
+
57
60
  ## Overrides
58
61
 
59
62
  LiteLLM metadata does not expose every OpenCode model field. The plugin includes exact built-in contracts for the currently approved GPT-5.4, GPT-5.5, GPT-5.6, DeepSeek V4 Flash, and Qwen3.8 aliases. Use `overrides` to customize those defaults or to add metadata for unknown models.
package/dist/mapping.js CHANGED
@@ -169,8 +169,16 @@ function allowedByFilters(model, options) {
169
169
  return false;
170
170
  if (isRetiredModelAlias(name))
171
171
  return false;
172
- if (options.includeModels?.length && !options.includeModels.includes(name))
172
+ const pinned = options.includeModels?.includes(name) ?? false;
173
+ if (options.includeBackends !== undefined) {
174
+ const backend = model.model_info?.backend;
175
+ const backendMatched = typeof backend === "string" && options.includeBackends.includes(backend);
176
+ if (!backendMatched && !pinned)
177
+ return false;
178
+ }
179
+ else if (options.includeModels?.length && !pinned) {
173
180
  return false;
181
+ }
174
182
  if (options.excludeModels?.includes(name))
175
183
  return false;
176
184
  const modelMode = mode(model);
package/dist/types.d.ts CHANGED
@@ -123,6 +123,8 @@ export type LiteLLMPluginOptions = {
123
123
  includeModes?: string[];
124
124
  excludeModels?: string[];
125
125
  includeModels?: string[];
126
+ /** Exact model_info.backend matches, unioned with includeModels pins. */
127
+ includeBackends?: string[];
126
128
  timeoutMs?: number;
127
129
  strict?: boolean;
128
130
  };
@@ -134,6 +136,7 @@ export type LiteLLMModelInfo = JsonObject & {
134
136
  model_info?: JsonObject & {
135
137
  id?: string;
136
138
  base_model?: string;
139
+ backend?: unknown;
137
140
  mode?: string;
138
141
  input_cost_per_token?: number | string;
139
142
  output_cost_per_token?: number | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staticeng/opencode-litellm",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "OpenCode plugin that discovers LiteLLM models at runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",