@openclaw/opencode-provider 2026.9.1 → 2026.9.3

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/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import { opencodeMediaUnderstandingProvider } from "./media-understanding-provider.js";
2
2
  import { OPENCODE_ZEN_DEFAULT_MODEL_REF, applyOpencodeZenProviderConfig } from "./onboard.js";
3
- import { a as prepareOpencodeZenModel, c as openclaw_plugin_default, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./provider-catalog-BVKGghG5.js";
3
+ import { a as prepareOpencodeZenModel, c as openclaw_plugin_default, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./provider-catalog-C73VbD-L.js";
4
4
  import { resolveThinkingProfile } from "./provider-policy-api.js";
5
5
  import { registerOpenCodeSessionCatalog } from "./session-catalog-plugin.js";
6
6
  import { wrapOpencodeProviderStream } from "./stream.js";
7
+ import { runLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
8
+ import { resolveFirstProviderCatalogAuth } from "openclaw/plugin-sdk/provider-catalog-shared";
7
9
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
8
10
  import { buildProviderReplayFamilyHooks, matchesExactOrPrefix } from "openclaw/plugin-sdk/provider-model-shared";
9
11
  import { createOpenAICompatibleCompletionsThinkingOffWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
@@ -11,12 +13,6 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coer
11
13
  //#region extensions/opencode/index.ts
12
14
  const PROVIDER_ID = "opencode";
13
15
  const MINIMAX_MODERN_MODEL_MATCHERS = ["minimax-m2.7"];
14
- function resolveOpencodeZenCatalogAuth(resolveProviderApiKey) {
15
- const own = resolveProviderApiKey(PROVIDER_ID);
16
- if (own.apiKey || own.discoveryApiKey) return own;
17
- const shared = resolveProviderApiKey("opencode-go");
18
- return shared.apiKey || shared.discoveryApiKey ? shared : void 0;
19
- }
20
16
  function isModernOpencodeModel(modelId) {
21
17
  const lower = normalizeLowercaseStringOrEmpty(modelId);
22
18
  if (lower.endsWith("-free") || lower === "alpha-glm-4.7") return false;
@@ -91,13 +87,17 @@ var opencode_default = defineSingleProviderPluginEntry({
91
87
  order: "simple",
92
88
  run: async (ctx) => {
93
89
  if (ctx.providerIds !== void 0 && !ctx.providerIds.includes(PROVIDER_ID)) return null;
94
- const auth = resolveOpencodeZenCatalogAuth(ctx.resolveProviderApiKey);
90
+ const auth = resolveFirstProviderCatalogAuth(ctx.resolveProviderApiKey, [PROVIDER_ID, "opencode-go"]);
95
91
  if (!auth) return null;
96
92
  if (!auth.discoveryApiKey) return { provider: buildStaticOpencodeZenProviderConfig(auth.apiKey) };
97
- return { provider: await buildOpencodeZenLiveProviderConfig({
98
- apiKey: auth.apiKey ?? auth.discoveryApiKey,
99
- discoveryApiKey: auth.discoveryApiKey
100
- }) };
93
+ return await runLiveProviderCatalog({
94
+ providerId: PROVIDER_ID,
95
+ profileId: auth.profileId,
96
+ run: async () => ({ provider: await buildOpencodeZenLiveProviderConfig({
97
+ apiKey: auth.apiKey ?? auth.discoveryApiKey,
98
+ discoveryApiKey: auth.discoveryApiKey
99
+ }) })
100
+ });
101
101
  },
102
102
  staticRun: async () => ({ provider: buildStaticOpencodeZenProviderConfig() })
103
103
  },
@@ -1,9 +1,8 @@
1
- import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
2
1
  import { buildLiveModelProviderConfig, fetchLiveProviderModelIds, getCachedUpstreamProviderCatalog, listProviderCatalogSnapshotEntries, projectProviderCatalogSnapshotRows, projectUpstreamProviderCatalogSnapshot } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
2
+ import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
3
3
  //#region extensions/opencode/openclaw.plugin.json
4
4
  var openclaw_plugin_default = {
5
5
  id: "opencode",
6
- icon: "https://cdn.simpleicons.org/opencode",
7
6
  activation: { "onStartup": true },
8
7
  providerCatalogEntry: "./provider-discovery.ts",
9
8
  enabledByDefault: true,
@@ -140,6 +139,7 @@ var openclaw_plugin_default = {
140
139
  "contextWindow": 1048576,
141
140
  "maxTokens": 65536,
142
141
  "compat": {
142
+ "codeMode": "capable",
143
143
  "supportsUsageInStreaming": true,
144
144
  "supportsReasoningEffort": true,
145
145
  "supportedReasoningEfforts": [
@@ -349,6 +349,7 @@ async function buildOpencodeZenLiveProviderConfig(params = {}) {
349
349
  if (upstream) cacheUpstreamOpencodeZenModels(upstream);
350
350
  } catch {}
351
351
  return await buildLiveModelProviderConfig({
352
+ discoveryMode: "strict",
352
353
  providerId: PROVIDER_ID,
353
354
  endpoint: OPENCODE_ZEN_MODELS_ENDPOINT,
354
355
  providerConfig: {
@@ -1,2 +1,2 @@
1
- import { a as prepareOpencodeZenModel, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./provider-catalog-BVKGghG5.js";
1
+ import { a as prepareOpencodeZenModel, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./provider-catalog-C73VbD-L.js";
2
2
  export { buildOpencodeZenLiveProviderConfig, buildStaticOpencodeZenProviderConfig, listOpencodeZenModelCatalogEntries, normalizeOpencodeZenBaseUrl, prepareOpencodeZenModel, resolveOpencodeZenModel, resolveOpencodeZenStarterModel };
@@ -1,4 +1,4 @@
1
- import { n as buildStaticOpencodeZenProviderConfig } from "./provider-catalog-BVKGghG5.js";
1
+ import { n as buildStaticOpencodeZenProviderConfig } from "./provider-catalog-C73VbD-L.js";
2
2
  //#region extensions/opencode/provider-discovery.ts
3
3
  const opencodeProviderDiscovery = {
4
4
  id: "opencode",
@@ -1,4 +1,5 @@
1
1
  import { resolveClaudeThinkingProfile } from "openclaw/plugin-sdk/claude-model-runtime";
2
+ import { resolveEffortThinkingProfile } from "openclaw/plugin-sdk/provider-thinking-runtime";
2
3
  //#region extensions/opencode/provider-policy-api.ts
3
4
  const FIXED_REASONING_PROFILE = {
4
5
  levels: [{
@@ -7,25 +8,6 @@ const FIXED_REASONING_PROFILE = {
7
8
  }],
8
9
  defaultLevel: "off"
9
10
  };
10
- const THINKING_LEVEL_IDS = /* @__PURE__ */ new Set([
11
- "off",
12
- "minimal",
13
- "low",
14
- "medium",
15
- "high",
16
- "xhigh",
17
- "max"
18
- ]);
19
- function resolveEffortThinkingProfile(efforts) {
20
- if (!efforts || efforts.length === 0) return;
21
- const acceptedLevelIds = ["off", ...efforts.map((effort) => effort === "none" ? "off" : effort)].filter((id) => THINKING_LEVEL_IDS.has(id)).filter((id, index, values) => values.indexOf(id) === index);
22
- const levels = acceptedLevelIds.map((id) => ({ id }));
23
- const levelIdSet = new Set(acceptedLevelIds);
24
- return {
25
- levels,
26
- defaultLevel: levelIdSet.has("medium") ? "medium" : levelIdSet.has("high") ? "high" : levelIdSet.has("low") ? "low" : "off"
27
- };
28
- }
29
11
  function resolveThinkingProfile(params) {
30
12
  const modelId = params.modelId.trim().toLowerCase();
31
13
  if (modelId.startsWith("claude-")) return resolveClaudeThinkingProfile(modelId);
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "id": "opencode",
3
- "icon": "https://cdn.simpleicons.org/opencode",
4
- "activation": { "onStartup": true },
5
- "providerCatalogEntry": "./provider-discovery.ts",
3
+ "activation": {
4
+ "onStartup": true
5
+ },
6
+ "providerCatalogEntry": "./dist/provider-discovery.js",
6
7
  "enabledByDefault": true,
7
- "providers": ["opencode"],
8
+ "providers": [
9
+ "opencode"
10
+ ],
8
11
  "providerEndpoints": [
9
12
  {
10
13
  "endpointClass": "opencode-native",
11
- "baseUrls": ["https://opencode.ai/zen", "https://opencode.ai/zen/v1"]
14
+ "baseUrls": [
15
+ "https://opencode.ai/zen",
16
+ "https://opencode.ai/zen/v1"
17
+ ]
12
18
  }
13
19
  ],
14
20
  "providerRequest": {
15
- "providers": { "opencode": { "family": "opencode" } }
21
+ "providers": {
22
+ "opencode": {
23
+ "family": "opencode"
24
+ }
25
+ }
16
26
  },
17
27
  "modelCatalog": {
18
28
  "providers": {
@@ -27,14 +37,28 @@
27
37
  "provider": "opencode",
28
38
  "baseUrl": "https://opencode.ai/zen",
29
39
  "reasoning": true,
30
- "input": ["text", "image"],
31
- "cost": { "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite": 6.25 },
40
+ "input": [
41
+ "text",
42
+ "image"
43
+ ],
44
+ "cost": {
45
+ "input": 5,
46
+ "output": 25,
47
+ "cacheRead": 0.5,
48
+ "cacheWrite": 6.25
49
+ },
32
50
  "contextWindow": 1000000,
33
51
  "maxTokens": 128000,
34
52
  "compat": {
35
53
  "supportsUsageInStreaming": true,
36
54
  "supportsReasoningEffort": true,
37
- "supportedReasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
55
+ "supportedReasoningEfforts": [
56
+ "low",
57
+ "medium",
58
+ "high",
59
+ "xhigh",
60
+ "max"
61
+ ],
38
62
  "maxTokensField": "max_tokens",
39
63
  "codeMode": "capable"
40
64
  }
@@ -46,7 +70,10 @@
46
70
  "provider": "opencode",
47
71
  "baseUrl": "https://opencode.ai/zen/v1",
48
72
  "reasoning": true,
49
- "input": ["text", "image"],
73
+ "input": [
74
+ "text",
75
+ "image"
76
+ ],
50
77
  "cost": {
51
78
  "input": 2,
52
79
  "output": 10,
@@ -58,14 +85,19 @@
58
85
  "output": 10,
59
86
  "cacheRead": 0.2,
60
87
  "cacheWrite": 2.5,
61
- "range": [0, 272000]
88
+ "range": [
89
+ 0,
90
+ 272000
91
+ ]
62
92
  },
63
93
  {
64
94
  "input": 4,
65
95
  "output": 15,
66
96
  "cacheRead": 0.4,
67
97
  "cacheWrite": 5,
68
- "range": [272000]
98
+ "range": [
99
+ 272000
100
+ ]
69
101
  }
70
102
  ]
71
103
  },
@@ -75,7 +107,14 @@
75
107
  "compat": {
76
108
  "supportsUsageInStreaming": true,
77
109
  "supportsReasoningEffort": true,
78
- "supportedReasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"],
110
+ "supportedReasoningEfforts": [
111
+ "none",
112
+ "low",
113
+ "medium",
114
+ "high",
115
+ "xhigh",
116
+ "max"
117
+ ],
79
118
  "maxTokensField": "max_tokens",
80
119
  "codeMode": "capable"
81
120
  }
@@ -87,16 +126,31 @@
87
126
  "provider": "opencode",
88
127
  "baseUrl": "https://opencode.ai/zen/v1",
89
128
  "reasoning": true,
90
- "input": ["text", "image"],
91
- "cost": { "input": 0.05, "output": 0.4, "cacheRead": 0.005, "cacheWrite": 0 },
129
+ "input": [
130
+ "text",
131
+ "image"
132
+ ],
133
+ "cost": {
134
+ "input": 0.05,
135
+ "output": 0.4,
136
+ "cacheRead": 0.005,
137
+ "cacheWrite": 0
138
+ },
92
139
  "contextWindow": 400000,
93
140
  "contextTokens": 272000,
94
141
  "maxTokens": 128000,
95
- "thinkingLevelMap": { "off": null },
142
+ "thinkingLevelMap": {
143
+ "off": null
144
+ },
96
145
  "compat": {
97
146
  "supportsUsageInStreaming": true,
98
147
  "supportsReasoningEffort": true,
99
- "supportedReasoningEfforts": ["minimal", "low", "medium", "high"],
148
+ "supportedReasoningEfforts": [
149
+ "minimal",
150
+ "low",
151
+ "medium",
152
+ "high"
153
+ ],
100
154
  "maxTokensField": "max_tokens"
101
155
  }
102
156
  },
@@ -107,14 +161,28 @@
107
161
  "provider": "opencode",
108
162
  "baseUrl": "https://opencode.ai/zen/v1",
109
163
  "reasoning": true,
110
- "input": ["text", "image"],
111
- "cost": { "input": 1.5, "output": 7.5, "cacheRead": 0.15, "cacheWrite": 0 },
164
+ "input": [
165
+ "text",
166
+ "image"
167
+ ],
168
+ "cost": {
169
+ "input": 1.5,
170
+ "output": 7.5,
171
+ "cacheRead": 0.15,
172
+ "cacheWrite": 0
173
+ },
112
174
  "contextWindow": 1048576,
113
175
  "maxTokens": 65536,
114
176
  "compat": {
177
+ "codeMode": "capable",
115
178
  "supportsUsageInStreaming": true,
116
179
  "supportsReasoningEffort": true,
117
- "supportedReasoningEfforts": ["minimal", "low", "medium", "high"],
180
+ "supportedReasoningEfforts": [
181
+ "minimal",
182
+ "low",
183
+ "medium",
184
+ "high"
185
+ ],
118
186
  "maxTokensField": "max_tokens"
119
187
  }
120
188
  },
@@ -125,8 +193,16 @@
125
193
  "provider": "opencode",
126
194
  "baseUrl": "https://opencode.ai/zen/v1",
127
195
  "reasoning": true,
128
- "input": ["text", "image"],
129
- "cost": { "input": 0.3, "output": 1.2, "cacheRead": 0.06, "cacheWrite": 0 },
196
+ "input": [
197
+ "text",
198
+ "image"
199
+ ],
200
+ "cost": {
201
+ "input": 0.3,
202
+ "output": 1.2,
203
+ "cacheRead": 0.06,
204
+ "cacheWrite": 0
205
+ },
130
206
  "contextWindow": 512000,
131
207
  "maxTokens": 128000,
132
208
  "compat": {
@@ -143,14 +219,24 @@
143
219
  "provider": "opencode",
144
220
  "baseUrl": "https://opencode.ai/zen/v1",
145
221
  "reasoning": true,
146
- "input": ["text", "image"],
147
- "cost": { "input": 3, "output": 15, "cacheRead": 0.3, "cacheWrite": 0 },
222
+ "input": [
223
+ "text",
224
+ "image"
225
+ ],
226
+ "cost": {
227
+ "input": 3,
228
+ "output": 15,
229
+ "cacheRead": 0.3,
230
+ "cacheWrite": 0
231
+ },
148
232
  "contextWindow": 1048576,
149
233
  "maxTokens": 131072,
150
234
  "compat": {
151
235
  "supportsUsageInStreaming": true,
152
236
  "supportsReasoningEffort": true,
153
- "supportedReasoningEfforts": ["max"],
237
+ "supportedReasoningEfforts": [
238
+ "max"
239
+ ],
154
240
  "maxTokensField": "max_tokens",
155
241
  "supportsDeveloperRole": false,
156
242
  "supportsStrictMode": false,
@@ -164,8 +250,15 @@
164
250
  "provider": "opencode",
165
251
  "baseUrl": "https://opencode.ai/zen/v1",
166
252
  "reasoning": true,
167
- "input": ["text"],
168
- "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
253
+ "input": [
254
+ "text"
255
+ ],
256
+ "cost": {
257
+ "input": 0,
258
+ "output": 0,
259
+ "cacheRead": 0,
260
+ "cacheWrite": 0
261
+ },
169
262
  "contextWindow": 200000,
170
263
  "contextTokens": 160000,
171
264
  "maxTokens": 32000,
@@ -179,12 +272,28 @@
179
272
  ]
180
273
  }
181
274
  },
182
- "discovery": { "opencode": "runtime" }
275
+ "discovery": {
276
+ "opencode": "runtime"
277
+ }
278
+ },
279
+ "modelPricing": {
280
+ "providers": {
281
+ "opencode": {
282
+ "openCode": {
283
+ "provider": "opencode"
284
+ }
285
+ }
286
+ }
183
287
  },
184
- "modelPricing": { "providers": { "opencode": { "openCode": { "provider": "opencode" } } } },
185
288
  "setup": {
186
289
  "providers": [
187
- { "id": "opencode", "envVars": ["OPENCODE_API_KEY", "OPENCODE_ZEN_API_KEY"] }
290
+ {
291
+ "id": "opencode",
292
+ "envVars": [
293
+ "OPENCODE_API_KEY",
294
+ "OPENCODE_ZEN_API_KEY"
295
+ ]
296
+ }
188
297
  ]
189
298
  },
190
299
  "providerAuthChoices": [
@@ -203,11 +312,19 @@
203
312
  "cliDescription": "OpenCode API key (Zen catalog)"
204
313
  }
205
314
  ],
206
- "contracts": { "mediaUnderstandingProviders": ["opencode"] },
315
+ "contracts": {
316
+ "mediaUnderstandingProviders": [
317
+ "opencode"
318
+ ]
319
+ },
207
320
  "mediaUnderstandingProviderMetadata": {
208
321
  "opencode": {
209
- "capabilities": ["image"],
210
- "defaultModels": { "image": "gpt-5-nano" }
322
+ "capabilities": [
323
+ "image"
324
+ ],
325
+ "defaultModels": {
326
+ "image": "gpt-5-nano"
327
+ }
211
328
  }
212
329
  },
213
330
  "configSchema": {
@@ -218,7 +335,10 @@
218
335
  "type": "object",
219
336
  "additionalProperties": false,
220
337
  "properties": {
221
- "enabled": { "type": "boolean", "default": true }
338
+ "enabled": {
339
+ "type": "boolean",
340
+ "default": true
341
+ }
222
342
  }
223
343
  }
224
344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/opencode-provider",
3
- "version": "2026.9.1",
3
+ "version": "2026.9.3",
4
4
  "description": "OpenClaw OpenCode Zen provider plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.9.1"
21
+ "pluginApi": ">=2026.9.3"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.1",
24
+ "openclawVersion": "2026.9.3",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.9.1"
41
+ "openclaw": ">=2026.9.3"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {