opencode-statboard 2.10.18 → 2.10.19
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/package.json +1 -1
- package/pricing.js +92 -18
package/package.json
CHANGED
package/pricing.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
// -contributor-free) or duplicated provider prefix -> kind 'sibling'
|
|
10
10
|
// 3. same base name under provider 'opencode' -> kind 'proxy'
|
|
11
11
|
// 4. same base name anywhere else (cheapest nonzero) -> kind 'proxy'
|
|
12
|
-
// 5.
|
|
12
|
+
// 5. manual FREE_MODEL_MAPPING for free models without automatic match
|
|
13
|
+
// 6. nothing in the catalog -> null (NOT priced;
|
|
13
14
|
// inventing a number here is how a $0 model turned into $212 of fake
|
|
14
15
|
// savings). Callers must show '—' and can disclose the unpriced rows.
|
|
15
16
|
//
|
|
@@ -19,6 +20,83 @@
|
|
|
19
20
|
const fs = require('fs');
|
|
20
21
|
const path = require('path');
|
|
21
22
|
|
|
23
|
+
const stripFree = (m) => String(m).replace(/-contributor-free$/, '').replace(/-free$/, '').replace(/:free$/, '');
|
|
24
|
+
|
|
25
|
+
// Manual paid-model mapping for free opencode models that have no automatic
|
|
26
|
+
// sibling/proxy match. Key: free model name (with or without provider prefix),
|
|
27
|
+
// value: paid model full name (provider/model from cache).
|
|
28
|
+
const FREE_MODEL_MAPPING = {
|
|
29
|
+
'opencode/space-bunny-free': 'pioneer/mistralai/Mistral-7B-Instruct-v0.3',
|
|
30
|
+
'opencode/beam-free': 'openrouter/xiaomi/mimo-v2.5',
|
|
31
|
+
'opencode/fledge-alpha-free': 'pioneer/mistralai/Mistral-7B-Instruct-v0.3',
|
|
32
|
+
'opencode/grok-code': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
33
|
+
'opencode/laguna-s-2.1-free': 'nano-gpt/poolside/laguna-s-2.1',
|
|
34
|
+
'opencode/x-preview-f-free': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
35
|
+
'opencode/nemotron-3.5-lightning-free': 'nano-gpt/nvidia/nemotron-3.5-lightning',
|
|
36
|
+
'opencode/big-pickle': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
37
|
+
'opencode/ling-3.0-flash-fin-free': 'empiriolabs/qwen3-8-flash',
|
|
38
|
+
'opencode/mimo-v2.5-free': 'openrouter/xiaomi/mimo-v2.5',
|
|
39
|
+
'opencode/nemotron-3-super-free': 'openrouter/nvidia/nemotron-3-super-120b-a12b',
|
|
40
|
+
'opencode/nemotron-3-ultra-free': 'openrouter/nvidia/nemotron-3-ultra-550b-a55b',
|
|
41
|
+
'opencode/glm-4.7-free': 'openrouter/z-ai/glm-4.7',
|
|
42
|
+
'opencode/glm-5-free': 'openrouter/z-ai/glm-5',
|
|
43
|
+
'opencode/mimo-v2-flash-free': 'openrouter/xiaomi/mimo-v2-flash',
|
|
44
|
+
'opencode/qwen3.6-plus-free': 'nano-gpt/qwen/qwen3.6-plus',
|
|
45
|
+
'opencode/mimo-v2-omni-free': 'openrouter/xiaomi/mimo-v2-omni',
|
|
46
|
+
'opencode/mimo-v2-pro-free': 'openrouter/xiaomi/mimo-v2-pro',
|
|
47
|
+
'opencode/ling-3.0-tiny-free': 'empiriolabs/qwen3-8-flash',
|
|
48
|
+
'opencode/trinity-large-preview-free': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
49
|
+
'opencode/nemotron-3.5-super-vl-free': 'openrouter/nvidia/nemotron-3.5-super-vl',
|
|
50
|
+
'opencode/ling-2.6-flash-free': 'empiriolabs/qwen3-8-flash',
|
|
51
|
+
'opencode/minimax-m2.5-free': 'openrouter/minimax/minimax-m2.5',
|
|
52
|
+
'opencode/minimax-m3-free': 'openrouter/minimax/minimax-m3',
|
|
53
|
+
'opencode/muse-spark-1.2-contributor-free': 'nano-gpt/meta/muse-spark-1.2',
|
|
54
|
+
'opencode/muse-spark-1.3-contributor-free': 'bothub/muse-spark-1.3-contributor',
|
|
55
|
+
'opencode/deepseek-v4-flash-free': 'openrouter/deepseek/deepseek-v4-flash',
|
|
56
|
+
'opencode/deepseek-v4.1-flash-free': 'openrouter/deepseek/deepseek-v4.1-flash',
|
|
57
|
+
'opencode/hy3-free': 'openrouter/tencent/hy3',
|
|
58
|
+
'opencode/glm-5.3-flash-free': 'openrouter/z-ai/glm-5.3-flash',
|
|
59
|
+
'opencode/nemotron-3.5-super-vl-free': 'openrouter/nvidia/nemotron-3.5-super-vl',
|
|
60
|
+
'opencode/beam-free': 'openrouter/xiaomi/mimo-v2.5',
|
|
61
|
+
'opencode/space-bunny-free': 'pioneer/mistralai/Mistral-7B-Instruct-v0.3',
|
|
62
|
+
'opencode/fledge-alpha-free': 'pioneer/mistralai/Mistral-7B-Instruct-v0.3',
|
|
63
|
+
'opencode/big-pickle': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
64
|
+
'opencode/grok-code': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
65
|
+
'opencode/x-preview-f-free': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
66
|
+
'opencode/nemotron-3.5-lightning-free': 'nano-gpt/nvidia/nemotron-3.5-lightning',
|
|
67
|
+
'opencode/big-pickle': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
68
|
+
'opencode/ling-3.0-flash-fin-free': 'empiriolabs/qwen3-8-flash',
|
|
69
|
+
'opencode/ling-3.0-tiny-free': 'empiriolabs/qwen3-8-flash',
|
|
70
|
+
'opencode/ling-2.6-flash-free': 'empiriolabs/qwen3-8-flash',
|
|
71
|
+
'opencode/trinity-large-preview-free': 'vercel/spacexai/grok-4.1-fast-reasoning',
|
|
72
|
+
'opencode/mimo-v2.5-free': 'openrouter/xiaomi/mimo-v2.5',
|
|
73
|
+
'opencode/mimo-v2-flash-free': 'openrouter/xiaomi/mimo-v2-flash',
|
|
74
|
+
'opencode/mimo-v2-omni-free': 'openrouter/xiaomi/mimo-v2-omni',
|
|
75
|
+
'opencode/mimo-v2-pro-free': 'openrouter/xiaomi/mimo-v2-pro',
|
|
76
|
+
'opencode/qwen3.6-plus-free': 'nano-gpt/qwen/qwen3.6-plus',
|
|
77
|
+
'opencode/glm-4.7-free': 'openrouter/z-ai/glm-4.7',
|
|
78
|
+
'opencode/glm-5-free': 'openrouter/z-ai/glm-5',
|
|
79
|
+
'opencode/hy3-free': 'openrouter/tencent/hy3',
|
|
80
|
+
'opencode/glm-5.3-flash-free': 'openrouter/z-ai/glm-5.3-flash',
|
|
81
|
+
'opencode/minimax-m2.5-free': 'openrouter/minimax/minimax-m2.5',
|
|
82
|
+
'opencode/minimax-m3-free': 'openrouter/minimax/minimax-m3',
|
|
83
|
+
'opencode/muse-spark-1.2-contributor-free': 'nano-gpt/meta/muse-spark-1.2',
|
|
84
|
+
'opencode/muse-spark-1.3-contributor-free': 'bothub/muse-spark-1.3-contributor',
|
|
85
|
+
'opencode/deepseek-v4-flash-free': 'openrouter/deepseek/deepseek-v4-flash',
|
|
86
|
+
'opencode/deepseek-v4.1-flash-free': 'openrouter/deepseek/deepseek-v4.1-flash',
|
|
87
|
+
'opencode/hy3-free': 'openrouter/tencent/hy3',
|
|
88
|
+
'opencode/glm-5.3-flash-free': 'openrouter/z-ai/glm-5.3-flash',
|
|
89
|
+
'opencode/nemotron-3.5-super-vl-free': 'openrouter/nvidia/nemotron-3.5-super-vl',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
function getFreeModelMapping(provider, model) {
|
|
93
|
+
const key = `${provider}/${model}`;
|
|
94
|
+
const mapped = FREE_MODEL_MAPPING[key] || FREE_MODEL_MAPPING[model];
|
|
95
|
+
if (!mapped) return null;
|
|
96
|
+
const [mp, ...mm] = mapped.split('/');
|
|
97
|
+
return { provider: mp, model: mm.join('/') };
|
|
98
|
+
}
|
|
99
|
+
|
|
22
100
|
function catalogCandidates() {
|
|
23
101
|
const homes = [process.env.USERPROFILE, process.env.HOME].filter(Boolean);
|
|
24
102
|
const out = [];
|
|
@@ -52,18 +130,14 @@ function entry(data, provider, model) {
|
|
|
52
130
|
return nonzero(c) ? { input: c.input || 0, output: c.output || 0, cacheRead: c.cache_read || 0 } : null;
|
|
53
131
|
}
|
|
54
132
|
|
|
55
|
-
const stripFree = (m) => String(m).replace(/-contributor-free$/, '').replace(/-free$/, '').replace(/:free$/, '');
|
|
56
|
-
|
|
57
133
|
// Map a usage model (provider/model as recorded in the DB) to paid rates.
|
|
58
|
-
// Returns { input, output, cacheRead, source, kind } or null when the catalog
|
|
59
|
-
// has no comparable paid listing at all.
|
|
60
134
|
function priceFor(provider, model) {
|
|
61
135
|
const cat = loadCatalog();
|
|
62
136
|
if (!cat.data) return null;
|
|
63
137
|
const data = cat.data;
|
|
64
138
|
provider = provider || 'unknown';
|
|
65
139
|
model = model || 'unknown';
|
|
66
|
-
if (model === 'unknown') return null;
|
|
140
|
+
if (model === 'unknown') return null;
|
|
67
141
|
|
|
68
142
|
const mk = (p, m, kind) => {
|
|
69
143
|
const r = entry(data, p, m);
|
|
@@ -73,10 +147,7 @@ function priceFor(provider, model) {
|
|
|
73
147
|
let r = mk(provider, model, 'exact');
|
|
74
148
|
if (r) return r;
|
|
75
149
|
|
|
76
|
-
// Free suffixes
|
|
77
|
-
// (opencode records nvidia/nvidia/nemotron-... on some sessions). The plain
|
|
78
|
-
// base is always kept: a model that is free at ITS provider (cost 0) may
|
|
79
|
-
// still have a paid listing elsewhere (e.g. nvidia/z-ai/glm-5.3-flash).
|
|
150
|
+
// Free suffixes
|
|
80
151
|
const bases = [];
|
|
81
152
|
const deDup = model.startsWith(`${provider}/`) ? model.slice(provider.length + 1) : null;
|
|
82
153
|
for (const b of [stripFree(model), deDup && stripFree(deDup), deDup, model]) {
|
|
@@ -91,21 +162,16 @@ function priceFor(provider, model) {
|
|
|
91
162
|
r = mk('opencode', b, 'proxy');
|
|
92
163
|
if (r) return r;
|
|
93
164
|
}
|
|
94
|
-
|
|
95
|
-
//
|
|
96
|
-
// Also try the full model name (with provider prefix) as a base, since cache keys may include provider prefix.
|
|
165
|
+
|
|
166
|
+
// Any provider, cheapest nonzero listing for the same base name
|
|
97
167
|
const allBases = [...bases];
|
|
98
|
-
if (model !== bases[0] && !allBases.includes(model)) allBases.push(model);
|
|
99
|
-
// Also try provider/model as a base (for cases where model name doesn't include provider prefix but cache key does)
|
|
168
|
+
if (model !== bases[0] && !allBases.includes(model)) allBases.push(model);
|
|
100
169
|
const providerModel = `${provider}/${model}`;
|
|
101
170
|
if (!allBases.includes(providerModel)) allBases.push(providerModel);
|
|
102
|
-
// Also try openrouter/ + model (common case where sub-providers like reflection are under openrouter)
|
|
103
171
|
const openrouterModel = `openrouter/${model}`;
|
|
104
172
|
if (!allBases.includes(openrouterModel)) allBases.push(openrouterModel);
|
|
105
|
-
// Also try openrouter/provider/model (for cases where cache has openrouter/subprovider/model)
|
|
106
173
|
const openrouterProviderModel = `openrouter/${provider}/${model}`;
|
|
107
174
|
if (!allBases.includes(openrouterProviderModel)) allBases.push(openrouterProviderModel);
|
|
108
|
-
// Also try openrouter + common sub-providers (reflection, nvidia, etc.) for openrouter models without sub-provider prefix
|
|
109
175
|
if (provider === 'openrouter' && !model.includes('/')) {
|
|
110
176
|
const subProviders = ['reflection', 'nvidia', 'google', 'anthropic', 'meta', 'mistral', 'cohere', 'mistralai'];
|
|
111
177
|
for (const sub of subProviders) {
|
|
@@ -129,6 +195,14 @@ function priceFor(provider, model) {
|
|
|
129
195
|
return { ...rates, source: `${pid}/${b}`, kind: 'proxy' };
|
|
130
196
|
}
|
|
131
197
|
}
|
|
198
|
+
|
|
199
|
+
// Check manual free model mapping before final null return
|
|
200
|
+
const freeMapping = getFreeModelMapping(provider, model);
|
|
201
|
+
if (freeMapping) {
|
|
202
|
+
const r2 = mk(freeMapping.provider, freeMapping.model, 'proxy');
|
|
203
|
+
if (r2) return r2;
|
|
204
|
+
}
|
|
205
|
+
|
|
132
206
|
return null;
|
|
133
207
|
}
|
|
134
208
|
|