@openclaw/opencode-provider 2026.8.1-beta.3 → 2026.8.2

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.
@@ -1,1218 +1,2 @@
1
- import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
2
- import { buildLiveModelProviderConfig, fetchLiveProviderModelIds } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
3
- //#region extensions/opencode/provider-catalog.ts
4
- const PROVIDER_ID = "opencode";
5
- const OPENCODE_ZEN_OPENAI_BASE_URL = "https://opencode.ai/zen/v1";
6
- const OPENCODE_ZEN_ANTHROPIC_BASE_URL = "https://opencode.ai/zen";
7
- const OPENCODE_ZEN_MODELS_ENDPOINT = "https://opencode.ai/zen/v1/models";
8
- const OPENCODE_ZEN_MODELS_TIMEOUT_MS = 5e3;
9
- const OPENCODE_ZEN_MODELS_CACHE_TTL_MS = 6e4;
10
- const FREE_COST = {
11
- input: 0,
12
- output: 0,
13
- cacheRead: 0,
14
- cacheWrite: 0
15
- };
16
- const T = ["text"];
17
- const TI = ["text", "image"];
18
- const E_LMHXM = [
19
- "low",
20
- "medium",
21
- "high",
22
- "xhigh",
23
- "max"
24
- ];
25
- const E_LMHM = [
26
- "low",
27
- "medium",
28
- "high",
29
- "max"
30
- ];
31
- const E_LMH = [
32
- "low",
33
- "medium",
34
- "high"
35
- ];
36
- const E_MIN_LMH = [
37
- "minimal",
38
- "low",
39
- "medium",
40
- "high"
41
- ];
42
- const E_NONE_LMHX = [
43
- "none",
44
- "low",
45
- "medium",
46
- "high",
47
- "xhigh"
48
- ];
49
- const E_MHX = [
50
- "medium",
51
- "high",
52
- "xhigh"
53
- ];
54
- const E_NONE_LMHXM = [
55
- "none",
56
- "low",
57
- "medium",
58
- "high",
59
- "xhigh",
60
- "max"
61
- ];
62
- const E_LMHX = [
63
- "low",
64
- "medium",
65
- "high",
66
- "xhigh"
67
- ];
68
- const E_NONE_LMH = [
69
- "none",
70
- "low",
71
- "medium",
72
- "high"
73
- ];
74
- const E_LOW_HIGH_MAX = [
75
- "low",
76
- "high",
77
- "max"
78
- ];
79
- const E_HIGH_MAX = ["high", "max"];
80
- const E_MAX = ["max"];
81
- const E_NONE_HIGH = ["none", "high"];
82
- const INPUT_128 = { contextTokens: 128e3 };
83
- const INPUT_160 = { contextTokens: 16e4 };
84
- const INPUT_272 = { contextTokens: 272e3 };
85
- const INPUT_922 = { contextTokens: 922e3 };
86
- const DEPRECATED = { status: "deprecated" };
87
- const INPUT_272_DEPRECATED = {
88
- contextTokens: 272e3,
89
- status: "deprecated"
90
- };
91
- const MODEL_CAPABILITY_ROWS = [
92
- [
93
- "claude-fable-5",
94
- 1e6,
95
- 128e3,
96
- TI,
97
- E_LMHXM
98
- ],
99
- [
100
- "claude-opus-5",
101
- 1e6,
102
- 128e3,
103
- TI,
104
- E_LMHXM
105
- ],
106
- [
107
- "claude-opus-4-8",
108
- 1e6,
109
- 128e3,
110
- TI,
111
- E_LMHXM,
112
- {
113
- status: "deprecated",
114
- replacedBy: "claude-opus-5"
115
- }
116
- ],
117
- [
118
- "claude-opus-4-7",
119
- 1e6,
120
- 128e3,
121
- TI,
122
- E_LMHXM
123
- ],
124
- [
125
- "claude-opus-4-6",
126
- 1e6,
127
- 128e3,
128
- TI,
129
- E_LMHM
130
- ],
131
- [
132
- "claude-opus-4-5",
133
- 2e5,
134
- 64e3,
135
- TI,
136
- E_LMH
137
- ],
138
- [
139
- "claude-sonnet-5",
140
- 1e6,
141
- 128e3,
142
- TI,
143
- E_LMHXM
144
- ],
145
- [
146
- "claude-sonnet-4-6",
147
- 1e6,
148
- 64e3,
149
- TI,
150
- E_LMHM
151
- ],
152
- [
153
- "claude-sonnet-4-5",
154
- 1e6,
155
- 64e3,
156
- TI
157
- ],
158
- [
159
- "claude-sonnet-4",
160
- 1e6,
161
- 64e3,
162
- TI,
163
- void 0,
164
- DEPRECATED
165
- ],
166
- [
167
- "claude-haiku-4-5",
168
- 2e5,
169
- 64e3,
170
- TI
171
- ],
172
- [
173
- "gemini-3.6-flash",
174
- 1048576,
175
- 65536,
176
- TI,
177
- E_MIN_LMH
178
- ],
179
- [
180
- "gemini-3.5-flash-lite",
181
- 1048576,
182
- 65536,
183
- TI,
184
- E_MIN_LMH
185
- ],
186
- [
187
- "gemini-3.5-flash",
188
- 1048576,
189
- 65536,
190
- TI,
191
- E_MIN_LMH
192
- ],
193
- [
194
- "gemini-3.1-pro",
195
- 1048576,
196
- 65536,
197
- TI,
198
- E_LMH
199
- ],
200
- [
201
- "gemini-3-flash",
202
- 1048576,
203
- 65536,
204
- TI,
205
- E_MIN_LMH
206
- ],
207
- [
208
- "gpt-5.6-sol",
209
- 105e4,
210
- 128e3,
211
- TI,
212
- E_NONE_LMHXM,
213
- INPUT_922
214
- ],
215
- [
216
- "gpt-5.6-terra",
217
- 105e4,
218
- 128e3,
219
- TI,
220
- E_NONE_LMHXM,
221
- INPUT_922
222
- ],
223
- [
224
- "gpt-5.6-luna",
225
- 105e4,
226
- 128e3,
227
- TI,
228
- E_NONE_LMHXM,
229
- INPUT_922
230
- ],
231
- [
232
- "gpt-5.5",
233
- 105e4,
234
- 128e3,
235
- TI,
236
- E_NONE_LMHX,
237
- {
238
- contextTokens: 922e3,
239
- status: "deprecated",
240
- replacedBy: "gpt-5.6-sol"
241
- }
242
- ],
243
- [
244
- "gpt-5.5-pro",
245
- 105e4,
246
- 128e3,
247
- TI,
248
- E_MHX,
249
- INPUT_922
250
- ],
251
- [
252
- "gpt-5.4",
253
- 105e4,
254
- 128e3,
255
- TI,
256
- E_NONE_LMHX,
257
- INPUT_922
258
- ],
259
- [
260
- "gpt-5.4-pro",
261
- 105e4,
262
- 128e3,
263
- TI,
264
- E_MHX,
265
- INPUT_922
266
- ],
267
- [
268
- "gpt-5.4-mini",
269
- 4e5,
270
- 128e3,
271
- TI,
272
- E_NONE_LMHX,
273
- INPUT_272
274
- ],
275
- [
276
- "gpt-5.4-nano",
277
- 4e5,
278
- 128e3,
279
- TI,
280
- E_NONE_LMHX,
281
- INPUT_272
282
- ],
283
- [
284
- "gpt-5.3-codex-spark",
285
- 128e3,
286
- 128e3,
287
- T,
288
- E_LMHX,
289
- INPUT_128
290
- ],
291
- [
292
- "gpt-5.3-codex",
293
- 4e5,
294
- 128e3,
295
- TI,
296
- E_NONE_LMHX,
297
- INPUT_272
298
- ],
299
- [
300
- "gpt-5.2",
301
- 4e5,
302
- 128e3,
303
- TI,
304
- E_NONE_LMHX,
305
- INPUT_272
306
- ],
307
- [
308
- "gpt-5.2-codex",
309
- 4e5,
310
- 128e3,
311
- TI,
312
- E_LMHX,
313
- INPUT_272_DEPRECATED
314
- ],
315
- [
316
- "gpt-5.1",
317
- 4e5,
318
- 128e3,
319
- TI,
320
- E_NONE_LMH,
321
- INPUT_272
322
- ],
323
- [
324
- "gpt-5.1-codex-max",
325
- 4e5,
326
- 128e3,
327
- TI,
328
- E_LMHX,
329
- INPUT_272_DEPRECATED
330
- ],
331
- [
332
- "gpt-5.1-codex",
333
- 4e5,
334
- 128e3,
335
- TI,
336
- E_LMH,
337
- INPUT_272_DEPRECATED
338
- ],
339
- [
340
- "gpt-5.1-codex-mini",
341
- 4e5,
342
- 128e3,
343
- TI,
344
- E_LMH,
345
- INPUT_272_DEPRECATED
346
- ],
347
- [
348
- "gpt-5",
349
- 4e5,
350
- 128e3,
351
- TI,
352
- E_MIN_LMH,
353
- INPUT_272
354
- ],
355
- [
356
- "gpt-5-codex",
357
- 4e5,
358
- 128e3,
359
- TI,
360
- E_LMH,
361
- INPUT_272_DEPRECATED
362
- ],
363
- [
364
- "gpt-5-nano",
365
- 4e5,
366
- 128e3,
367
- TI,
368
- E_MIN_LMH,
369
- INPUT_272
370
- ],
371
- [
372
- "grok-build-0.1",
373
- 256e3,
374
- 256e3,
375
- TI
376
- ],
377
- [
378
- "grok-4.5",
379
- 5e5,
380
- 5e5,
381
- TI,
382
- E_LMH
383
- ],
384
- [
385
- "deepseek-v4-pro",
386
- 1e6,
387
- 384e3,
388
- T,
389
- E_HIGH_MAX
390
- ],
391
- [
392
- "deepseek-v4-flash",
393
- 1e6,
394
- 384e3,
395
- T,
396
- E_LOW_HIGH_MAX
397
- ],
398
- [
399
- "glm-5.2",
400
- 1e6,
401
- 131072,
402
- T,
403
- E_HIGH_MAX
404
- ],
405
- [
406
- "glm-5.1",
407
- 204800,
408
- 131072,
409
- T
410
- ],
411
- [
412
- "glm-5",
413
- 204800,
414
- 131072,
415
- T,
416
- void 0,
417
- DEPRECATED
418
- ],
419
- [
420
- "minimax-m3",
421
- 512e3,
422
- 128e3,
423
- TI
424
- ],
425
- [
426
- "minimax-m2.7",
427
- 204800,
428
- 131072,
429
- T,
430
- void 0,
431
- {
432
- status: "deprecated",
433
- replacedBy: "minimax-m3"
434
- }
435
- ],
436
- [
437
- "minimax-m2.5",
438
- 204800,
439
- 131072,
440
- T,
441
- void 0,
442
- DEPRECATED
443
- ],
444
- [
445
- "kimi-k3",
446
- 1048576,
447
- 131072,
448
- TI,
449
- E_MAX
450
- ],
451
- [
452
- "kimi-k2.7-code",
453
- 262144,
454
- 262144,
455
- TI
456
- ],
457
- [
458
- "kimi-k2.6",
459
- 262144,
460
- 65536,
461
- TI
462
- ],
463
- [
464
- "kimi-k2.5",
465
- 262144,
466
- 65536,
467
- TI,
468
- void 0,
469
- DEPRECATED
470
- ],
471
- [
472
- "qwen3.6-plus",
473
- 262144,
474
- 65536,
475
- TI
476
- ],
477
- [
478
- "qwen3.5-plus",
479
- 262144,
480
- 65536,
481
- TI
482
- ],
483
- [
484
- "big-pickle",
485
- 2e5,
486
- 32e3,
487
- T,
488
- void 0,
489
- INPUT_160
490
- ],
491
- [
492
- "deepseek-v4-flash-free",
493
- 2e5,
494
- 128e3,
495
- T,
496
- E_LOW_HIGH_MAX
497
- ],
498
- [
499
- "mimo-v2.5-free",
500
- 2e5,
501
- 32e3,
502
- TI
503
- ],
504
- [
505
- "ling-3.0-flash-free",
506
- 262144,
507
- 32768,
508
- T,
509
- E_LMH,
510
- DEPRECATED
511
- ],
512
- [
513
- "ling-3.0-tiny-free",
514
- 262144,
515
- 32768,
516
- T
517
- ],
518
- [
519
- "nemotron-3-ultra-free",
520
- 1e6,
521
- 128e3,
522
- T
523
- ],
524
- [
525
- "north-mini-code-free",
526
- 256e3,
527
- 64e3,
528
- T,
529
- E_NONE_HIGH
530
- ],
531
- [
532
- "laguna-s-2.1-free",
533
- 256e3,
534
- 32e3,
535
- T,
536
- E_LMH
537
- ],
538
- [
539
- "longcat-2.0-free",
540
- 1e6,
541
- 131072,
542
- T
543
- ],
544
- [
545
- "claude-opus-4-1",
546
- 2e5,
547
- 32e3,
548
- TI,
549
- void 0,
550
- DEPRECATED
551
- ]
552
- ];
553
- const MODEL_CAPABILITIES = Object.fromEntries(MODEL_CAPABILITY_ROWS.map(([id, contextWindow, maxTokens, input, reasoningEfforts, metadata]) => [id, {
554
- contextWindow,
555
- maxTokens,
556
- input,
557
- ...reasoningEfforts ? { reasoningEfforts } : {},
558
- ...metadata
559
- }]));
560
- const MODEL_COSTS = {
561
- "big-pickle": FREE_COST,
562
- "claude-fable-5": {
563
- input: 10,
564
- output: 50,
565
- cacheRead: 1,
566
- cacheWrite: 12.5
567
- },
568
- "claude-haiku-4-5": {
569
- input: 1,
570
- output: 5,
571
- cacheRead: .1,
572
- cacheWrite: 1.25
573
- },
574
- "claude-opus-4-1": {
575
- input: 15,
576
- output: 75,
577
- cacheRead: 1.5,
578
- cacheWrite: 18.75
579
- },
580
- "claude-opus-4-5": {
581
- input: 5,
582
- output: 25,
583
- cacheRead: .5,
584
- cacheWrite: 6.25
585
- },
586
- "claude-opus-4-6": {
587
- input: 5,
588
- output: 25,
589
- cacheRead: .5,
590
- cacheWrite: 6.25
591
- },
592
- "claude-opus-4-7": {
593
- input: 5,
594
- output: 25,
595
- cacheRead: .5,
596
- cacheWrite: 6.25
597
- },
598
- "claude-opus-4-8": {
599
- input: 5,
600
- output: 25,
601
- cacheRead: .5,
602
- cacheWrite: 6.25
603
- },
604
- "claude-opus-5": {
605
- input: 5,
606
- output: 25,
607
- cacheRead: .5,
608
- cacheWrite: 6.25
609
- },
610
- "claude-sonnet-4": {
611
- input: 3,
612
- output: 15,
613
- cacheRead: .3,
614
- cacheWrite: 3.75,
615
- tieredPricing: [{
616
- input: 3,
617
- output: 15,
618
- cacheRead: .3,
619
- cacheWrite: 3.75,
620
- range: [0, 2e5]
621
- }, {
622
- input: 6,
623
- output: 22.5,
624
- cacheRead: .6,
625
- cacheWrite: 7.5,
626
- range: [2e5]
627
- }]
628
- },
629
- "claude-sonnet-4-5": {
630
- input: 3,
631
- output: 15,
632
- cacheRead: .3,
633
- cacheWrite: 3.75,
634
- tieredPricing: [{
635
- input: 3,
636
- output: 15,
637
- cacheRead: .3,
638
- cacheWrite: 3.75,
639
- range: [0, 2e5]
640
- }, {
641
- input: 6,
642
- output: 22.5,
643
- cacheRead: .6,
644
- cacheWrite: 7.5,
645
- range: [2e5]
646
- }]
647
- },
648
- "claude-sonnet-4-6": {
649
- input: 3,
650
- output: 15,
651
- cacheRead: .3,
652
- cacheWrite: 3.75
653
- },
654
- "claude-sonnet-5": {
655
- input: 2,
656
- output: 10,
657
- cacheRead: .2,
658
- cacheWrite: 2.5
659
- },
660
- "deepseek-v4-flash": {
661
- input: .14,
662
- output: .28,
663
- cacheRead: .028,
664
- cacheWrite: 0
665
- },
666
- "deepseek-v4-flash-free": FREE_COST,
667
- "deepseek-v4-pro": {
668
- input: 1.74,
669
- output: 3.48,
670
- cacheRead: .145,
671
- cacheWrite: 0
672
- },
673
- "gemini-3-flash": {
674
- input: .5,
675
- output: 3,
676
- cacheRead: .05,
677
- cacheWrite: 0
678
- },
679
- "gemini-3.1-pro": {
680
- input: 2,
681
- output: 12,
682
- cacheRead: .2,
683
- cacheWrite: 0,
684
- tieredPricing: [{
685
- input: 2,
686
- output: 12,
687
- cacheRead: .2,
688
- cacheWrite: 0,
689
- range: [0, 2e5]
690
- }, {
691
- input: 4,
692
- output: 18,
693
- cacheRead: .4,
694
- cacheWrite: 0,
695
- range: [2e5]
696
- }]
697
- },
698
- "gemini-3.5-flash": {
699
- input: 1.5,
700
- output: 9,
701
- cacheRead: .15,
702
- cacheWrite: 0
703
- },
704
- "gemini-3.5-flash-lite": {
705
- input: .3,
706
- output: 2.5,
707
- cacheRead: .03,
708
- cacheWrite: 0
709
- },
710
- "gemini-3.6-flash": {
711
- input: 1.5,
712
- output: 7.5,
713
- cacheRead: .15,
714
- cacheWrite: 0
715
- },
716
- "gpt-5.6-luna": {
717
- input: .2,
718
- output: 1.2,
719
- cacheRead: .02,
720
- cacheWrite: .25,
721
- tieredPricing: [{
722
- input: .2,
723
- output: 1.2,
724
- cacheRead: .02,
725
- cacheWrite: .25,
726
- range: [0, 272e3]
727
- }, {
728
- input: .4,
729
- output: 1.8,
730
- cacheRead: .04,
731
- cacheWrite: .5,
732
- range: [272e3]
733
- }]
734
- },
735
- "gpt-5.6-sol": {
736
- input: 5,
737
- output: 30,
738
- cacheRead: .5,
739
- cacheWrite: 6.25,
740
- tieredPricing: [{
741
- input: 5,
742
- output: 30,
743
- cacheRead: .5,
744
- cacheWrite: 6.25,
745
- range: [0, 272e3]
746
- }, {
747
- input: 10,
748
- output: 45,
749
- cacheRead: 1,
750
- cacheWrite: 12.5,
751
- range: [272e3]
752
- }]
753
- },
754
- "gpt-5.6-terra": {
755
- input: 2,
756
- output: 12,
757
- cacheRead: .2,
758
- cacheWrite: 2.5,
759
- tieredPricing: [{
760
- input: 2,
761
- output: 12,
762
- cacheRead: .2,
763
- cacheWrite: 2.5,
764
- range: [0, 272e3]
765
- }, {
766
- input: 4,
767
- output: 18,
768
- cacheRead: .4,
769
- cacheWrite: 5,
770
- range: [272e3]
771
- }]
772
- },
773
- "glm-5": {
774
- input: 1,
775
- output: 3.2,
776
- cacheRead: .2,
777
- cacheWrite: 0
778
- },
779
- "glm-5.1": {
780
- input: 1.4,
781
- output: 4.4,
782
- cacheRead: .26,
783
- cacheWrite: 0
784
- },
785
- "glm-5.2": {
786
- input: 1.4,
787
- output: 4.4,
788
- cacheRead: .26,
789
- cacheWrite: 0
790
- },
791
- "gpt-5": {
792
- input: 1.07,
793
- output: 8.5,
794
- cacheRead: .107,
795
- cacheWrite: 0
796
- },
797
- "gpt-5-codex": {
798
- input: 1.07,
799
- output: 8.5,
800
- cacheRead: .107,
801
- cacheWrite: 0
802
- },
803
- "gpt-5-nano": {
804
- input: .05,
805
- output: .4,
806
- cacheRead: .005,
807
- cacheWrite: 0
808
- },
809
- "gpt-5.1": {
810
- input: 1.07,
811
- output: 8.5,
812
- cacheRead: .107,
813
- cacheWrite: 0
814
- },
815
- "gpt-5.1-codex": {
816
- input: 1.07,
817
- output: 8.5,
818
- cacheRead: .107,
819
- cacheWrite: 0
820
- },
821
- "gpt-5.1-codex-max": {
822
- input: 1.25,
823
- output: 10,
824
- cacheRead: .125,
825
- cacheWrite: 0
826
- },
827
- "gpt-5.1-codex-mini": {
828
- input: .25,
829
- output: 2,
830
- cacheRead: .025,
831
- cacheWrite: 0
832
- },
833
- "gpt-5.2": {
834
- input: 1.75,
835
- output: 14,
836
- cacheRead: .175,
837
- cacheWrite: 0
838
- },
839
- "gpt-5.2-codex": {
840
- input: 1.75,
841
- output: 14,
842
- cacheRead: .175,
843
- cacheWrite: 0
844
- },
845
- "gpt-5.3-codex": {
846
- input: 1.75,
847
- output: 14,
848
- cacheRead: .175,
849
- cacheWrite: 0
850
- },
851
- "gpt-5.3-codex-spark": {
852
- input: 1.75,
853
- output: 14,
854
- cacheRead: .175,
855
- cacheWrite: 0
856
- },
857
- "gpt-5.4": {
858
- input: 2.5,
859
- output: 15,
860
- cacheRead: .25,
861
- cacheWrite: 0,
862
- tieredPricing: [{
863
- input: 2.5,
864
- output: 15,
865
- cacheRead: .25,
866
- cacheWrite: 0,
867
- range: [0, 272e3]
868
- }, {
869
- input: 5,
870
- output: 22.5,
871
- cacheRead: .5,
872
- cacheWrite: 0,
873
- range: [272e3]
874
- }]
875
- },
876
- "gpt-5.4-mini": {
877
- input: .75,
878
- output: 4.5,
879
- cacheRead: .075,
880
- cacheWrite: 0
881
- },
882
- "gpt-5.4-nano": {
883
- input: .2,
884
- output: 1.25,
885
- cacheRead: .02,
886
- cacheWrite: 0
887
- },
888
- "gpt-5.4-pro": {
889
- input: 30,
890
- output: 180,
891
- cacheRead: 30,
892
- cacheWrite: 0
893
- },
894
- "gpt-5.5": {
895
- input: 5,
896
- output: 30,
897
- cacheRead: .5,
898
- cacheWrite: 0,
899
- tieredPricing: [{
900
- input: 5,
901
- output: 30,
902
- cacheRead: .5,
903
- cacheWrite: 0,
904
- range: [0, 272e3]
905
- }, {
906
- input: 10,
907
- output: 45,
908
- cacheRead: 1,
909
- cacheWrite: 0,
910
- range: [272e3]
911
- }]
912
- },
913
- "gpt-5.5-pro": {
914
- input: 30,
915
- output: 180,
916
- cacheRead: 30,
917
- cacheWrite: 0
918
- },
919
- "grok-build-0.1": {
920
- input: 1,
921
- output: 2,
922
- cacheRead: .2,
923
- cacheWrite: 0
924
- },
925
- "grok-4.5": {
926
- input: 2,
927
- output: 6,
928
- cacheRead: .3,
929
- cacheWrite: 0,
930
- tieredPricing: [{
931
- input: 2,
932
- output: 6,
933
- cacheRead: .3,
934
- cacheWrite: 0,
935
- range: [0, 2e5]
936
- }, {
937
- input: 4,
938
- output: 12,
939
- cacheRead: .6,
940
- cacheWrite: 0,
941
- range: [2e5]
942
- }]
943
- },
944
- "kimi-k2.5": {
945
- input: .6,
946
- output: 3,
947
- cacheRead: .1,
948
- cacheWrite: 0
949
- },
950
- "kimi-k2.6": {
951
- input: .95,
952
- output: 4,
953
- cacheRead: .16,
954
- cacheWrite: 0
955
- },
956
- "kimi-k2.7-code": {
957
- input: .95,
958
- output: 4,
959
- cacheRead: .19,
960
- cacheWrite: 0
961
- },
962
- "kimi-k3": {
963
- input: 3,
964
- output: 15,
965
- cacheRead: .3,
966
- cacheWrite: 0
967
- },
968
- "laguna-s-2.1-free": FREE_COST,
969
- "ling-3.0-flash-free": FREE_COST,
970
- "ling-3.0-tiny-free": FREE_COST,
971
- "longcat-2.0-free": FREE_COST,
972
- "mimo-v2.5-free": FREE_COST,
973
- "minimax-m2.5": {
974
- input: .3,
975
- output: 1.2,
976
- cacheRead: .06,
977
- cacheWrite: 0
978
- },
979
- "minimax-m2.7": {
980
- input: .3,
981
- output: 1.2,
982
- cacheRead: .06,
983
- cacheWrite: 0
984
- },
985
- "minimax-m3": {
986
- input: .3,
987
- output: 1.2,
988
- cacheRead: .06,
989
- cacheWrite: 0
990
- },
991
- "nemotron-3-ultra-free": FREE_COST,
992
- "north-mini-code-free": FREE_COST,
993
- "qwen3.5-plus": {
994
- input: .2,
995
- output: 1.2,
996
- cacheRead: .02,
997
- cacheWrite: .25
998
- },
999
- "qwen3.6-plus": {
1000
- input: .5,
1001
- output: 3,
1002
- cacheRead: .05,
1003
- cacheWrite: .625
1004
- }
1005
- };
1006
- const MODEL_NAMES = {
1007
- "big-pickle": "Big Pickle",
1008
- "claude-fable-5": "Claude Fable 5",
1009
- "claude-haiku-4-5": "Claude Haiku 4.5",
1010
- "claude-opus-4-1": "Claude Opus 4.1",
1011
- "claude-opus-4-5": "Claude Opus 4.5",
1012
- "claude-opus-4-6": "Claude Opus 4.6",
1013
- "claude-opus-4-7": "Claude Opus 4.7",
1014
- "claude-opus-4-8": "Claude Opus 4.8",
1015
- "claude-opus-5": "Claude Opus 5",
1016
- "claude-sonnet-4": "Claude Sonnet 4",
1017
- "claude-sonnet-4-5": "Claude Sonnet 4.5",
1018
- "claude-sonnet-4-6": "Claude Sonnet 4.6",
1019
- "claude-sonnet-5": "Claude Sonnet 5",
1020
- "deepseek-v4-flash": "DeepSeek V4 Flash",
1021
- "deepseek-v4-flash-free": "DeepSeek V4 Flash Free",
1022
- "deepseek-v4-pro": "DeepSeek V4 Pro",
1023
- "gemini-3-flash": "Gemini 3 Flash",
1024
- "gemini-3.1-pro": "Gemini 3.1 Pro Preview",
1025
- "gemini-3.5-flash": "Gemini 3.5 Flash",
1026
- "gemini-3.5-flash-lite": "Gemini 3.5 Flash Lite",
1027
- "gemini-3.6-flash": "Gemini 3.6 Flash",
1028
- "gpt-5.6-luna": "GPT-5.6 Luna",
1029
- "gpt-5.6-sol": "GPT-5.6 Sol",
1030
- "gpt-5.6-terra": "GPT-5.6 Terra",
1031
- "glm-5": "GLM-5",
1032
- "glm-5.1": "GLM-5.1",
1033
- "glm-5.2": "GLM-5.2",
1034
- "gpt-5": "GPT-5",
1035
- "gpt-5-codex": "GPT-5 Codex",
1036
- "gpt-5-nano": "GPT-5 Nano",
1037
- "gpt-5.1": "GPT-5.1",
1038
- "gpt-5.1-codex": "GPT-5.1 Codex",
1039
- "gpt-5.1-codex-max": "GPT-5.1 Codex Max",
1040
- "gpt-5.1-codex-mini": "GPT-5.1 Codex Mini",
1041
- "gpt-5.2": "GPT-5.2",
1042
- "gpt-5.2-codex": "GPT-5.2 Codex",
1043
- "gpt-5.3-codex": "GPT-5.3 Codex",
1044
- "gpt-5.3-codex-spark": "GPT-5.3 Codex Spark",
1045
- "gpt-5.4": "GPT-5.4",
1046
- "gpt-5.4-mini": "GPT-5.4 Mini",
1047
- "gpt-5.4-nano": "GPT-5.4 Nano",
1048
- "gpt-5.4-pro": "GPT-5.4 Pro",
1049
- "gpt-5.5": "GPT-5.5",
1050
- "gpt-5.5-pro": "GPT-5.5 Pro",
1051
- "grok-build-0.1": "Grok Build 0.1",
1052
- "grok-4.5": "Grok 4.5",
1053
- "kimi-k2.5": "Kimi K2.5",
1054
- "kimi-k2.6": "Kimi K2.6",
1055
- "kimi-k2.7-code": "Kimi K2.7 Code",
1056
- "kimi-k3": "Kimi K3",
1057
- "laguna-s-2.1-free": "Laguna S 2.1 Free",
1058
- "ling-3.0-flash-free": "Ling-3.0-flash Free",
1059
- "ling-3.0-tiny-free": "Ling-3.0-tiny Free",
1060
- "longcat-2.0-free": "LongCat-2.0 Free",
1061
- "mimo-v2.5-free": "MiMo V2.5 Free",
1062
- "minimax-m2.5": "MiniMax M2.5",
1063
- "minimax-m2.7": "MiniMax M2.7",
1064
- "minimax-m3": "MiniMax M3",
1065
- "nemotron-3-ultra-free": "Nemotron 3 Ultra Free",
1066
- "north-mini-code-free": "North Mini Code Free",
1067
- "qwen3.5-plus": "Qwen3.5 Plus",
1068
- "qwen3.6-plus": "Qwen3.6 Plus"
1069
- };
1070
- function resolveOpencodeZenTransport(modelId) {
1071
- const lower = modelId.toLowerCase();
1072
- if (lower.startsWith("gpt-") || lower.startsWith("grok-")) return {
1073
- api: "openai-responses",
1074
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
1075
- };
1076
- if (lower.startsWith("claude-") || lower.startsWith("qwen")) return {
1077
- api: "anthropic-messages",
1078
- baseUrl: OPENCODE_ZEN_ANTHROPIC_BASE_URL
1079
- };
1080
- if (lower.startsWith("gemini-")) return {
1081
- api: "google-generative-ai",
1082
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
1083
- };
1084
- return {
1085
- api: "openai-completions",
1086
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
1087
- };
1088
- }
1089
- function buildOpencodeZenModel(modelId) {
1090
- const capabilities = MODEL_CAPABILITIES[modelId];
1091
- if (!capabilities) throw new Error(`missing OpenCode Zen capability metadata for ${modelId}`);
1092
- const transport = resolveOpencodeZenTransport(modelId);
1093
- return normalizeModelCompat({
1094
- id: modelId,
1095
- name: MODEL_NAMES[modelId],
1096
- api: transport.api,
1097
- provider: PROVIDER_ID,
1098
- baseUrl: transport.baseUrl,
1099
- reasoning: true,
1100
- input: [...capabilities.input],
1101
- cost: MODEL_COSTS[modelId],
1102
- contextWindow: capabilities.contextWindow,
1103
- ...capabilities.contextTokens ? { contextTokens: capabilities.contextTokens } : {},
1104
- maxTokens: capabilities.maxTokens,
1105
- ...transport.api === "openai-responses" && !capabilities.reasoningEfforts?.includes("none") ? { thinkingLevelMap: { off: null } } : {},
1106
- compat: {
1107
- supportsUsageInStreaming: true,
1108
- ...capabilities.reasoningEfforts ? {
1109
- supportsReasoningEffort: true,
1110
- supportedReasoningEfforts: [...capabilities.reasoningEfforts]
1111
- } : {},
1112
- maxTokensField: "max_tokens",
1113
- ...transport.api === "openai-completions" ? {
1114
- supportsDeveloperRole: false,
1115
- supportsStrictMode: false
1116
- } : {}
1117
- }
1118
- });
1119
- }
1120
- const OPENCODE_ZEN_RESOLVABLE_MODELS = MODEL_CAPABILITY_ROWS.map(([modelId]) => buildOpencodeZenModel(modelId));
1121
- const OPENCODE_ZEN_MODELS = OPENCODE_ZEN_RESOLVABLE_MODELS.filter((model) => MODEL_CAPABILITIES[model.id]?.status !== "deprecated");
1122
- const OPENCODE_ZEN_MODEL_BY_ID = new Map(OPENCODE_ZEN_RESOLVABLE_MODELS.map((model) => [model.id, model]));
1123
- function buildStaticOpencodeZenProviderConfig(apiKey) {
1124
- return {
1125
- api: "openai-completions",
1126
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL,
1127
- ...apiKey ? { apiKey } : {},
1128
- models: OPENCODE_ZEN_MODELS
1129
- };
1130
- }
1131
- async function resolveOpencodeZenStarterModel(params) {
1132
- const liveModelIds = await fetchLiveProviderModelIds({
1133
- providerId: PROVIDER_ID,
1134
- endpoint: OPENCODE_ZEN_MODELS_ENDPOINT,
1135
- discoveryApiKey: params.apiKey,
1136
- fetchGuard: params.fetchGuard,
1137
- signal: params.signal,
1138
- timeoutMs: OPENCODE_ZEN_MODELS_TIMEOUT_MS,
1139
- auditContext: "opencode-zen-onboarding-model-discovery"
1140
- });
1141
- const preferredModelId = params.preferredModelRef.replace(`${PROVIDER_ID}/`, "");
1142
- return liveModelIds.includes(preferredModelId) ? params.preferredModelRef : void 0;
1143
- }
1144
- function readLiveModelId(row) {
1145
- if (!row || typeof row !== "object" || Array.isArray(row)) return;
1146
- const candidate = row;
1147
- if (candidate.object !== void 0 && candidate.object !== "model") return;
1148
- if (typeof candidate.id !== "string") return;
1149
- return candidate.id.trim().toLowerCase() || void 0;
1150
- }
1151
- function projectOpencodeZenLiveModels(rows) {
1152
- const staticModels = new Map(OPENCODE_ZEN_MODELS.map((model) => [model.id, model]));
1153
- const seen = /* @__PURE__ */ new Set();
1154
- const models = [];
1155
- for (const row of rows) {
1156
- const modelId = readLiveModelId(row);
1157
- if (!modelId || seen.has(modelId)) continue;
1158
- seen.add(modelId);
1159
- const model = staticModels.get(modelId);
1160
- if (model) models.push(model);
1161
- }
1162
- return models;
1163
- }
1164
- async function buildOpencodeZenLiveProviderConfig(params = {}) {
1165
- return await buildLiveModelProviderConfig({
1166
- providerId: PROVIDER_ID,
1167
- endpoint: OPENCODE_ZEN_MODELS_ENDPOINT,
1168
- providerConfig: {
1169
- api: "openai-completions",
1170
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
1171
- },
1172
- models: OPENCODE_ZEN_MODELS,
1173
- apiKey: params.apiKey,
1174
- discoveryApiKey: params.discoveryApiKey,
1175
- fetchGuard: params.fetchGuard,
1176
- signal: params.signal,
1177
- timeoutMs: OPENCODE_ZEN_MODELS_TIMEOUT_MS,
1178
- ttlMs: OPENCODE_ZEN_MODELS_CACHE_TTL_MS,
1179
- auditContext: "opencode-zen-model-discovery",
1180
- projectRows: projectOpencodeZenLiveModels
1181
- });
1182
- }
1183
- function listOpencodeZenModelCatalogEntries() {
1184
- return OPENCODE_ZEN_RESOLVABLE_MODELS.map((model) => {
1185
- const lifecycle = MODEL_CAPABILITIES[model.id];
1186
- const entry = {
1187
- provider: model.provider,
1188
- id: model.id,
1189
- name: model.name,
1190
- api: model.api,
1191
- baseUrl: model.baseUrl,
1192
- reasoning: model.reasoning,
1193
- input: model.input,
1194
- contextWindow: model.contextWindow,
1195
- contextTokens: model.contextTokens,
1196
- compat: model.compat
1197
- };
1198
- if (lifecycle?.status) entry.status = lifecycle.status;
1199
- if (lifecycle?.replacedBy) entry.replacedBy = lifecycle.replacedBy;
1200
- return entry;
1201
- });
1202
- }
1203
- function resolveOpencodeZenModel(modelId) {
1204
- const normalizedModelId = modelId.trim().toLowerCase();
1205
- return OPENCODE_ZEN_MODEL_BY_ID.get(normalizedModelId);
1206
- }
1207
- function normalizeBaseUrl(baseUrl) {
1208
- return (baseUrl ?? "").trim().replace(/\/+$/, "");
1209
- }
1210
- function normalizeOpencodeZenBaseUrl(params) {
1211
- const normalized = normalizeBaseUrl(params.baseUrl);
1212
- if (!normalized) return;
1213
- const isAnthropicRoute = params.api === "anthropic-messages";
1214
- if (normalized === OPENCODE_ZEN_ANTHROPIC_BASE_URL) return isAnthropicRoute ? OPENCODE_ZEN_ANTHROPIC_BASE_URL : OPENCODE_ZEN_OPENAI_BASE_URL;
1215
- if (normalized === OPENCODE_ZEN_OPENAI_BASE_URL) return isAnthropicRoute ? OPENCODE_ZEN_ANTHROPIC_BASE_URL : OPENCODE_ZEN_OPENAI_BASE_URL;
1216
- }
1217
- //#endregion
1218
- export { buildOpencodeZenLiveProviderConfig, buildStaticOpencodeZenProviderConfig, listOpencodeZenModelCatalogEntries, normalizeOpencodeZenBaseUrl, resolveOpencodeZenModel, resolveOpencodeZenStarterModel };
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-Dq-y_lMN.js";
2
+ export { buildOpencodeZenLiveProviderConfig, buildStaticOpencodeZenProviderConfig, listOpencodeZenModelCatalogEntries, normalizeOpencodeZenBaseUrl, prepareOpencodeZenModel, resolveOpencodeZenModel, resolveOpencodeZenStarterModel };