opencode-plugin-litellm 1.7.1 → 1.8.0
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 +1 -1
- package/package.json +1 -1
- package/src/plugin/index.ts +11 -0
- package/src/plugin/v2.ts +2 -0
- package/src/utils/model-cache.ts +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ also shows how to configure a provider directly in `opencode.json`.
|
|
|
74
74
|
| 📡 **Dynamic discovery** | Queries `/v1/models` so your OpenCode model picker always reflects your live `model_list`. |
|
|
75
75
|
| ⚡ **Stale-while-revalidate** | A warm disk cache supplies models without a network request. New sessions trigger a background refresh, and cache entries expire after 7 days. |
|
|
76
76
|
| 🏷️ **Smart formatting** | Turns `anthropic/claude-3-5-sonnet` into `Claude 3.5 Sonnet` in the picker — handles versions, sizes, quantizations, and brand-cased names like `gpt-4o`. Set `formatModelNames: false` to keep the raw LiteLLM ids instead. |
|
|
77
|
-
| 🧠 **Modality-aware** | Enriches `/v1/models` entries with `/v1/model/info` (`mode`, token limits, capability flags) and hides embedding / image / audio models from the picker. |
|
|
77
|
+
| 🧠 **Modality-aware** | Enriches `/v1/models` entries with `/v1/model/info` (`mode`, token limits, capability flags) and hides embedding / image / audio models from the picker. Declares `temperature` support only for models whose `supported_openai_params` lists it, so OpenCode applies (and the user can set) a sampling temperature on exactly those models. |
|
|
78
78
|
| 💵 **Real pricing** | Maps `input_cost_per_token` / `output_cost_per_token` (and cache read/write costs) from `/v1/model/info` into OpenCode's `cost` field, so the picker and `/cost` show what the proxy actually bills instead of `$0.00`. Models LiteLLM has no price for are left unpriced, not falsely marked free. |
|
|
79
79
|
| 🧩 **Reasoning-effort variants** | When LiteLLM reports per-model effort support (`supports_low_reasoning_effort`, …), the plugin surfaces each level as a picker variant automatically. |
|
|
80
80
|
| 🧭 **Responses-API routing** | Models LiteLLM reports with `mode: "responses"` are invoked through `/v1/responses` instead of `/v1/chat/completions`, with no extra configuration. OpenCode 2 overrides the runtime package per model; OpenCode 1 gets a `<provider>-responses` sibling. |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "opencode-plugin-litellm",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"description": "OpenCode CLI (v1 and v2) and Desktop plugin for LiteLLM proxy support with auto-detection and dynamic model discovery",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./src/index.ts",
|
package/src/plugin/index.ts
CHANGED
|
@@ -287,6 +287,17 @@ export function toConfigModel(
|
|
|
287
287
|
if (model.supports_vision) {
|
|
288
288
|
entry.attachment = true
|
|
289
289
|
}
|
|
290
|
+
// Declare `temperature` only when `/v1/model/info` lists it among the model's
|
|
291
|
+
// `supported_openai_params`. OpenCode sends a sampling temperature (its own
|
|
292
|
+
// per-model default, or one set on the agent) only for models flagged as
|
|
293
|
+
// supporting it, so a model that accepts the parameter would otherwise
|
|
294
|
+
// silently ignore the user's setting. When the parameter is not listed, or
|
|
295
|
+
// `/v1/model/info` is unavailable, the field stays unset and OpenCode keeps
|
|
296
|
+
// its default behavior (some deployments, such as reasoning-only endpoints or
|
|
297
|
+
// guardrail classifiers, reject the parameter outright).
|
|
298
|
+
if (info?.supported_openai_params?.includes('temperature')) {
|
|
299
|
+
entry.temperature = true
|
|
300
|
+
}
|
|
290
301
|
// Only emit `cost` when LiteLLM actually reported a price. Omitting
|
|
291
302
|
// it (rather than defaulting to 0) lets OpenCode/models.dev fall back
|
|
292
303
|
// to their own default instead of us asserting "this model is free"
|
package/src/plugin/v2.ts
CHANGED
|
@@ -240,6 +240,8 @@ function toProviderModels(
|
|
|
240
240
|
tools: entry.tool_call === undefined ? defaults.capabilities.tools : entry.tool_call === true,
|
|
241
241
|
input,
|
|
242
242
|
output,
|
|
243
|
+
// Left unset (unknown) unless the model was declared to accept it.
|
|
244
|
+
...(entry.temperature === true ? { temperature: true } : {}),
|
|
243
245
|
},
|
|
244
246
|
cost,
|
|
245
247
|
variants,
|
package/src/utils/model-cache.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ModelHints {
|
|
|
29
29
|
* from older plugin versions are ignored rather than deserialized into
|
|
30
30
|
* an incompatible structure.
|
|
31
31
|
*/
|
|
32
|
-
const CACHE_VERSION =
|
|
32
|
+
const CACHE_VERSION = 6
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Maximum age of a cache entry before it's treated as a miss. Without a
|