@leo000001/opencode-quota-sidebar 3.0.0 → 3.0.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/CONTRIBUTING.md +4 -1
  3. package/README.md +210 -514
  4. package/README.zh-CN.md +337 -0
  5. package/SECURITY.md +2 -2
  6. package/assets/OpenCode-Quota-Sidebar.png +0 -0
  7. package/dist/cost.d.ts +3 -3
  8. package/dist/cost.js +258 -169
  9. package/dist/format.d.ts +4 -0
  10. package/dist/format.js +24 -10
  11. package/dist/providers/common.d.ts +6 -0
  12. package/dist/providers/common.js +32 -12
  13. package/dist/providers/core/anthropic.d.ts +1 -1
  14. package/dist/providers/core/anthropic.js +43 -39
  15. package/dist/providers/core/kimi_for_coding.d.ts +1 -1
  16. package/dist/providers/core/kimi_for_coding.js +44 -64
  17. package/dist/providers/core/minimax_cn_coding_plan.d.ts +2 -0
  18. package/dist/providers/core/minimax_cn_coding_plan.js +214 -0
  19. package/dist/providers/core/zhipu_coding_plan.d.ts +1 -1
  20. package/dist/providers/core/zhipu_coding_plan.js +41 -61
  21. package/dist/providers/index.d.ts +3 -3
  22. package/dist/providers/index.js +5 -5
  23. package/dist/providers/third_party/rightcode.d.ts +1 -1
  24. package/dist/providers/third_party/rightcode.js +41 -61
  25. package/dist/providers/third_party/xyai.d.ts +2 -0
  26. package/dist/providers/third_party/{xyai_vibe.js → xyai.js} +113 -79
  27. package/dist/quota.d.ts +2 -2
  28. package/dist/quota.js +24 -18
  29. package/dist/quota_render.d.ts +1 -1
  30. package/dist/quota_render.js +23 -17
  31. package/dist/storage_parse.js +1 -0
  32. package/dist/title.js +7 -7
  33. package/dist/title_apply.js +18 -1
  34. package/dist/tui.tsx +133 -36
  35. package/dist/tui_helpers.d.ts +16 -0
  36. package/dist/tui_helpers.js +146 -0
  37. package/dist/types.d.ts +2 -0
  38. package/package.json +9 -2
  39. package/quota-sidebar.config.example.json +45 -45
  40. package/dist/providers/third_party/buzz.d.ts +0 -2
  41. package/dist/providers/third_party/buzz.js +0 -156
  42. package/dist/providers/third_party/xyai_vibe.d.ts +0 -2
package/dist/cost.js CHANGED
@@ -1,22 +1,23 @@
1
- import { asNumber, isRecord } from './helpers.js';
1
+ import { asNumber, isRecord } from "./helpers.js";
2
2
  export const API_COST_ENABLED_PROVIDERS = new Set([
3
- 'openai',
4
- 'anthropic',
5
- 'kimi-for-coding',
6
- 'zhipu',
3
+ "openai",
4
+ "anthropic",
5
+ "kimi-for-coding",
6
+ "zhipu",
7
+ "minimax-cn-coding-plan",
7
8
  ]);
8
9
  const MODEL_COST_RATE_ALIASES = {
9
- 'zhipuai-coding-plan:glm-5.1': ['zhipu:glm-5'],
10
- 'zhipuai-coding-plan:glm-5.1-thinking': ['zhipu:glm-5'],
11
- 'zhipu:glm-5.1': ['zhipu:glm-5'],
12
- 'zhipu:glm-5.1-thinking': ['zhipu:glm-5'],
10
+ "zhipuai-coding-plan:glm-5.1": ["zhipu:glm-5"],
11
+ "zhipuai-coding-plan:glm-5.1-thinking": ["zhipu:glm-5"],
12
+ "zhipu:glm-5.1": ["zhipu:glm-5"],
13
+ "zhipu:glm-5.1-thinking": ["zhipu:glm-5"],
13
14
  };
14
15
  function moonshotCanonicalModelID(modelID) {
15
- const stripped = modelID.replace(/^moonshotai[/:]/i, '');
16
+ const stripped = modelID.replace(/^moonshotai[/:]/i, "");
16
17
  switch (stripped) {
17
- case 'k2p5':
18
- case 'kimi-k2-5':
19
- return 'kimi-k2.5';
18
+ case "k2p5":
19
+ case "kimi-k2-5":
20
+ return "kimi-k2.5";
20
21
  default:
21
22
  return stripped;
22
23
  }
@@ -29,7 +30,7 @@ function moonshotModelAliases(modelID, options) {
29
30
  if (!aliases.includes(value))
30
31
  aliases.push(value);
31
32
  };
32
- const stripped = modelID.replace(/^moonshotai[/:]/i, '');
33
+ const stripped = modelID.replace(/^moonshotai[/:]/i, "");
33
34
  const canonical = moonshotCanonicalModelID(modelID);
34
35
  if (!options?.canonicalProviderKeys)
35
36
  push(modelID);
@@ -38,6 +39,30 @@ function moonshotModelAliases(modelID, options) {
38
39
  push(canonical);
39
40
  return aliases;
40
41
  }
42
+ function minimaxModelAliases(modelID) {
43
+ const aliases = [];
44
+ const push = (value) => {
45
+ if (!value)
46
+ return;
47
+ if (!aliases.includes(value))
48
+ aliases.push(value);
49
+ };
50
+ push(modelID);
51
+ push(modelID.toLowerCase());
52
+ const stripped = modelID.replace(/^(?:minimax|minimax-cn-coding-plan)[/:]/i, "");
53
+ push(stripped);
54
+ push(stripped.toLowerCase());
55
+ if (/^minimax-/i.test(stripped)) {
56
+ const suffix = stripped.slice("minimax-".length);
57
+ push(`MiniMax-${suffix}`);
58
+ push(`minimax-${suffix.toLowerCase()}`);
59
+ }
60
+ if (/^m2(?:[.-]\d+)?(?:-highspeed)?$/i.test(stripped)) {
61
+ push(`MiniMax-${stripped}`);
62
+ push(`minimax-${stripped.toLowerCase()}`);
63
+ }
64
+ return aliases;
65
+ }
41
66
  function zhipuModelAliases(modelID) {
42
67
  const aliases = [];
43
68
  const queue = [];
@@ -52,19 +77,19 @@ function zhipuModelAliases(modelID) {
52
77
  push(modelID);
53
78
  for (let index = 0; index < queue.length; index++) {
54
79
  const stem = queue[index];
55
- const withoutProviderPrefix = stem.replace(/^(?:zhipu|z-ai|bigmodel|zhipuai-coding-plan)[/:]/, '');
80
+ const withoutProviderPrefix = stem.replace(/^(?:zhipu|z-ai|bigmodel|zhipuai-coding-plan)[/:]/, "");
56
81
  push(withoutProviderPrefix);
57
82
  push(`zhipu/${withoutProviderPrefix}`);
58
- const withoutBillingSuffix = withoutProviderPrefix.replace(/-billing$/, '');
83
+ const withoutBillingSuffix = withoutProviderPrefix.replace(/-billing$/, "");
59
84
  push(withoutBillingSuffix);
60
85
  push(`zhipu/${withoutBillingSuffix}`);
61
- const withoutThinkingSuffix = withoutBillingSuffix.replace(/-thinking$/, '');
86
+ const withoutThinkingSuffix = withoutBillingSuffix.replace(/-thinking$/, "");
62
87
  push(withoutThinkingSuffix);
63
88
  push(`zhipu/${withoutThinkingSuffix}`);
64
- const dotted = withoutThinkingSuffix.replace(/(\d)-(\d)(?=-|$)/g, '$1.$2');
89
+ const dotted = withoutThinkingSuffix.replace(/(\d)-(\d)(?=-|$)/g, "$1.$2");
65
90
  push(dotted);
66
91
  push(`zhipu/${dotted}`);
67
- const hyphenated = withoutThinkingSuffix.replace(/(\d)\.(\d)(?=-|$)/g, '$1-$2');
92
+ const hyphenated = withoutThinkingSuffix.replace(/(\d)\.(\d)(?=-|$)/g, "$1-$2");
68
93
  push(hyphenated);
69
94
  push(`zhipu/${hyphenated}`);
70
95
  }
@@ -85,81 +110,89 @@ function anthropicModelAliases(modelID) {
85
110
  for (let index = 0; index < queue.length; index++) {
86
111
  const stem = queue[index];
87
112
  const withoutProviderPrefix = stem
88
- .replace(/^(?:[a-z]+\.)*anthropic\./, '')
89
- .replace(/^anthropic[/.]/, '');
113
+ .replace(/^(?:[a-z]+\.)*anthropic\./, "")
114
+ .replace(/^anthropic[/.]/, "");
90
115
  push(withoutProviderPrefix);
91
116
  push(`anthropic/${withoutProviderPrefix}`);
92
- const withoutVersionSuffix = withoutProviderPrefix.replace(/-v\d+(?::\d+)?$/, '');
117
+ const withoutVersionSuffix = withoutProviderPrefix.replace(/-v\d+(?::\d+)?$/, "");
93
118
  push(withoutVersionSuffix);
94
119
  push(`anthropic/${withoutVersionSuffix}`);
95
- const atDate = withoutVersionSuffix.replace(/@(\d{8})$/, '-$1');
120
+ const atDate = withoutVersionSuffix.replace(/@(\d{8})$/, "-$1");
96
121
  push(atDate);
97
122
  push(`anthropic/${atDate}`);
98
- const withAtDate = withoutVersionSuffix.replace(/-(\d{8})$/, '@$1');
123
+ const withAtDate = withoutVersionSuffix.replace(/-(\d{8})$/, "@$1");
99
124
  push(withAtDate);
100
125
  push(`anthropic/${withAtDate}`);
101
- const withoutThinkingSuffix = withoutVersionSuffix.replace(/-thinking$/, '');
126
+ const withoutThinkingSuffix = withoutVersionSuffix.replace(/-thinking$/, "");
102
127
  push(withoutThinkingSuffix);
103
128
  push(`anthropic/${withoutThinkingSuffix}`);
104
- const withoutLatestSuffix = withoutThinkingSuffix.replace(/-latest$/, '');
129
+ const withoutLatestSuffix = withoutThinkingSuffix.replace(/-latest$/, "");
105
130
  push(withoutLatestSuffix);
106
131
  push(`anthropic/${withoutLatestSuffix}`);
107
132
  const withoutDateSuffix = withoutLatestSuffix
108
- .replace(/-\d{8}$/, '')
109
- .replace(/@\d{8}$/, '');
133
+ .replace(/-\d{8}$/, "")
134
+ .replace(/@\d{8}$/, "");
110
135
  push(withoutDateSuffix);
111
136
  push(`anthropic/${withoutDateSuffix}`);
112
- const dotted = withoutDateSuffix.replace(/(\d)-(\d)(?=-|$)/g, '$1.$2');
137
+ const dotted = withoutDateSuffix.replace(/(\d)-(\d)(?=-|$)/g, "$1.$2");
113
138
  push(dotted);
114
139
  push(`anthropic/${dotted}`);
115
- const hyphenated = withoutDateSuffix.replace(/(\d)\.(\d)(?=-|$)/g, '$1-$2');
140
+ const hyphenated = withoutDateSuffix.replace(/(\d)\.(\d)(?=-|$)/g, "$1-$2");
116
141
  push(hyphenated);
117
142
  push(`anthropic/${hyphenated}`);
118
143
  }
119
144
  return aliases;
120
145
  }
121
146
  function normalizeKnownProviderID(providerID) {
122
- if (providerID.startsWith('github-copilot'))
123
- return 'github-copilot';
147
+ if (providerID.startsWith("github-copilot"))
148
+ return "github-copilot";
124
149
  return providerID;
125
150
  }
126
151
  function isCanonicalZhipuProviderID(providerID) {
127
- return (providerID === 'zhipu' ||
128
- providerID === 'bigmodel' ||
129
- providerID === 'z-ai' ||
130
- providerID === 'zhipuai-coding-plan');
152
+ return (providerID === "zhipu" ||
153
+ providerID === "bigmodel" ||
154
+ providerID === "z-ai" ||
155
+ providerID === "zhipuai-coding-plan");
156
+ }
157
+ function isCanonicalMiniMaxProviderID(providerID) {
158
+ return providerID === "minimax" || providerID === "minimax-cn-coding-plan";
131
159
  }
132
160
  export function canonicalPricingProviderID(providerID) {
133
161
  const normalized = normalizeKnownProviderID(providerID);
134
162
  const lowered = normalized.toLowerCase();
163
+ if (isCanonicalMiniMaxProviderID(lowered)) {
164
+ return "minimax";
165
+ }
135
166
  if (isCanonicalZhipuProviderID(lowered)) {
136
- return 'zhipu';
167
+ return "zhipu";
137
168
  }
138
- if (lowered === 'kimi-for-coding')
139
- return 'moonshotai';
140
- if (lowered.includes('anthropic') || lowered.includes('claude')) {
141
- return 'anthropic';
169
+ if (lowered === "kimi-for-coding")
170
+ return "moonshotai";
171
+ if (lowered.includes("anthropic") || lowered.includes("claude")) {
172
+ return "anthropic";
142
173
  }
143
- if (lowered.includes('openai') || lowered.endsWith('-oai'))
144
- return 'openai';
145
- if (lowered.includes('copilot'))
146
- return 'github-copilot';
174
+ if (lowered.includes("openai") || lowered.endsWith("-oai"))
175
+ return "openai";
176
+ if (lowered.includes("copilot"))
177
+ return "github-copilot";
147
178
  return normalized;
148
179
  }
149
180
  export function canonicalApiCostProviderID(providerID) {
150
181
  const normalized = normalizeKnownProviderID(providerID);
151
- if (API_COST_ENABLED_PROVIDERS.has(normalized))
152
- return normalized;
153
- const lowered = providerID.toLowerCase();
154
- if (lowered.includes('copilot'))
155
- return 'github-copilot';
156
- if (lowered.includes('openai') || lowered.endsWith('-oai'))
157
- return 'openai';
158
- if (lowered.includes('anthropic') || lowered.includes('claude')) {
159
- return 'anthropic';
182
+ const lowered = normalized.toLowerCase();
183
+ if (API_COST_ENABLED_PROVIDERS.has(lowered))
184
+ return lowered;
185
+ if (lowered === "minimax")
186
+ return "minimax-cn-coding-plan";
187
+ if (lowered.includes("copilot"))
188
+ return "github-copilot";
189
+ if (lowered.includes("openai") || lowered.endsWith("-oai"))
190
+ return "openai";
191
+ if (lowered.includes("anthropic") || lowered.includes("claude")) {
192
+ return "anthropic";
160
193
  }
161
194
  if (isCanonicalZhipuProviderID(lowered)) {
162
- return 'zhipu';
195
+ return "zhipu";
163
196
  }
164
197
  return normalized;
165
198
  }
@@ -200,194 +233,248 @@ function moonshotPricing(input, output, cacheRead) {
200
233
  cacheWrite: 0,
201
234
  };
202
235
  }
236
+ function minimaxPricing(input, output, cacheRead, cacheWrite) {
237
+ return {
238
+ input,
239
+ output,
240
+ cacheRead,
241
+ cacheWrite,
242
+ };
243
+ }
203
244
  const BUNDLED_CANONICAL_PRICE_ENTRIES = [
204
245
  {
205
- provider: 'anthropic',
206
- model: 'claude-opus-4-6',
246
+ provider: "anthropic",
247
+ model: "claude-opus-4-6",
207
248
  rates: anthropicPricing(5, 25),
208
- source: 'official-doc',
209
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
249
+ source: "official-doc",
250
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
210
251
  },
211
252
  {
212
- provider: 'anthropic',
213
- model: 'claude-opus-4-5',
253
+ provider: "anthropic",
254
+ model: "claude-opus-4-5",
214
255
  rates: anthropicPricing(5, 25),
215
- source: 'official-doc',
216
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
256
+ source: "official-doc",
257
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
217
258
  },
218
259
  {
219
- provider: 'anthropic',
220
- model: 'claude-opus-4-1',
260
+ provider: "anthropic",
261
+ model: "claude-opus-4-1",
221
262
  rates: anthropicPricing(15, 75),
222
- source: 'official-doc',
223
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
263
+ source: "official-doc",
264
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
224
265
  },
225
266
  {
226
- provider: 'anthropic',
227
- model: 'claude-opus-4',
267
+ provider: "anthropic",
268
+ model: "claude-opus-4",
228
269
  rates: anthropicPricing(15, 75),
229
- source: 'official-doc',
230
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
270
+ source: "official-doc",
271
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
231
272
  },
232
273
  {
233
- provider: 'anthropic',
234
- model: 'claude-sonnet-4-6',
274
+ provider: "anthropic",
275
+ model: "claude-sonnet-4-6",
235
276
  rates: anthropicPricing(3, 15),
236
- source: 'official-doc',
237
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
277
+ source: "official-doc",
278
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
238
279
  },
239
280
  {
240
- provider: 'anthropic',
241
- model: 'claude-sonnet-4-5',
281
+ provider: "anthropic",
282
+ model: "claude-sonnet-4-5",
242
283
  rates: anthropicPricing(3, 15, {
243
284
  longContextInput: 6,
244
285
  longContextOutput: 22.5,
245
286
  }),
246
- source: 'official-doc',
247
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
287
+ source: "official-doc",
288
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
248
289
  },
249
290
  {
250
- provider: 'anthropic',
251
- model: 'claude-sonnet-4',
291
+ provider: "anthropic",
292
+ model: "claude-sonnet-4",
252
293
  rates: anthropicPricing(3, 15, {
253
294
  longContextInput: 6,
254
295
  longContextOutput: 22.5,
255
296
  }),
256
- source: 'official-doc',
257
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
297
+ source: "official-doc",
298
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
258
299
  },
259
300
  {
260
- provider: 'anthropic',
261
- model: 'claude-3-7-sonnet',
301
+ provider: "anthropic",
302
+ model: "claude-3-7-sonnet",
262
303
  rates: anthropicPricing(3, 15),
263
- source: 'official-doc',
264
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
304
+ source: "official-doc",
305
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
265
306
  },
266
307
  {
267
- provider: 'anthropic',
268
- model: 'claude-3-5-sonnet',
308
+ provider: "anthropic",
309
+ model: "claude-3-5-sonnet",
269
310
  rates: anthropicPricing(3, 15),
270
- source: 'official-doc',
271
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
311
+ source: "official-doc",
312
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
272
313
  },
273
314
  {
274
- provider: 'anthropic',
275
- model: 'claude-haiku-4-5',
315
+ provider: "anthropic",
316
+ model: "claude-haiku-4-5",
276
317
  rates: anthropicPricing(1, 5),
277
- source: 'official-doc',
278
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
318
+ source: "official-doc",
319
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
279
320
  },
280
321
  {
281
- provider: 'anthropic',
282
- model: 'claude-3-5-haiku',
322
+ provider: "anthropic",
323
+ model: "claude-3-5-haiku",
283
324
  rates: anthropicPricing(0.8, 4),
284
- source: 'official-doc',
285
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
325
+ source: "official-doc",
326
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
286
327
  },
287
328
  {
288
- provider: 'anthropic',
289
- model: 'claude-3-opus',
329
+ provider: "anthropic",
330
+ model: "claude-3-opus",
290
331
  rates: anthropicPricing(15, 75),
291
- source: 'official-doc',
292
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
332
+ source: "official-doc",
333
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
293
334
  },
294
335
  {
295
- provider: 'anthropic',
296
- model: 'claude-3-haiku',
336
+ provider: "anthropic",
337
+ model: "claude-3-haiku",
297
338
  rates: anthropicPricing(0.25, 1.25),
298
- source: 'official-doc',
299
- sourceURL: 'https://docs.anthropic.com/en/docs/about-claude/pricing',
339
+ source: "official-doc",
340
+ sourceURL: "https://docs.anthropic.com/en/docs/about-claude/pricing",
300
341
  },
301
342
  {
302
- provider: 'zhipu',
303
- model: 'glm-5',
343
+ provider: "zhipu",
344
+ model: "glm-5",
304
345
  rates: zhipuPricing(1, 3.2, 0.2),
305
- source: 'official-doc',
306
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
346
+ source: "official-doc",
347
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
307
348
  },
308
349
  {
309
- provider: 'zhipu',
310
- model: 'glm-4.7',
350
+ provider: "zhipu",
351
+ model: "glm-4.7",
311
352
  rates: zhipuPricing(0.6, 2.2, 0.11),
312
- source: 'official-doc',
313
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
353
+ source: "official-doc",
354
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
314
355
  },
315
356
  {
316
- provider: 'zhipu',
317
- model: 'glm-4.6',
357
+ provider: "zhipu",
358
+ model: "glm-4.6",
318
359
  rates: zhipuPricing(0.6, 2.2, 0.11),
319
- source: 'official-doc',
320
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
360
+ source: "official-doc",
361
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
321
362
  },
322
363
  {
323
- provider: 'zhipu',
324
- model: 'glm-4.6v',
364
+ provider: "zhipu",
365
+ model: "glm-4.6v",
325
366
  rates: zhipuPricing(0.3, 0.9, 0.05),
326
- source: 'official-doc',
327
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
367
+ source: "official-doc",
368
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
328
369
  },
329
370
  {
330
- provider: 'zhipu',
331
- model: 'glm-4.5',
371
+ provider: "zhipu",
372
+ model: "glm-4.5",
332
373
  rates: zhipuPricing(0.6, 2.2, 0.11),
333
- source: 'official-doc',
334
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
374
+ source: "official-doc",
375
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
335
376
  },
336
377
  {
337
- provider: 'zhipu',
338
- model: 'glm-4.5-air',
378
+ provider: "zhipu",
379
+ model: "glm-4.5-air",
339
380
  rates: zhipuPricing(0.2, 1.1, 0.03),
340
- source: 'official-doc',
341
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
381
+ source: "official-doc",
382
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
342
383
  },
343
384
  {
344
- provider: 'zhipu',
345
- model: 'glm-4.5v',
385
+ provider: "zhipu",
386
+ model: "glm-4.5v",
346
387
  rates: zhipuPricing(0.6, 1.8, 0.11),
347
- source: 'official-doc',
348
- sourceURL: 'https://docs.z.ai/guides/overview/pricing',
388
+ source: "official-doc",
389
+ sourceURL: "https://docs.z.ai/guides/overview/pricing",
349
390
  },
350
391
  {
351
- provider: 'moonshotai',
352
- model: 'kimi-k2.5',
392
+ provider: "moonshotai",
393
+ model: "kimi-k2.5",
353
394
  rates: moonshotPricing(0.6, 3, 0.1),
354
- source: 'official-doc',
355
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
395
+ source: "official-doc",
396
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
356
397
  },
357
398
  {
358
- provider: 'moonshotai',
359
- model: 'kimi-k2-thinking',
399
+ provider: "moonshotai",
400
+ model: "kimi-k2-thinking",
360
401
  rates: moonshotPricing(0.6, 2.5, 0.15),
361
- source: 'official-doc',
362
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
402
+ source: "official-doc",
403
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
363
404
  },
364
405
  {
365
- provider: 'moonshotai',
366
- model: 'kimi-k2-0711-preview',
406
+ provider: "moonshotai",
407
+ model: "kimi-k2-0711-preview",
367
408
  rates: moonshotPricing(0.6, 2.5, 0.15),
368
- source: 'official-doc',
369
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
409
+ source: "official-doc",
410
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
370
411
  },
371
412
  {
372
- provider: 'moonshotai',
373
- model: 'kimi-k2-0905-preview',
413
+ provider: "moonshotai",
414
+ model: "kimi-k2-0905-preview",
374
415
  rates: moonshotPricing(0.6, 2.5, 0.15),
375
- source: 'official-doc',
376
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
416
+ source: "official-doc",
417
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
377
418
  },
378
419
  {
379
- provider: 'moonshotai',
380
- model: 'kimi-k2-turbo-preview',
420
+ provider: "moonshotai",
421
+ model: "kimi-k2-turbo-preview",
381
422
  rates: moonshotPricing(2.4, 10, 0.6),
382
- source: 'official-doc',
383
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
423
+ source: "official-doc",
424
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
384
425
  },
385
426
  {
386
- provider: 'moonshotai',
387
- model: 'kimi-k2-thinking-turbo',
427
+ provider: "moonshotai",
428
+ model: "kimi-k2-thinking-turbo",
388
429
  rates: moonshotPricing(1.15, 8, 0.15),
389
- source: 'official-doc',
390
- sourceURL: 'https://platform.moonshot.ai/docs/pricing/chat',
430
+ source: "official-doc",
431
+ sourceURL: "https://platform.moonshot.ai/docs/pricing/chat",
432
+ },
433
+ {
434
+ provider: "minimax",
435
+ model: "MiniMax-M2.7",
436
+ // OpenCode sources provider pricing from models.dev. The bundled MiniMax
437
+ // fallback mirrors those USD-denominated entries rather than the CN RMB
438
+ // docs so API-equivalent cost stays on the same currency basis as the rest
439
+ // of the sidebar/report output.
440
+ rates: minimaxPricing(0.3, 1.2, 0.06, 0.375),
441
+ source: "runtime",
442
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.7.toml",
443
+ },
444
+ {
445
+ provider: "minimax",
446
+ model: "MiniMax-M2.7-highspeed",
447
+ rates: minimaxPricing(0.6, 2.4, 0.06, 0.375),
448
+ source: "runtime",
449
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.7-highspeed.toml",
450
+ },
451
+ {
452
+ provider: "minimax",
453
+ model: "MiniMax-M2.5",
454
+ rates: minimaxPricing(0.3, 1.2, 0.03, 0.375),
455
+ source: "runtime",
456
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.5.toml",
457
+ },
458
+ {
459
+ provider: "minimax",
460
+ model: "MiniMax-M2.5-highspeed",
461
+ rates: minimaxPricing(0.6, 2.4, 0.06, 0.375),
462
+ source: "runtime",
463
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.5-highspeed.toml",
464
+ },
465
+ {
466
+ provider: "minimax",
467
+ model: "MiniMax-M2.1",
468
+ rates: minimaxPricing(0.3, 1.2, 0.03, 0.375),
469
+ source: "runtime",
470
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.1.toml",
471
+ },
472
+ {
473
+ provider: "minimax",
474
+ model: "MiniMax-M2",
475
+ rates: minimaxPricing(0.3, 1.2, 0, 0),
476
+ source: "runtime",
477
+ sourceURL: "https://github.com/anomalyco/models.dev/blob/dev/providers/minimax/models/MiniMax-M2.toml",
391
478
  },
392
479
  ];
393
480
  export function modelCostKey(providerID, modelID) {
@@ -400,13 +487,15 @@ export function modelCostLookupKeys(providerID, modelID) {
400
487
  if (!keys.includes(key))
401
488
  keys.push(key);
402
489
  };
403
- const modelIDsFor = (options) => canonicalProviderID === 'anthropic'
490
+ const modelIDsFor = (options) => canonicalProviderID === "anthropic"
404
491
  ? anthropicModelAliases(modelID)
405
- : canonicalProviderID === 'zhipu'
492
+ : canonicalProviderID === "zhipu"
406
493
  ? zhipuModelAliases(modelID)
407
- : canonicalProviderID === 'moonshotai'
494
+ : canonicalProviderID === "moonshotai"
408
495
  ? moonshotModelAliases(modelID, options)
409
- : [modelID];
496
+ : canonicalProviderID === "minimax"
497
+ ? minimaxModelAliases(modelID)
498
+ : [modelID];
410
499
  for (const candidateModelID of modelIDsFor()) {
411
500
  push(modelCostKey(providerID, candidateModelID));
412
501
  }
@@ -452,9 +541,9 @@ export function parseModelCostRates(value) {
452
541
  if (!isRecord(value))
453
542
  return undefined;
454
543
  const readRate = (input) => {
455
- if (typeof input === 'number')
544
+ if (typeof input === "number")
456
545
  return input;
457
- if (typeof input === 'string') {
546
+ if (typeof input === "string") {
458
547
  const parsed = Number(input);
459
548
  return Number.isFinite(parsed) ? parsed : 0;
460
549
  }
@@ -506,12 +595,12 @@ export function guessModelCostDivisor(rates) {
506
595
  }
507
596
  export function cacheCoverageModeFromRates(rates) {
508
597
  if (!rates)
509
- return 'none';
598
+ return "none";
510
599
  if (rates.cacheWrite > 0)
511
- return 'read-write';
600
+ return "read-write";
512
601
  if (rates.cacheRead > 0)
513
- return 'read-only';
514
- return 'none';
602
+ return "read-only";
603
+ return "none";
515
604
  }
516
605
  export function calcEquivalentApiCostForMessage(message, rates) {
517
606
  const effectiveRates = message.tokens.input + message.tokens.cache.read > 200_000 &&
package/dist/format.d.ts CHANGED
@@ -27,6 +27,10 @@ export declare function renderSidebarUsageLines(usage: UsageSummary, config: Quo
27
27
  showCost?: boolean;
28
28
  }): string[];
29
29
  export declare function renderSidebarQuotaLines(quotas: QuotaSnapshot[], config: QuotaSidebarConfig): string[];
30
+ export declare function renderSidebarQuotaLineGroups(quotas: QuotaSnapshot[], config: QuotaSidebarConfig): {
31
+ quota: QuotaSnapshot;
32
+ lines: string[];
33
+ }[];
30
34
  export declare function renderMarkdownReport(period: string, usage: UsageSummary, quotas: QuotaSnapshot[], options?: {
31
35
  showCost?: boolean;
32
36
  }): string;