@openclaw/opencode-provider 2026.8.1-beta.2 → 2026.9.1-beta.1

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,6 +1,6 @@
1
1
  import { opencodeMediaUnderstandingProvider } from "./media-understanding-provider.js";
2
2
  import { OPENCODE_ZEN_DEFAULT_MODEL_REF, applyOpencodeZenProviderConfig } from "./onboard.js";
3
- import { buildOpencodeZenLiveProviderConfig, buildStaticOpencodeZenProviderConfig, listOpencodeZenModelCatalogEntries, normalizeOpencodeZenBaseUrl, resolveOpencodeZenModel, resolveOpencodeZenStarterModel } from "./provider-catalog.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-Dak_lvHJ.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";
@@ -8,629 +8,6 @@ import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-en
8
8
  import { buildProviderReplayFamilyHooks, matchesExactOrPrefix } from "openclaw/plugin-sdk/provider-model-shared";
9
9
  import { createOpenAICompatibleCompletionsThinkingOffWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
10
10
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
11
- //#region extensions/opencode/openclaw.plugin.json
12
- var openclaw_plugin_default = {
13
- id: "opencode",
14
- icon: "https://cdn.simpleicons.org/opencode",
15
- doctorContract: { "configRepair": true },
16
- activation: { "onStartup": true },
17
- providerCatalogEntry: "./provider-discovery.ts",
18
- enabledByDefault: true,
19
- providers: ["opencode"],
20
- providerEndpoints: [{
21
- "endpointClass": "opencode-native",
22
- "hostSuffixes": ["opencode.ai"]
23
- }],
24
- providerRequest: { "providers": { "opencode": { "family": "opencode" } } },
25
- modelCatalog: {
26
- "providers": { "opencode": {
27
- "baseUrl": "https://opencode.ai/zen/v1",
28
- "api": "openai-completions",
29
- "models": [
30
- {
31
- "id": "claude-opus-5",
32
- "name": "Claude Opus 5",
33
- "api": "anthropic-messages",
34
- "provider": "opencode",
35
- "baseUrl": "https://opencode.ai/zen",
36
- "reasoning": true,
37
- "input": ["text", "image"],
38
- "cost": {
39
- "input": 5,
40
- "output": 25,
41
- "cacheRead": .5,
42
- "cacheWrite": 6.25
43
- },
44
- "contextWindow": 1e6,
45
- "maxTokens": 128e3,
46
- "compat": {
47
- "supportsUsageInStreaming": true,
48
- "supportsReasoningEffort": true,
49
- "supportedReasoningEfforts": [
50
- "low",
51
- "medium",
52
- "high",
53
- "xhigh",
54
- "max"
55
- ],
56
- "maxTokensField": "max_tokens",
57
- "codeMode": "capable"
58
- }
59
- },
60
- {
61
- "id": "claude-opus-4-8",
62
- "name": "Claude Opus 4.8",
63
- "api": "anthropic-messages",
64
- "provider": "opencode",
65
- "baseUrl": "https://opencode.ai/zen",
66
- "reasoning": true,
67
- "input": ["text", "image"],
68
- "cost": {
69
- "input": 5,
70
- "output": 25,
71
- "cacheRead": .5,
72
- "cacheWrite": 6.25
73
- },
74
- "contextWindow": 1e6,
75
- "maxTokens": 128e3,
76
- "compat": {
77
- "supportsUsageInStreaming": true,
78
- "supportsReasoningEffort": true,
79
- "supportedReasoningEfforts": [
80
- "low",
81
- "medium",
82
- "high",
83
- "xhigh",
84
- "max"
85
- ],
86
- "maxTokensField": "max_tokens",
87
- "codeMode": "capable"
88
- },
89
- "status": "deprecated",
90
- "replacedBy": "claude-opus-5"
91
- },
92
- {
93
- "id": "claude-sonnet-4",
94
- "name": "Claude Sonnet 4",
95
- "api": "anthropic-messages",
96
- "provider": "opencode",
97
- "baseUrl": "https://opencode.ai/zen",
98
- "reasoning": true,
99
- "input": ["text", "image"],
100
- "cost": {
101
- "input": 3,
102
- "output": 15,
103
- "cacheRead": .3,
104
- "cacheWrite": 3.75,
105
- "tieredPricing": [{
106
- "input": 3,
107
- "output": 15,
108
- "cacheRead": .3,
109
- "cacheWrite": 3.75,
110
- "range": [0, 2e5]
111
- }, {
112
- "input": 6,
113
- "output": 22.5,
114
- "cacheRead": .6,
115
- "cacheWrite": 7.5,
116
- "range": [2e5]
117
- }]
118
- },
119
- "contextWindow": 1e6,
120
- "maxTokens": 64e3,
121
- "compat": {
122
- "supportsUsageInStreaming": true,
123
- "maxTokensField": "max_tokens"
124
- },
125
- "status": "deprecated"
126
- },
127
- {
128
- "id": "gpt-5.6-sol",
129
- "name": "GPT-5.6 Sol",
130
- "api": "openai-responses",
131
- "provider": "opencode",
132
- "baseUrl": "https://opencode.ai/zen/v1",
133
- "reasoning": true,
134
- "input": ["text", "image"],
135
- "cost": {
136
- "input": 5,
137
- "output": 30,
138
- "cacheRead": .5,
139
- "cacheWrite": 6.25,
140
- "tieredPricing": [{
141
- "input": 5,
142
- "output": 30,
143
- "cacheRead": .5,
144
- "cacheWrite": 6.25,
145
- "range": [0, 272e3]
146
- }, {
147
- "input": 10,
148
- "output": 45,
149
- "cacheRead": 1,
150
- "cacheWrite": 12.5,
151
- "range": [272e3]
152
- }]
153
- },
154
- "contextWindow": 105e4,
155
- "contextTokens": 922e3,
156
- "maxTokens": 128e3,
157
- "compat": {
158
- "supportsUsageInStreaming": true,
159
- "supportsReasoningEffort": true,
160
- "supportedReasoningEfforts": [
161
- "none",
162
- "low",
163
- "medium",
164
- "high",
165
- "xhigh",
166
- "max"
167
- ],
168
- "maxTokensField": "max_tokens",
169
- "codeMode": "capable"
170
- }
171
- },
172
- {
173
- "id": "gpt-5.5",
174
- "name": "GPT-5.5",
175
- "api": "openai-responses",
176
- "provider": "opencode",
177
- "baseUrl": "https://opencode.ai/zen/v1",
178
- "reasoning": true,
179
- "input": ["text", "image"],
180
- "cost": {
181
- "input": 5,
182
- "output": 30,
183
- "cacheRead": .5,
184
- "cacheWrite": 0,
185
- "tieredPricing": [{
186
- "input": 5,
187
- "output": 30,
188
- "cacheRead": .5,
189
- "cacheWrite": 0,
190
- "range": [0, 272e3]
191
- }, {
192
- "input": 10,
193
- "output": 45,
194
- "cacheRead": 1,
195
- "cacheWrite": 0,
196
- "range": [272e3]
197
- }]
198
- },
199
- "contextWindow": 105e4,
200
- "contextTokens": 922e3,
201
- "maxTokens": 128e3,
202
- "compat": {
203
- "supportsUsageInStreaming": true,
204
- "supportsReasoningEffort": true,
205
- "supportedReasoningEfforts": [
206
- "none",
207
- "low",
208
- "medium",
209
- "high",
210
- "xhigh"
211
- ],
212
- "maxTokensField": "max_tokens",
213
- "codeMode": "capable"
214
- },
215
- "status": "deprecated",
216
- "replacedBy": "gpt-5.6-sol"
217
- },
218
- {
219
- "id": "gemini-3.6-flash",
220
- "name": "Gemini 3.6 Flash",
221
- "api": "google-generative-ai",
222
- "provider": "opencode",
223
- "baseUrl": "https://opencode.ai/zen/v1",
224
- "reasoning": true,
225
- "input": ["text", "image"],
226
- "cost": {
227
- "input": 1.5,
228
- "output": 7.5,
229
- "cacheRead": .15,
230
- "cacheWrite": 0
231
- },
232
- "contextWindow": 1048576,
233
- "maxTokens": 65536,
234
- "compat": {
235
- "supportsUsageInStreaming": true,
236
- "supportsReasoningEffort": true,
237
- "supportedReasoningEfforts": [
238
- "minimal",
239
- "low",
240
- "medium",
241
- "high"
242
- ],
243
- "maxTokensField": "max_tokens"
244
- }
245
- },
246
- {
247
- "id": "gemini-3.1-pro",
248
- "name": "Gemini 3.1 Pro Preview",
249
- "api": "google-generative-ai",
250
- "provider": "opencode",
251
- "baseUrl": "https://opencode.ai/zen/v1",
252
- "reasoning": true,
253
- "input": ["text", "image"],
254
- "cost": {
255
- "input": 2,
256
- "output": 12,
257
- "cacheRead": .2,
258
- "cacheWrite": 0,
259
- "tieredPricing": [{
260
- "input": 2,
261
- "output": 12,
262
- "cacheRead": .2,
263
- "cacheWrite": 0,
264
- "range": [0, 2e5]
265
- }, {
266
- "input": 4,
267
- "output": 18,
268
- "cacheRead": .4,
269
- "cacheWrite": 0,
270
- "range": [2e5]
271
- }]
272
- },
273
- "contextWindow": 1048576,
274
- "maxTokens": 65536,
275
- "compat": {
276
- "supportsUsageInStreaming": true,
277
- "supportsReasoningEffort": true,
278
- "supportedReasoningEfforts": [
279
- "low",
280
- "medium",
281
- "high"
282
- ],
283
- "maxTokensField": "max_tokens"
284
- }
285
- },
286
- {
287
- "id": "minimax-m3",
288
- "name": "MiniMax M3",
289
- "api": "openai-completions",
290
- "provider": "opencode",
291
- "baseUrl": "https://opencode.ai/zen/v1",
292
- "reasoning": true,
293
- "input": ["text", "image"],
294
- "cost": {
295
- "input": .3,
296
- "output": 1.2,
297
- "cacheRead": .06,
298
- "cacheWrite": 0
299
- },
300
- "contextWindow": 512e3,
301
- "maxTokens": 128e3,
302
- "compat": {
303
- "supportsUsageInStreaming": true,
304
- "maxTokensField": "max_tokens",
305
- "supportsDeveloperRole": false,
306
- "supportsStrictMode": false
307
- }
308
- },
309
- {
310
- "id": "minimax-m2.7",
311
- "name": "MiniMax M2.7",
312
- "api": "openai-completions",
313
- "provider": "opencode",
314
- "baseUrl": "https://opencode.ai/zen/v1",
315
- "reasoning": true,
316
- "input": ["text"],
317
- "cost": {
318
- "input": .3,
319
- "output": 1.2,
320
- "cacheRead": .06,
321
- "cacheWrite": 0
322
- },
323
- "contextWindow": 204800,
324
- "maxTokens": 131072,
325
- "compat": {
326
- "supportsUsageInStreaming": true,
327
- "maxTokensField": "max_tokens",
328
- "supportsDeveloperRole": false,
329
- "supportsStrictMode": false
330
- },
331
- "status": "deprecated",
332
- "replacedBy": "minimax-m3"
333
- },
334
- {
335
- "id": "kimi-k3",
336
- "name": "Kimi K3",
337
- "api": "openai-completions",
338
- "provider": "opencode",
339
- "baseUrl": "https://opencode.ai/zen/v1",
340
- "reasoning": true,
341
- "input": ["text", "image"],
342
- "cost": {
343
- "input": 3,
344
- "output": 15,
345
- "cacheRead": .3,
346
- "cacheWrite": 0
347
- },
348
- "contextWindow": 1048576,
349
- "maxTokens": 131072,
350
- "compat": {
351
- "supportsUsageInStreaming": true,
352
- "supportsReasoningEffort": true,
353
- "supportedReasoningEfforts": ["max"],
354
- "maxTokensField": "max_tokens",
355
- "supportsDeveloperRole": false,
356
- "supportsStrictMode": false,
357
- "codeMode": "capable"
358
- }
359
- },
360
- {
361
- "id": "big-pickle",
362
- "name": "Big Pickle",
363
- "api": "openai-completions",
364
- "provider": "opencode",
365
- "baseUrl": "https://opencode.ai/zen/v1",
366
- "reasoning": true,
367
- "input": ["text"],
368
- "cost": {
369
- "input": 0,
370
- "output": 0,
371
- "cacheRead": 0,
372
- "cacheWrite": 0
373
- },
374
- "contextWindow": 2e5,
375
- "contextTokens": 16e4,
376
- "maxTokens": 32e3,
377
- "compat": {
378
- "supportsUsageInStreaming": true,
379
- "maxTokensField": "max_tokens",
380
- "supportsDeveloperRole": false,
381
- "supportsStrictMode": false
382
- }
383
- },
384
- {
385
- "id": "deepseek-v4-flash-free",
386
- "name": "DeepSeek V4 Flash Free",
387
- "api": "openai-completions",
388
- "provider": "opencode",
389
- "baseUrl": "https://opencode.ai/zen/v1",
390
- "reasoning": true,
391
- "input": ["text"],
392
- "cost": {
393
- "input": 0,
394
- "output": 0,
395
- "cacheRead": 0,
396
- "cacheWrite": 0
397
- },
398
- "contextWindow": 2e5,
399
- "maxTokens": 128e3,
400
- "compat": {
401
- "supportsUsageInStreaming": true,
402
- "supportsReasoningEffort": true,
403
- "supportedReasoningEfforts": [
404
- "low",
405
- "high",
406
- "max"
407
- ],
408
- "maxTokensField": "max_tokens",
409
- "supportsDeveloperRole": false,
410
- "supportsStrictMode": false
411
- }
412
- },
413
- {
414
- "id": "mimo-v2.5-free",
415
- "name": "MiMo V2.5 Free",
416
- "api": "openai-completions",
417
- "provider": "opencode",
418
- "baseUrl": "https://opencode.ai/zen/v1",
419
- "reasoning": true,
420
- "input": ["text", "image"],
421
- "cost": {
422
- "input": 0,
423
- "output": 0,
424
- "cacheRead": 0,
425
- "cacheWrite": 0
426
- },
427
- "contextWindow": 2e5,
428
- "maxTokens": 32e3,
429
- "compat": {
430
- "supportsUsageInStreaming": true,
431
- "maxTokensField": "max_tokens",
432
- "supportsDeveloperRole": false,
433
- "supportsStrictMode": false
434
- }
435
- },
436
- {
437
- "id": "laguna-s-2.1-free",
438
- "name": "Laguna S 2.1 Free",
439
- "api": "openai-completions",
440
- "provider": "opencode",
441
- "baseUrl": "https://opencode.ai/zen/v1",
442
- "reasoning": true,
443
- "input": ["text"],
444
- "cost": {
445
- "input": 0,
446
- "output": 0,
447
- "cacheRead": 0,
448
- "cacheWrite": 0
449
- },
450
- "contextWindow": 256e3,
451
- "maxTokens": 32e3,
452
- "compat": {
453
- "supportsUsageInStreaming": true,
454
- "supportsReasoningEffort": true,
455
- "supportedReasoningEfforts": [
456
- "low",
457
- "medium",
458
- "high"
459
- ],
460
- "maxTokensField": "max_tokens",
461
- "supportsDeveloperRole": false,
462
- "supportsStrictMode": false
463
- }
464
- },
465
- {
466
- "id": "ling-3.0-flash-free",
467
- "name": "Ling-3.0-flash Free",
468
- "api": "openai-completions",
469
- "provider": "opencode",
470
- "baseUrl": "https://opencode.ai/zen/v1",
471
- "reasoning": true,
472
- "input": ["text"],
473
- "cost": {
474
- "input": 0,
475
- "output": 0,
476
- "cacheRead": 0,
477
- "cacheWrite": 0
478
- },
479
- "contextWindow": 262144,
480
- "maxTokens": 32768,
481
- "compat": {
482
- "supportsUsageInStreaming": true,
483
- "supportsReasoningEffort": true,
484
- "supportedReasoningEfforts": [
485
- "low",
486
- "medium",
487
- "high"
488
- ],
489
- "maxTokensField": "max_tokens",
490
- "supportsDeveloperRole": false,
491
- "supportsStrictMode": false
492
- },
493
- "status": "deprecated"
494
- },
495
- {
496
- "id": "nemotron-3-ultra-free",
497
- "name": "Nemotron 3 Ultra Free",
498
- "api": "openai-completions",
499
- "provider": "opencode",
500
- "baseUrl": "https://opencode.ai/zen/v1",
501
- "reasoning": true,
502
- "input": ["text"],
503
- "cost": {
504
- "input": 0,
505
- "output": 0,
506
- "cacheRead": 0,
507
- "cacheWrite": 0
508
- },
509
- "contextWindow": 1e6,
510
- "maxTokens": 128e3,
511
- "compat": {
512
- "supportsUsageInStreaming": true,
513
- "maxTokensField": "max_tokens",
514
- "supportsDeveloperRole": false,
515
- "supportsStrictMode": false
516
- }
517
- },
518
- {
519
- "id": "north-mini-code-free",
520
- "name": "North Mini Code Free",
521
- "api": "openai-completions",
522
- "provider": "opencode",
523
- "baseUrl": "https://opencode.ai/zen/v1",
524
- "reasoning": true,
525
- "input": ["text"],
526
- "cost": {
527
- "input": 0,
528
- "output": 0,
529
- "cacheRead": 0,
530
- "cacheWrite": 0
531
- },
532
- "contextWindow": 256e3,
533
- "maxTokens": 64e3,
534
- "compat": {
535
- "supportsUsageInStreaming": true,
536
- "supportsReasoningEffort": true,
537
- "supportedReasoningEfforts": ["none", "high"],
538
- "maxTokensField": "max_tokens",
539
- "supportsDeveloperRole": false,
540
- "supportsStrictMode": false
541
- }
542
- },
543
- {
544
- "id": "ling-3.0-tiny-free",
545
- "name": "Ling-3.0-tiny Free",
546
- "api": "openai-completions",
547
- "provider": "opencode",
548
- "baseUrl": "https://opencode.ai/zen/v1",
549
- "reasoning": true,
550
- "input": ["text"],
551
- "cost": {
552
- "input": 0,
553
- "output": 0,
554
- "cacheRead": 0,
555
- "cacheWrite": 0
556
- },
557
- "contextWindow": 262144,
558
- "maxTokens": 32768,
559
- "compat": {
560
- "supportsUsageInStreaming": true,
561
- "maxTokensField": "max_tokens",
562
- "supportsDeveloperRole": false,
563
- "supportsStrictMode": false
564
- }
565
- },
566
- {
567
- "id": "longcat-2.0-free",
568
- "name": "LongCat-2.0 Free",
569
- "api": "openai-completions",
570
- "provider": "opencode",
571
- "baseUrl": "https://opencode.ai/zen/v1",
572
- "reasoning": true,
573
- "input": ["text"],
574
- "cost": {
575
- "input": 0,
576
- "output": 0,
577
- "cacheRead": 0,
578
- "cacheWrite": 0
579
- },
580
- "contextWindow": 1e6,
581
- "maxTokens": 131072,
582
- "compat": {
583
- "supportsUsageInStreaming": true,
584
- "maxTokensField": "max_tokens",
585
- "supportsDeveloperRole": false,
586
- "supportsStrictMode": false
587
- }
588
- }
589
- ]
590
- } },
591
- "discovery": { "opencode": "runtime" }
592
- },
593
- setup: { "providers": [{
594
- "id": "opencode",
595
- "envVars": ["OPENCODE_API_KEY", "OPENCODE_ZEN_API_KEY"]
596
- }] },
597
- providerAuthChoices: [{
598
- "provider": "opencode",
599
- "method": "api-key",
600
- "choiceId": "opencode-zen",
601
- "appGuidedSecret": true,
602
- "choiceLabel": "OpenCode Zen catalog",
603
- "groupId": "opencode",
604
- "groupLabel": "OpenCode",
605
- "groupHint": "Shared API key infrastructure for Zen + Go",
606
- "optionKey": "opencodeZenApiKey",
607
- "cliFlag": "--opencode-zen-api-key",
608
- "cliOption": "--opencode-zen-api-key <key>",
609
- "cliDescription": "OpenCode API key (Zen catalog)"
610
- }],
611
- contracts: { "mediaUnderstandingProviders": ["opencode"] },
612
- mediaUnderstandingProviderMetadata: { "opencode": {
613
- "capabilities": ["image"],
614
- "defaultModels": { "image": "gpt-5-nano" }
615
- } },
616
- configSchema: {
617
- "type": "object",
618
- "additionalProperties": false,
619
- "properties": { "sessionCatalog": {
620
- "type": "object",
621
- "additionalProperties": false,
622
- "properties": { "enabled": {
623
- "type": "boolean",
624
- "default": true
625
- } }
626
- } }
627
- },
628
- uiHints: { "sessionCatalog.enabled": {
629
- "label": "OpenCode Session Catalog",
630
- "help": "Auto-detect OpenCode sessions on the Gateway and paired nodes, then show them in the sessions sidebar."
631
- } }
632
- };
633
- //#endregion
634
11
  //#region extensions/opencode/index.ts
635
12
  const PROVIDER_ID = "opencode";
636
13
  const MINIMAX_MODERN_MODEL_MATCHERS = ["minimax-m2.7"];
@@ -705,9 +82,15 @@ var opencode_default = defineSingleProviderPluginEntry({
705
82
  } : void 0;
706
83
  },
707
84
  resolveDynamicModel: ({ modelId }) => resolveOpencodeZenModel(modelId),
85
+ prepareDynamicModel: async (ctx) => {
86
+ const profileProvider = ctx.authProfileId ? ctx.config?.auth?.profiles?.[ctx.authProfileId]?.provider : void 0;
87
+ const ownsProfile = Boolean(ctx.authProfileId && (ctx.authProfileId.startsWith("opencode:") || ctx.authProfileId.startsWith("opencode-go:") || profileProvider === "opencode" || profileProvider === "opencode-go"));
88
+ return Boolean(ownsProfile || ctx.providerConfig || ctx.config?.models?.providers?.opencode || ctx.config?.models?.providers?.["opencode-go"] || process.env.OPENCODE_API_KEY?.trim() || process.env.OPENCODE_ZEN_API_KEY?.trim()) ? await prepareOpencodeZenModel({ modelId: ctx.modelId }) : void 0;
89
+ },
708
90
  catalog: {
709
91
  order: "simple",
710
92
  run: async (ctx) => {
93
+ if (ctx.providerIds !== void 0 && !ctx.providerIds.includes(PROVIDER_ID)) return null;
711
94
  const auth = resolveOpencodeZenCatalogAuth(ctx.resolveProviderApiKey);
712
95
  if (!auth) return null;
713
96
  if (!auth.discoveryApiKey) return { provider: buildStaticOpencodeZenProviderConfig(auth.apiKey) };