@chenlongapps/opencode-token-usage 0.4.3 → 0.4.4
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/README.md +13 -2
- package/README.zh-CN.md +13 -2
- package/ROADMAP.md +0 -6
- package/dist/performance.d.ts +10 -0
- package/dist/performance.js +52 -11
- package/dist/prices.generated.d.ts +211 -1
- package/dist/prices.generated.js +18 -1
- package/dist/pricing.d.ts +1 -1
- package/docs/verification.md +24 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Alternatively, add the package to your project's `opencode.json` or `opencode.js
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
> [!NOTE]
|
|
37
|
-
> Requires Node.js 22+. OpenCode 2.0.9, 2.0.10, and 2.0.11 have been verified across project releases. The current SDK 2.0.11 build has been reverified on OpenCode 2.0.11.
|
|
37
|
+
> Requires Node.js 22+. OpenCode 2.0.9, 2.0.10, and 2.0.11 have been verified across project releases. The current SDK 2.0.11 build has been reverified on OpenCode 2.0.11 and 2.0.22.
|
|
38
38
|
|
|
39
39
|
Restart OpenCode after installation. The panel appears in the native sidebar when `session.sidebar` is set to `auto` and the terminal is wide enough. OpenCode hides the sidebar in subagent views, so the plugin keeps one live summary line above the composer with Context, Total, Cost, and TPS. Click the line to open the full statistics in a centered dialog. Press Escape or click **esc** to close it; closing the dialog does not interrupt the subagent.
|
|
40
40
|
|
|
@@ -74,7 +74,7 @@ Costs follow the sidebar's pricing and `partial`/unavailable/free conventions. I
|
|
|
74
74
|
| `Context` | Latest context usage after the most recent completed compaction in the viewed session; not aggregated across the subtree |
|
|
75
75
|
| `Steps` | Assistant message count across the session tree, including subagents; follows OpenCode's own stats definition, so compaction and user messages are not steps |
|
|
76
76
|
| `Est. Cost` | Estimated cost across the tree, pricing each assistant and compaction call with its actual model |
|
|
77
|
-
| `TPS` | Generation throughput for `Output + Reasoning` across the tree
|
|
77
|
+
| `TPS` | Generation throughput for `Output + Reasoning` across the tree. While streaming, it estimates recent observable text, reasoning-summary and tool-input deltas (UTF-8 bytes / 4) over a short sliding window after the first delta, excluding pre-first-token waiting, and marks the value with `~`. APIs such as OpenAI Responses do not expose complete hidden reasoning tokens in real time, so live values cannot represent hidden reasoning throughput. After completion it uses provider-reported Output and Reasoning tokens and removes `~` |
|
|
78
78
|
| `TTFT` | Average time to first token across measurable assistant steps in the tree |
|
|
79
79
|
|
|
80
80
|
#### Behavior
|
|
@@ -86,6 +86,7 @@ Costs follow the sidebar's pricing and `partial`/unavailable/free conventions. I
|
|
|
86
86
|
- `Est. Cost` prices every message with its recorded model. A complete non-zero price resolved by OpenCode takes precedence. If OpenCode reports a complete zero price, a complete first-party snapshot price overrides it; incomplete prices fall back for the whole message without mixing rates.
|
|
87
87
|
- The checked-in fallback snapshot is generated from [models.dev](https://models.dev/api.json) using only reviewed first-party provider/model families; a small set of manufacturer-verified exceptions is kept separately. It covers priced text models, without downloading prices while the plugin runs. Gateway models match exact manufacturer IDs, documented aliases, and known wrappers; only a terminal `-free` or `:free` can be removed for a second exact lookup.
|
|
88
88
|
- Confirmed free usage displays `$0.00`; unavailable prices display `—`; known subtotals with unpriced messages are marked `partial`. The snapshot excludes gateway markups, regional premiums, unlisted discounts, non-text billing, tool fees, and taxes, so Est. Cost is not a provider bill. See [price sources and limitations](docs/pricing.md).
|
|
89
|
+
- Live `TPS` with `~` is an estimate from recent observable deltas after the first delta over a ~2s sliding window with light smoothing; it excludes TTFT and hidden-reasoning waits. Without `~` it is exact provider-reported `Output + Reasoning` throughput. No model-specific multipliers or hidden-reasoning guesses are applied.
|
|
89
90
|
- Initial read failures display `Unavailable`. Later failures retain the last complete snapshot, display `Not updated`, and retry automatically.
|
|
90
91
|
|
|
91
92
|
### Development
|
|
@@ -104,6 +105,16 @@ For a manual refresh, run `npm run prices:update` in a networked environment, re
|
|
|
104
105
|
|
|
105
106
|
`test:smoke` packages the real artifact and validates loading, refreshes, `/usage`, subagent aggregation, per-message pricing, first-party price fallback, model switching, TPS, and TTFT against an isolated OpenCode instance and a local mock provider. It requires Python 3, an available local port, and npm network access. It never modifies your existing OpenCode configuration or calls paid models.
|
|
106
107
|
|
|
108
|
+
By default, smoke uses `opencode` from `PATH`. Stable OpenCode 2 versions from 2.0.9 onward can run; a host not yet verified with the current SDK prints a warning and continues through the actual compatibility checks. Passing the version check alone does not establish compatibility. The SDK dependencies remain pinned independently of your local CLI updates.
|
|
109
|
+
|
|
110
|
+
To reproduce a baseline with a separately installed binary, without downgrading your normal installation:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
OPENCODE_BIN=/absolute/path/to/opencode-2.0.11 npm run test:smoke
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`OPENCODE_BIN` selects the same executable for the version check, isolated server, and TUI. Relative paths resolve from the directory where you run the command. The host version and selected binary are recorded in the smoke output and `result.json`; see the [verification record](docs/verification.md) for tested combinations.
|
|
117
|
+
|
|
107
118
|
To load the plugin from source, build the project and add the repository's absolute path to `plugins` in the target project.
|
|
108
119
|
|
|
109
120
|
### Documentation
|
package/README.zh-CN.md
CHANGED
|
@@ -34,7 +34,7 @@ opencode plugin add @chenlongapps/opencode-token-usage
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
> [!NOTE]
|
|
37
|
-
> 需要 Node.js 22+。项目历次发布已验证 OpenCode 2.0.9、2.0.10 和 2.0.11;当前 SDK 2.0.11 构建已在 OpenCode 2.0.11 上重新验证。
|
|
37
|
+
> 需要 Node.js 22+。项目历次发布已验证 OpenCode 2.0.9、2.0.10 和 2.0.11;当前 SDK 2.0.11 构建已在 OpenCode 2.0.11 和 2.0.22 上重新验证。
|
|
38
38
|
|
|
39
39
|
安装后重启 OpenCode。终端足够宽且 `session.sidebar` 设为 `auto` 时,面板会显示在原生侧边栏中。OpenCode 在子代理视图中隐藏侧边栏,因此插件会在输入区上方保留一行实时摘要,显示 Context、Total、Cost 和 TPS。点击摘要可在居中弹窗中查看完整统计;按 Escape 或点击 **esc** 即可关闭,关闭弹窗不会中断子代理。
|
|
40
40
|
|
|
@@ -74,7 +74,7 @@ opencode plugin add @chenlongapps/opencode-token-usage
|
|
|
74
74
|
| `Context` | 当前会话最后一次已完成压缩后的最新上下文用量,不随子树累计 |
|
|
75
75
|
| `Steps` | 全树(含子代理)的 assistant 消息数,口径与 OpenCode 自带统计一致,compaction 与用户消息不计为 step |
|
|
76
76
|
| `Est. Cost` | 按每条 assistant 与 compaction 消息实际模型估算的全树费用 |
|
|
77
|
-
| `TPS` | 全树 `Output + Reasoning`
|
|
77
|
+
| `TPS` | 全树 `Output + Reasoning` 的生成吞吐。请求进行中时,插件根据首个流式增量之后最近的可观察文本、reasoning summary 和工具输入流(UTF-8 字节数 / 4)按短时间滑动窗口估算输出速度,不包含首 token 前等待时间,并以 `~` 标记。OpenAI Responses 等 API 不会实时暴露完整的隐藏 reasoning token,因此实时值不能表示隐藏推理吞吐。请求完成后,插件使用服务端上报的 Output 与 Reasoning token 及时间信息计算精确 TPS,并移除 `~` 标记 |
|
|
78
78
|
| `TTFT` | 全树中可测 assistant step 的平均首 token 时间 |
|
|
79
79
|
|
|
80
80
|
#### 行为
|
|
@@ -86,6 +86,7 @@ opencode plugin add @chenlongapps/opencode-token-usage
|
|
|
86
86
|
- `Est. Cost` 按每条消息记录的实际模型分别计算。OpenCode 当前解析出的完整非零价格优先;若 OpenCode 给出完整零价,且内置价格快照可以完整计价,则采用快照价格。价格不完整时整条消息回退,不混用两套费率。
|
|
87
87
|
- 内置回退快照从 [models.dev](https://models.dev/api.json) 生成,只采用审核过的原厂 Provider 与自家模型系列;少量经原厂核实的例外单独维护。快照覆盖有价格的文本模型,插件运行时不下载价格。网关模型通过精确原厂 ID、明确别名和已知包装格式匹配;只有终尾 `-free` 或 `:free` 会在再次精确查找前移除。
|
|
88
88
|
- 确认免费时显示 `$0.00`;价格不可用时显示 `—`;只有部分消息可计算时在已知小计后标注 `partial`。快照不含网关加价、区域溢价、未列明的折扣、非文本计费、工具费和税费;Est. Cost 是估算而非账单。覆盖范围、来源和限制见[价格来源与限制](docs/pricing.md)。
|
|
89
|
+
- 带 `~` 的实时 `TPS` 是首个流式增量之后约 2 秒滑动窗口内可观察增量的估算值(带轻度平滑),不包含 TTFT 与隐藏推理等待;不带 `~` 时为服务端上报的 `Output + Reasoning` 精确吞吐。不做模型专属倍率,也不猜测隐藏 reasoning token。
|
|
89
90
|
- 首次读取失败显示 `Unavailable`;后续失败保留上次完整快照、标注 `Not updated` 并自动重试。
|
|
90
91
|
|
|
91
92
|
### 开发
|
|
@@ -104,6 +105,16 @@ npm run test:smoke
|
|
|
104
105
|
|
|
105
106
|
`test:smoke` 会打包真实产物,并在隔离的 OpenCode 与本地模拟提供商中验证加载、刷新、`/usage`、子代理累计、逐消息计价、原厂价格补全、模型切换、TPS 和 TTFT。它需要 Python 3、可用的本地端口和 npm 网络访问,不会修改现有 OpenCode 配置或调用付费模型。
|
|
106
107
|
|
|
108
|
+
默认使用 `PATH` 中的 `opencode`。OpenCode 2.0.9 及之后的稳定版 2.x 可以运行;尚未与当前 SDK 验证的宿主会输出警告,然后继续实际兼容性检查。仅通过版本检查不代表兼容性已验证。SDK 依赖仍独立锁定,不随本机 CLI 更新而自动升级。
|
|
109
|
+
|
|
110
|
+
如需用独立安装的二进制复现基准,而不降级日常使用的安装:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
OPENCODE_BIN=/absolute/path/to/opencode-2.0.11 npm run test:smoke
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`OPENCODE_BIN` 为版本检查、隔离服务端和 TUI 统一选择同一个可执行文件。相对路径以执行命令时的目录为基准解析。smoke 输出和 `result.json` 会记录宿主版本与所选二进制;已测试组合见[验证记录](docs/verification.md)。
|
|
117
|
+
|
|
107
118
|
从源码加载时,先构建项目,再将仓库绝对路径加入目标项目的 `plugins`。
|
|
108
119
|
|
|
109
120
|
### 文档
|
package/ROADMAP.md
CHANGED
|
@@ -111,9 +111,3 @@ Steps 1,234
|
|
|
111
111
|
|
|
112
112
|
## 待解决问题
|
|
113
113
|
|
|
114
|
-
### 后续评估与维护
|
|
115
|
-
|
|
116
|
-
* [ ] GPT-6 Luna 实际约为 30 tok/s,但在 实时统计中仅显示 ~1.5 tok/s,而且这个数字长期不变化。初步怀疑是 Responses API 的原因。
|
|
117
|
-
* [ ] TPS 的实时计算:当前为近似值,后续考虑通过更精确的算法计算。
|
|
118
|
-
* [ ] 在定时或发布前验证中运行打包产物的真实宿主 smoke 测试;升级 OpenCode/SDK 时重新核对消息排序、分叉副本、compaction、事件与价格语义。
|
|
119
|
-
* [ ] 同步仓库指南中的当前包版本与测试数量,避免 `AGENTS.md` 的状态说明落后于实际工程。
|
package/dist/performance.d.ts
CHANGED
|
@@ -17,6 +17,16 @@ export interface PerformanceEvent {
|
|
|
17
17
|
id?: string;
|
|
18
18
|
created?: number;
|
|
19
19
|
}
|
|
20
|
+
export interface StreamSample {
|
|
21
|
+
time: number;
|
|
22
|
+
bytes: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const LIVE_WINDOW_MS = 2000;
|
|
25
|
+
export declare const LIVE_EWMA_ALPHA = 0.35;
|
|
26
|
+
export declare const LIVE_BYTES_PER_TOKEN = 4;
|
|
27
|
+
/** Raw live throughput from one step's recent observable deltas. */
|
|
28
|
+
export declare function estimatedLiveTps(samples: readonly StreamSample[]): number | undefined;
|
|
29
|
+
export declare function smoothLiveTps(previous: number | undefined, raw: number): number;
|
|
20
30
|
export interface PreparedPerformance {
|
|
21
31
|
tps?: number;
|
|
22
32
|
ttftSum: number;
|
package/dist/performance.js
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { normalize } from "./usage.js";
|
|
2
|
+
export const LIVE_WINDOW_MS = 2_000;
|
|
3
|
+
export const LIVE_EWMA_ALPHA = 0.35;
|
|
4
|
+
export const LIVE_BYTES_PER_TOKEN = 4;
|
|
5
|
+
/** Raw live throughput from one step's recent observable deltas. */
|
|
6
|
+
export function estimatedLiveTps(samples) {
|
|
7
|
+
if (samples.length < 2)
|
|
8
|
+
return undefined;
|
|
9
|
+
const first = samples[0];
|
|
10
|
+
const last = samples[samples.length - 1];
|
|
11
|
+
const duration = last.time - first.time;
|
|
12
|
+
if (!Number.isFinite(duration) || duration <= 0)
|
|
13
|
+
return undefined;
|
|
14
|
+
let bytes = 0;
|
|
15
|
+
for (const sample of samples) {
|
|
16
|
+
if (!Number.isFinite(sample.time) || !Number.isFinite(sample.bytes) || sample.bytes < 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
bytes += sample.bytes;
|
|
19
|
+
}
|
|
20
|
+
if (bytes <= 0)
|
|
21
|
+
return undefined;
|
|
22
|
+
return (bytes / LIVE_BYTES_PER_TOKEN) / (duration / 1_000);
|
|
23
|
+
}
|
|
24
|
+
export function smoothLiveTps(previous, raw) {
|
|
25
|
+
if (previous === undefined || !Number.isFinite(previous))
|
|
26
|
+
return raw;
|
|
27
|
+
return previous * (1 - LIVE_EWMA_ALPHA) + raw * LIVE_EWMA_ALPHA;
|
|
28
|
+
}
|
|
2
29
|
const finite = (value) => typeof value === "number" && Number.isFinite(value);
|
|
3
30
|
function historicalFirst(message) {
|
|
4
31
|
const started = message.time?.created;
|
|
@@ -187,7 +214,7 @@ export class PerformanceMonitor {
|
|
|
187
214
|
if (this.active.has(key))
|
|
188
215
|
return false;
|
|
189
216
|
this.active.set(key, {
|
|
190
|
-
messageID, sessionID, started: data.started, bytes: 0, events: new Set(),
|
|
217
|
+
messageID, sessionID, started: data.started, bytes: 0, samples: [], events: new Set(),
|
|
191
218
|
});
|
|
192
219
|
return false;
|
|
193
220
|
}
|
|
@@ -229,7 +256,12 @@ export class PerformanceMonitor {
|
|
|
229
256
|
delete sample.expiresAt;
|
|
230
257
|
this.scheduleCleanup();
|
|
231
258
|
}
|
|
232
|
-
|
|
259
|
+
const sampleBytes = new TextEncoder().encode(data.delta).byteLength;
|
|
260
|
+
step.bytes += sampleBytes;
|
|
261
|
+
step.samples.push({ time: event.created, bytes: sampleBytes });
|
|
262
|
+
const cutoff = event.created - LIVE_WINDOW_MS;
|
|
263
|
+
while (step.samples.length > 0 && step.samples[0].time < cutoff)
|
|
264
|
+
step.samples.shift();
|
|
233
265
|
step.last = Math.max(step.last ?? event.created, event.created);
|
|
234
266
|
if (step.first === undefined) {
|
|
235
267
|
step.first = event.created;
|
|
@@ -269,19 +301,28 @@ export class PerformanceMonitor {
|
|
|
269
301
|
const sessions = new Set(sessionIDs);
|
|
270
302
|
const samples = [...this.observed.values()].filter(sample => sessions.has(sample.sessionID));
|
|
271
303
|
const result = performanceWithObservations(prepared, samples);
|
|
272
|
-
|
|
273
|
-
|
|
304
|
+
// Live throughput covers only observable deltas after the first one, over a
|
|
305
|
+
// short sliding window. TTFT keeps the started -> first wait separately, and
|
|
306
|
+
// completed provider usage still replaces this estimate via reconcile().
|
|
307
|
+
let weighted = 0;
|
|
308
|
+
let durationTotal = 0;
|
|
274
309
|
for (const step of this.active.values()) {
|
|
275
|
-
if (!sessions.has(step.sessionID) || step.reconciledAt !== undefined
|
|
310
|
+
if (!sessions.has(step.sessionID) || step.reconciledAt !== undefined)
|
|
311
|
+
continue;
|
|
312
|
+
const raw = estimatedLiveTps(step.samples);
|
|
313
|
+
if (raw === undefined)
|
|
276
314
|
continue;
|
|
277
|
-
const
|
|
278
|
-
|
|
315
|
+
const first = step.samples[0];
|
|
316
|
+
const last = step.samples[step.samples.length - 1];
|
|
317
|
+
const duration = last.time - first.time;
|
|
318
|
+
if (!finite(duration) || duration <= 0)
|
|
279
319
|
continue;
|
|
280
|
-
|
|
281
|
-
|
|
320
|
+
step.liveTps = smoothLiveTps(step.liveTps, raw);
|
|
321
|
+
weighted += step.liveTps * duration;
|
|
322
|
+
durationTotal += duration;
|
|
282
323
|
}
|
|
283
|
-
if (
|
|
284
|
-
result.tps =
|
|
324
|
+
if (durationTotal > 0) {
|
|
325
|
+
result.tps = weighted / durationTotal;
|
|
285
326
|
result.tpsEstimated = true;
|
|
286
327
|
}
|
|
287
328
|
return result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
2
|
-
readonly verified: "2026-
|
|
2
|
+
readonly verified: "2026-10-02";
|
|
3
3
|
readonly source: "https://models.dev/api.json";
|
|
4
4
|
readonly entries: readonly [{
|
|
5
5
|
readonly providerID: "ai21";
|
|
@@ -824,6 +824,14 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
824
824
|
readonly output: 0;
|
|
825
825
|
}];
|
|
826
826
|
readonly released: "2026-06-09";
|
|
827
|
+
}, {
|
|
828
|
+
readonly providerID: "cohere";
|
|
829
|
+
readonly id: "north-small-translate-09-2026";
|
|
830
|
+
readonly prices: readonly [{
|
|
831
|
+
readonly input: 0;
|
|
832
|
+
readonly output: 0;
|
|
833
|
+
}];
|
|
834
|
+
readonly released: "2026-09-09";
|
|
827
835
|
}, {
|
|
828
836
|
readonly providerID: "deepseek";
|
|
829
837
|
readonly id: "deepseek-flash";
|
|
@@ -1703,6 +1711,14 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1703
1711
|
};
|
|
1704
1712
|
}];
|
|
1705
1713
|
readonly released: "2026-06-04";
|
|
1714
|
+
}, {
|
|
1715
|
+
readonly providerID: "nvidia";
|
|
1716
|
+
readonly id: "nvidia/nemotron-3.5-content-safety";
|
|
1717
|
+
readonly prices: readonly [{
|
|
1718
|
+
readonly input: 0;
|
|
1719
|
+
readonly output: 0;
|
|
1720
|
+
}];
|
|
1721
|
+
readonly released: "2026-06-04";
|
|
1706
1722
|
}, {
|
|
1707
1723
|
readonly providerID: "nvidia";
|
|
1708
1724
|
readonly id: "nvidia/nemotron-3.5-lightning-30b-a3b";
|
|
@@ -1781,6 +1797,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1781
1797
|
};
|
|
1782
1798
|
}];
|
|
1783
1799
|
readonly released: "2025-04-14";
|
|
1800
|
+
}, {
|
|
1801
|
+
readonly providerID: "openai";
|
|
1802
|
+
readonly id: "gpt-4.1-fast";
|
|
1803
|
+
readonly providers: readonly ["openai"];
|
|
1804
|
+
readonly prices: readonly [{
|
|
1805
|
+
readonly input: 3.5;
|
|
1806
|
+
readonly output: 14;
|
|
1807
|
+
readonly cache: {
|
|
1808
|
+
readonly read: 0.875;
|
|
1809
|
+
};
|
|
1810
|
+
}];
|
|
1811
|
+
readonly released: "2025-04-14";
|
|
1784
1812
|
}, {
|
|
1785
1813
|
readonly providerID: "openai";
|
|
1786
1814
|
readonly id: "gpt-4.1-mini";
|
|
@@ -1792,6 +1820,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1792
1820
|
};
|
|
1793
1821
|
}];
|
|
1794
1822
|
readonly released: "2025-04-14";
|
|
1823
|
+
}, {
|
|
1824
|
+
readonly providerID: "openai";
|
|
1825
|
+
readonly id: "gpt-4.1-mini-fast";
|
|
1826
|
+
readonly providers: readonly ["openai"];
|
|
1827
|
+
readonly prices: readonly [{
|
|
1828
|
+
readonly input: 0.7;
|
|
1829
|
+
readonly output: 2.8;
|
|
1830
|
+
readonly cache: {
|
|
1831
|
+
readonly read: 0.175;
|
|
1832
|
+
};
|
|
1833
|
+
}];
|
|
1834
|
+
readonly released: "2025-04-14";
|
|
1795
1835
|
}, {
|
|
1796
1836
|
readonly providerID: "openai";
|
|
1797
1837
|
readonly id: "gpt-4.1-nano";
|
|
@@ -1803,6 +1843,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1803
1843
|
};
|
|
1804
1844
|
}];
|
|
1805
1845
|
readonly released: "2025-04-14";
|
|
1846
|
+
}, {
|
|
1847
|
+
readonly providerID: "openai";
|
|
1848
|
+
readonly id: "gpt-4.1-nano-fast";
|
|
1849
|
+
readonly providers: readonly ["openai"];
|
|
1850
|
+
readonly prices: readonly [{
|
|
1851
|
+
readonly input: 0.2;
|
|
1852
|
+
readonly output: 0.8;
|
|
1853
|
+
readonly cache: {
|
|
1854
|
+
readonly read: 0.05;
|
|
1855
|
+
};
|
|
1856
|
+
}];
|
|
1857
|
+
readonly released: "2025-04-14";
|
|
1806
1858
|
}, {
|
|
1807
1859
|
readonly providerID: "openai";
|
|
1808
1860
|
readonly id: "gpt-4o";
|
|
@@ -1822,6 +1874,15 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1822
1874
|
readonly output: 15;
|
|
1823
1875
|
}];
|
|
1824
1876
|
readonly released: "2024-05-13";
|
|
1877
|
+
}, {
|
|
1878
|
+
readonly providerID: "openai";
|
|
1879
|
+
readonly id: "gpt-4o-2024-05-13-fast";
|
|
1880
|
+
readonly providers: readonly ["openai"];
|
|
1881
|
+
readonly prices: readonly [{
|
|
1882
|
+
readonly input: 8.75;
|
|
1883
|
+
readonly output: 26.25;
|
|
1884
|
+
}];
|
|
1885
|
+
readonly released: "2024-05-13";
|
|
1825
1886
|
}, {
|
|
1826
1887
|
readonly providerID: "openai";
|
|
1827
1888
|
readonly id: "gpt-4o-2024-08-06";
|
|
@@ -1844,6 +1905,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1844
1905
|
};
|
|
1845
1906
|
}];
|
|
1846
1907
|
readonly released: "2024-11-20";
|
|
1908
|
+
}, {
|
|
1909
|
+
readonly providerID: "openai";
|
|
1910
|
+
readonly id: "gpt-4o-fast";
|
|
1911
|
+
readonly providers: readonly ["openai"];
|
|
1912
|
+
readonly prices: readonly [{
|
|
1913
|
+
readonly input: 4.25;
|
|
1914
|
+
readonly output: 17;
|
|
1915
|
+
readonly cache: {
|
|
1916
|
+
readonly read: 2.125;
|
|
1917
|
+
};
|
|
1918
|
+
}];
|
|
1919
|
+
readonly released: "2024-05-13";
|
|
1847
1920
|
}, {
|
|
1848
1921
|
readonly providerID: "openai";
|
|
1849
1922
|
readonly id: "gpt-4o-mini";
|
|
@@ -1855,6 +1928,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1855
1928
|
};
|
|
1856
1929
|
}];
|
|
1857
1930
|
readonly released: "2024-07-18";
|
|
1931
|
+
}, {
|
|
1932
|
+
readonly providerID: "openai";
|
|
1933
|
+
readonly id: "gpt-4o-mini-fast";
|
|
1934
|
+
readonly providers: readonly ["openai"];
|
|
1935
|
+
readonly prices: readonly [{
|
|
1936
|
+
readonly input: 0.25;
|
|
1937
|
+
readonly output: 1;
|
|
1938
|
+
readonly cache: {
|
|
1939
|
+
readonly read: 0.125;
|
|
1940
|
+
};
|
|
1941
|
+
}];
|
|
1942
|
+
readonly released: "2024-07-18";
|
|
1858
1943
|
}, {
|
|
1859
1944
|
readonly providerID: "openai";
|
|
1860
1945
|
readonly id: "gpt-5";
|
|
@@ -1866,6 +1951,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1866
1951
|
};
|
|
1867
1952
|
}];
|
|
1868
1953
|
readonly released: "2025-08-07";
|
|
1954
|
+
}, {
|
|
1955
|
+
readonly providerID: "openai";
|
|
1956
|
+
readonly id: "gpt-5-fast";
|
|
1957
|
+
readonly providers: readonly ["openai"];
|
|
1958
|
+
readonly prices: readonly [{
|
|
1959
|
+
readonly input: 2.5;
|
|
1960
|
+
readonly output: 20;
|
|
1961
|
+
readonly cache: {
|
|
1962
|
+
readonly read: 0.25;
|
|
1963
|
+
};
|
|
1964
|
+
}];
|
|
1965
|
+
readonly released: "2025-08-07";
|
|
1869
1966
|
}, {
|
|
1870
1967
|
readonly providerID: "openai";
|
|
1871
1968
|
readonly id: "gpt-5-mini";
|
|
@@ -1877,6 +1974,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1877
1974
|
};
|
|
1878
1975
|
}];
|
|
1879
1976
|
readonly released: "2025-08-07";
|
|
1977
|
+
}, {
|
|
1978
|
+
readonly providerID: "openai";
|
|
1979
|
+
readonly id: "gpt-5-mini-fast";
|
|
1980
|
+
readonly providers: readonly ["openai"];
|
|
1981
|
+
readonly prices: readonly [{
|
|
1982
|
+
readonly input: 0.45;
|
|
1983
|
+
readonly output: 3.6;
|
|
1984
|
+
readonly cache: {
|
|
1985
|
+
readonly read: 0.045;
|
|
1986
|
+
};
|
|
1987
|
+
}];
|
|
1988
|
+
readonly released: "2025-08-07";
|
|
1880
1989
|
}, {
|
|
1881
1990
|
readonly providerID: "openai";
|
|
1882
1991
|
readonly id: "gpt-5-nano";
|
|
@@ -1907,6 +2016,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1907
2016
|
};
|
|
1908
2017
|
}];
|
|
1909
2018
|
readonly released: "2025-11-13";
|
|
2019
|
+
}, {
|
|
2020
|
+
readonly providerID: "openai";
|
|
2021
|
+
readonly id: "gpt-5.1-fast";
|
|
2022
|
+
readonly providers: readonly ["openai"];
|
|
2023
|
+
readonly prices: readonly [{
|
|
2024
|
+
readonly input: 2.5;
|
|
2025
|
+
readonly output: 20;
|
|
2026
|
+
readonly cache: {
|
|
2027
|
+
readonly read: 0.25;
|
|
2028
|
+
};
|
|
2029
|
+
}];
|
|
2030
|
+
readonly released: "2025-11-13";
|
|
1910
2031
|
}, {
|
|
1911
2032
|
readonly providerID: "openai";
|
|
1912
2033
|
readonly id: "gpt-5.2";
|
|
@@ -1929,6 +2050,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1929
2050
|
};
|
|
1930
2051
|
}];
|
|
1931
2052
|
readonly released: "2025-12-11";
|
|
2053
|
+
}, {
|
|
2054
|
+
readonly providerID: "openai";
|
|
2055
|
+
readonly id: "gpt-5.2-fast";
|
|
2056
|
+
readonly providers: readonly ["openai"];
|
|
2057
|
+
readonly prices: readonly [{
|
|
2058
|
+
readonly input: 3.5;
|
|
2059
|
+
readonly output: 28;
|
|
2060
|
+
readonly cache: {
|
|
2061
|
+
readonly read: 0.35;
|
|
2062
|
+
};
|
|
2063
|
+
}];
|
|
2064
|
+
readonly released: "2025-12-11";
|
|
1932
2065
|
}, {
|
|
1933
2066
|
readonly providerID: "openai";
|
|
1934
2067
|
readonly id: "gpt-5.2-pro";
|
|
@@ -1959,6 +2092,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1959
2092
|
};
|
|
1960
2093
|
}];
|
|
1961
2094
|
readonly released: "2026-02-05";
|
|
2095
|
+
}, {
|
|
2096
|
+
readonly providerID: "openai";
|
|
2097
|
+
readonly id: "gpt-5.3-codex-fast";
|
|
2098
|
+
readonly providers: readonly ["openai"];
|
|
2099
|
+
readonly prices: readonly [{
|
|
2100
|
+
readonly input: 3.5;
|
|
2101
|
+
readonly output: 28;
|
|
2102
|
+
readonly cache: {
|
|
2103
|
+
readonly read: 0.35;
|
|
2104
|
+
};
|
|
2105
|
+
}];
|
|
2106
|
+
readonly released: "2026-02-05";
|
|
1962
2107
|
}, {
|
|
1963
2108
|
readonly providerID: "openai";
|
|
1964
2109
|
readonly id: "gpt-5.3-codex-spark";
|
|
@@ -2397,6 +2542,47 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
2397
2542
|
};
|
|
2398
2543
|
}];
|
|
2399
2544
|
readonly released: "2026-09-22";
|
|
2545
|
+
}, {
|
|
2546
|
+
readonly providerID: "openai";
|
|
2547
|
+
readonly id: "gpt-6.1-sol";
|
|
2548
|
+
readonly prices: readonly [{
|
|
2549
|
+
readonly input: 2;
|
|
2550
|
+
readonly output: 10;
|
|
2551
|
+
readonly cache: {
|
|
2552
|
+
readonly read: 0.1;
|
|
2553
|
+
readonly write: 2.5;
|
|
2554
|
+
};
|
|
2555
|
+
}, {
|
|
2556
|
+
readonly input: 4;
|
|
2557
|
+
readonly output: 15;
|
|
2558
|
+
readonly cache: {
|
|
2559
|
+
readonly read: 0.2;
|
|
2560
|
+
readonly write: 5;
|
|
2561
|
+
};
|
|
2562
|
+
readonly tier: {
|
|
2563
|
+
readonly type: "context";
|
|
2564
|
+
readonly size: 272000;
|
|
2565
|
+
};
|
|
2566
|
+
}];
|
|
2567
|
+
readonly released: "2026-09-29";
|
|
2568
|
+
}, {
|
|
2569
|
+
readonly providerID: "openai";
|
|
2570
|
+
readonly id: "gpt-6.1-sol-fast";
|
|
2571
|
+
readonly providers: readonly ["openai"];
|
|
2572
|
+
readonly prices: readonly [{
|
|
2573
|
+
readonly input: 4;
|
|
2574
|
+
readonly output: 20;
|
|
2575
|
+
readonly cache: {
|
|
2576
|
+
readonly read: 0.2;
|
|
2577
|
+
readonly write: 5;
|
|
2578
|
+
};
|
|
2579
|
+
}, {
|
|
2580
|
+
readonly tier: {
|
|
2581
|
+
readonly type: "context";
|
|
2582
|
+
readonly size: 272000;
|
|
2583
|
+
};
|
|
2584
|
+
}];
|
|
2585
|
+
readonly released: "2026-09-29";
|
|
2400
2586
|
}, {
|
|
2401
2587
|
readonly providerID: "openai";
|
|
2402
2588
|
readonly id: "gpt-daybreak-blue-latest";
|
|
@@ -2462,6 +2648,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
2462
2648
|
};
|
|
2463
2649
|
}];
|
|
2464
2650
|
readonly released: "2025-04-16";
|
|
2651
|
+
}, {
|
|
2652
|
+
readonly providerID: "openai";
|
|
2653
|
+
readonly id: "o3-fast";
|
|
2654
|
+
readonly providers: readonly ["openai"];
|
|
2655
|
+
readonly prices: readonly [{
|
|
2656
|
+
readonly input: 3.5;
|
|
2657
|
+
readonly output: 14;
|
|
2658
|
+
readonly cache: {
|
|
2659
|
+
readonly read: 0.875;
|
|
2660
|
+
};
|
|
2661
|
+
}];
|
|
2662
|
+
readonly released: "2025-04-16";
|
|
2465
2663
|
}, {
|
|
2466
2664
|
readonly providerID: "openai";
|
|
2467
2665
|
readonly id: "o3-mini";
|
|
@@ -2492,6 +2690,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
2492
2690
|
};
|
|
2493
2691
|
}];
|
|
2494
2692
|
readonly released: "2025-04-16";
|
|
2693
|
+
}, {
|
|
2694
|
+
readonly providerID: "openai";
|
|
2695
|
+
readonly id: "o4-mini-fast";
|
|
2696
|
+
readonly providers: readonly ["openai"];
|
|
2697
|
+
readonly prices: readonly [{
|
|
2698
|
+
readonly input: 2;
|
|
2699
|
+
readonly output: 8;
|
|
2700
|
+
readonly cache: {
|
|
2701
|
+
readonly read: 0.5;
|
|
2702
|
+
};
|
|
2703
|
+
}];
|
|
2704
|
+
readonly released: "2025-04-16";
|
|
2495
2705
|
}, {
|
|
2496
2706
|
readonly providerID: "perplexity";
|
|
2497
2707
|
readonly id: "sonar";
|
package/dist/prices.generated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const GENERATED_PRICE_SNAPSHOT = {
|
|
2
|
-
verified: "2026-
|
|
2
|
+
verified: "2026-10-02",
|
|
3
3
|
source: "https://models.dev/api.json",
|
|
4
4
|
entries: [
|
|
5
5
|
{ "providerID": "ai21", "id": "jamba-large", "prices": [{ "input": 2, "output": 8 }], "released": "2025-07-01" },
|
|
@@ -84,6 +84,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
84
84
|
{ "providerID": "cohere", "id": "command-r7b-12-2024", "prices": [{ "input": 0.0375, "output": 0.15 }], "released": "2024-12-02" },
|
|
85
85
|
{ "providerID": "cohere", "id": "command-r7b-arabic-02-2025", "prices": [{ "input": 0.0375, "output": 0.15 }], "released": "2025-02-27" },
|
|
86
86
|
{ "providerID": "cohere", "id": "north-mini-code-1-0", "prices": [{ "input": 0, "output": 0 }], "released": "2026-06-09" },
|
|
87
|
+
{ "providerID": "cohere", "id": "north-small-translate-09-2026", "prices": [{ "input": 0, "output": 0 }], "released": "2026-09-09" },
|
|
87
88
|
{ "providerID": "deepseek", "id": "deepseek-flash", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
88
89
|
{ "providerID": "deepseek", "id": "deepseek-v4-flash", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
89
90
|
{ "providerID": "deepseek", "id": "deepseek-v4-flash-vision-exp", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
@@ -167,6 +168,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
167
168
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning", "prices": [{ "input": 0, "output": 0 }], "released": "2026-04-28" },
|
|
168
169
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-3-super-120b-a12b", "prices": [{ "input": 0.2, "output": 0.8 }], "released": "2026-03-11" },
|
|
169
170
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-3-ultra-550b-a55b", "prices": [{ "input": 0.5, "output": 2.5, "cache": { "read": 0.15 } }], "released": "2026-06-04" },
|
|
171
|
+
{ "providerID": "nvidia", "id": "nvidia/nemotron-3.5-content-safety", "prices": [{ "input": 0, "output": 0 }], "released": "2026-06-04" },
|
|
170
172
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-3.5-lightning-30b-a3b", "prices": [{ "input": 0, "output": 0 }], "released": "2026-08-11" },
|
|
171
173
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-content-safety-reasoning-4b", "prices": [{ "input": 0, "output": 0 }], "released": "2026-01-22" },
|
|
172
174
|
{ "providerID": "nvidia", "id": "nvidia/nemotron-mini-4b-instruct", "prices": [{ "input": 0, "output": 0 }], "released": "2024-08-21" },
|
|
@@ -176,23 +178,34 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
176
178
|
{ "providerID": "openai", "id": "gpt-4", "prices": [{ "input": 30, "output": 60 }], "released": "2023-11-06" },
|
|
177
179
|
{ "providerID": "openai", "id": "gpt-4-turbo", "prices": [{ "input": 10, "output": 30 }], "released": "2023-11-06" },
|
|
178
180
|
{ "providerID": "openai", "id": "gpt-4.1", "prices": [{ "input": 2, "output": 8, "cache": { "read": 0.5 } }], "released": "2025-04-14" },
|
|
181
|
+
{ "providerID": "openai", "id": "gpt-4.1-fast", "providers": ["openai"], "prices": [{ "input": 3.5, "output": 14, "cache": { "read": 0.875 } }], "released": "2025-04-14" },
|
|
179
182
|
{ "providerID": "openai", "id": "gpt-4.1-mini", "prices": [{ "input": 0.4, "output": 1.6, "cache": { "read": 0.1 } }], "released": "2025-04-14" },
|
|
183
|
+
{ "providerID": "openai", "id": "gpt-4.1-mini-fast", "providers": ["openai"], "prices": [{ "input": 0.7, "output": 2.8, "cache": { "read": 0.175 } }], "released": "2025-04-14" },
|
|
180
184
|
{ "providerID": "openai", "id": "gpt-4.1-nano", "prices": [{ "input": 0.1, "output": 0.4, "cache": { "read": 0.025 } }], "released": "2025-04-14" },
|
|
185
|
+
{ "providerID": "openai", "id": "gpt-4.1-nano-fast", "providers": ["openai"], "prices": [{ "input": 0.2, "output": 0.8, "cache": { "read": 0.05 } }], "released": "2025-04-14" },
|
|
181
186
|
{ "providerID": "openai", "id": "gpt-4o", "prices": [{ "input": 2.5, "output": 10, "cache": { "read": 1.25 } }], "released": "2024-05-13" },
|
|
182
187
|
{ "providerID": "openai", "id": "gpt-4o-2024-05-13", "prices": [{ "input": 5, "output": 15 }], "released": "2024-05-13" },
|
|
188
|
+
{ "providerID": "openai", "id": "gpt-4o-2024-05-13-fast", "providers": ["openai"], "prices": [{ "input": 8.75, "output": 26.25 }], "released": "2024-05-13" },
|
|
183
189
|
{ "providerID": "openai", "id": "gpt-4o-2024-08-06", "prices": [{ "input": 2.5, "output": 10, "cache": { "read": 1.25 } }], "released": "2024-08-06" },
|
|
184
190
|
{ "providerID": "openai", "id": "gpt-4o-2024-11-20", "prices": [{ "input": 2.5, "output": 10, "cache": { "read": 1.25 } }], "released": "2024-11-20" },
|
|
191
|
+
{ "providerID": "openai", "id": "gpt-4o-fast", "providers": ["openai"], "prices": [{ "input": 4.25, "output": 17, "cache": { "read": 2.125 } }], "released": "2024-05-13" },
|
|
185
192
|
{ "providerID": "openai", "id": "gpt-4o-mini", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.075 } }], "released": "2024-07-18" },
|
|
193
|
+
{ "providerID": "openai", "id": "gpt-4o-mini-fast", "providers": ["openai"], "prices": [{ "input": 0.25, "output": 1, "cache": { "read": 0.125 } }], "released": "2024-07-18" },
|
|
186
194
|
{ "providerID": "openai", "id": "gpt-5", "prices": [{ "input": 1.25, "output": 10, "cache": { "read": 0.125 } }], "released": "2025-08-07" },
|
|
195
|
+
{ "providerID": "openai", "id": "gpt-5-fast", "providers": ["openai"], "prices": [{ "input": 2.5, "output": 20, "cache": { "read": 0.25 } }], "released": "2025-08-07" },
|
|
187
196
|
{ "providerID": "openai", "id": "gpt-5-mini", "prices": [{ "input": 0.25, "output": 2, "cache": { "read": 0.025 } }], "released": "2025-08-07" },
|
|
197
|
+
{ "providerID": "openai", "id": "gpt-5-mini-fast", "providers": ["openai"], "prices": [{ "input": 0.45, "output": 3.6, "cache": { "read": 0.045 } }], "released": "2025-08-07" },
|
|
188
198
|
{ "providerID": "openai", "id": "gpt-5-nano", "prices": [{ "input": 0.05, "output": 0.4, "cache": { "read": 0.005 } }], "released": "2025-08-07" },
|
|
189
199
|
{ "providerID": "openai", "id": "gpt-5-pro", "prices": [{ "input": 15, "output": 120 }], "released": "2025-10-06" },
|
|
190
200
|
{ "providerID": "openai", "id": "gpt-5.1", "prices": [{ "input": 1.25, "output": 10, "cache": { "read": 0.125 } }], "released": "2025-11-13" },
|
|
201
|
+
{ "providerID": "openai", "id": "gpt-5.1-fast", "providers": ["openai"], "prices": [{ "input": 2.5, "output": 20, "cache": { "read": 0.25 } }], "released": "2025-11-13" },
|
|
191
202
|
{ "providerID": "openai", "id": "gpt-5.2", "prices": [{ "input": 1.75, "output": 14, "cache": { "read": 0.175 } }], "released": "2025-12-11" },
|
|
192
203
|
{ "providerID": "openai", "id": "gpt-5.2-chat-latest", "prices": [{ "input": 1.75, "output": 14, "cache": { "read": 0.175 } }], "released": "2025-12-11" },
|
|
204
|
+
{ "providerID": "openai", "id": "gpt-5.2-fast", "providers": ["openai"], "prices": [{ "input": 3.5, "output": 28, "cache": { "read": 0.35 } }], "released": "2025-12-11" },
|
|
193
205
|
{ "providerID": "openai", "id": "gpt-5.2-pro", "prices": [{ "input": 21, "output": 168 }], "released": "2025-12-11" },
|
|
194
206
|
{ "providerID": "openai", "id": "gpt-5.3-chat-latest", "prices": [{ "input": 1.75, "output": 14, "cache": { "read": 0.175 } }], "released": "2026-03-03" },
|
|
195
207
|
{ "providerID": "openai", "id": "gpt-5.3-codex", "prices": [{ "input": 1.75, "output": 14, "cache": { "read": 0.175 } }], "released": "2026-02-05" },
|
|
208
|
+
{ "providerID": "openai", "id": "gpt-5.3-codex-fast", "providers": ["openai"], "prices": [{ "input": 3.5, "output": 28, "cache": { "read": 0.35 } }], "released": "2026-02-05" },
|
|
196
209
|
{ "providerID": "openai", "id": "gpt-5.3-codex-spark", "prices": [{ "input": 1.75, "output": 14, "cache": { "read": 0.175 } }], "released": "2026-02-05" },
|
|
197
210
|
{ "providerID": "openai", "id": "gpt-5.4", "prices": [{ "input": 2.5, "output": 15, "cache": { "read": 0.25 } }, { "input": 5, "output": 22.5, "cache": { "read": 0.5 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-03-05" },
|
|
198
211
|
{ "providerID": "openai", "id": "gpt-5.4-fast", "providers": ["openai"], "prices": [{ "input": 5, "output": 30, "cache": { "read": 0.5 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-03-05" },
|
|
@@ -217,14 +230,18 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
217
230
|
{ "providerID": "openai", "id": "gpt-6-luna-fast", "providers": ["openai"], "prices": [{ "input": 0.2, "output": 1, "cache": { "read": 0.02, "write": 0.25 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
218
231
|
{ "providerID": "openai", "id": "gpt-6-sol", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.2, "write": 2.5 } }, { "input": 4, "output": 15, "cache": { "read": 0.4, "write": 5 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
219
232
|
{ "providerID": "openai", "id": "gpt-6-sol-fast", "providers": ["openai"], "prices": [{ "input": 4, "output": 20, "cache": { "read": 0.4, "write": 5 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
233
|
+
{ "providerID": "openai", "id": "gpt-6.1-sol", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.1, "write": 2.5 } }, { "input": 4, "output": 15, "cache": { "read": 0.2, "write": 5 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-29" },
|
|
234
|
+
{ "providerID": "openai", "id": "gpt-6.1-sol-fast", "providers": ["openai"], "prices": [{ "input": 4, "output": 20, "cache": { "read": 0.2, "write": 5 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-29" },
|
|
220
235
|
{ "providerID": "openai", "id": "gpt-daybreak-blue-latest", "prices": [{ "input": 4, "output": 20, "cache": { "read": 0.4, "write": 5 } }, { "input": 8, "output": 30, "cache": { "read": 0.8, "write": 10 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-08-07" },
|
|
221
236
|
{ "providerID": "openai", "id": "gpt-daybreak-red-latest", "prices": [{ "input": 12.5, "output": 75, "cache": { "read": 1.25, "write": 15.625 } }], "released": "2026-08-07" },
|
|
222
237
|
{ "providerID": "openai", "id": "o1", "prices": [{ "input": 15, "output": 60, "cache": { "read": 7.5 } }], "released": "2024-12-05" },
|
|
223
238
|
{ "providerID": "openai", "id": "o1-pro", "prices": [{ "input": 150, "output": 600 }], "released": "2025-03-19" },
|
|
224
239
|
{ "providerID": "openai", "id": "o3", "prices": [{ "input": 2, "output": 8, "cache": { "read": 0.5 } }], "released": "2025-04-16" },
|
|
240
|
+
{ "providerID": "openai", "id": "o3-fast", "providers": ["openai"], "prices": [{ "input": 3.5, "output": 14, "cache": { "read": 0.875 } }], "released": "2025-04-16" },
|
|
225
241
|
{ "providerID": "openai", "id": "o3-mini", "prices": [{ "input": 1.1, "output": 4.4, "cache": { "read": 0.55 } }], "released": "2024-12-20" },
|
|
226
242
|
{ "providerID": "openai", "id": "o3-pro", "prices": [{ "input": 20, "output": 80 }], "released": "2025-06-10" },
|
|
227
243
|
{ "providerID": "openai", "id": "o4-mini", "prices": [{ "input": 1.1, "output": 4.4, "cache": { "read": 0.275 } }], "released": "2025-04-16" },
|
|
244
|
+
{ "providerID": "openai", "id": "o4-mini-fast", "providers": ["openai"], "prices": [{ "input": 2, "output": 8, "cache": { "read": 0.5 } }], "released": "2025-04-16" },
|
|
228
245
|
{ "providerID": "perplexity", "id": "sonar", "prices": [{ "input": 1, "output": 1 }], "released": "2024-01-01" },
|
|
229
246
|
{ "providerID": "perplexity", "id": "sonar-deep-research", "prices": [{ "input": 2, "output": 8, "reasoning": 3 }], "released": "2025-02-01" },
|
|
230
247
|
{ "providerID": "perplexity", "id": "sonar-pro", "prices": [{ "input": 3, "output": 15 }], "released": "2024-01-01" },
|
package/dist/pricing.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface OfficialPriceEntry {
|
|
|
14
14
|
/** Checked-in data: updating prices is explicit, not a network request at
|
|
15
15
|
* startup, during a refresh, or during an npm build. */
|
|
16
16
|
export declare const OFFICIAL_PRICE_SNAPSHOT: {
|
|
17
|
-
verified: "2026-
|
|
17
|
+
verified: "2026-10-02";
|
|
18
18
|
source: "https://models.dev/api.json";
|
|
19
19
|
entries: OfficialPriceEntry[];
|
|
20
20
|
};
|
package/docs/verification.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# 验证记录
|
|
2
2
|
|
|
3
|
+
## 2026-10-02 · smoke 宿主版本策略与兼容性
|
|
4
|
+
|
|
5
|
+
环境:macOS、Node.js v22.23.2、插件包 0.4.3。OpenCode SDK 仍精确锁定 2.0.11,未随本机 CLI 升级;本机默认宿主为 Homebrew 安装的 OpenCode 2.0.22。旧版基准使用校验 npm SHA-512 完整性的官方 `@opencode/cli-darwin-arm64@2.0.11` 独立二进制,没有降级或修改日常安装。
|
|
6
|
+
|
|
7
|
+
| 检查 | 结果 |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `npm run typecheck` | 通过 |
|
|
10
|
+
| `npm test` | 85 项通过,含 6 项 smoke 版本与二进制选择回归测试 |
|
|
11
|
+
| `npm run build` | 通过,两版 smoke 的 `npm pack` 均执行真实构建 |
|
|
12
|
+
| `npm run test:smoke`,默认宿主 2.0.22 | 完整通过 |
|
|
13
|
+
| `OPENCODE_BIN=… npm run test:smoke`,独立宿主 2.0.11 | 完整通过 |
|
|
14
|
+
|
|
15
|
+
版本检查不再把补丁版本列为白名单:允许稳定版 `>=2.0.9 <3.0.0` 运行实际集成检查。尚未与当前 SDK 验证的宿主会输出警告,但不被提前拒绝;当前已验证列表为 2.0.11、2.0.22。低于最低版本、其他主版本以及无法解析的稳定版输出仍会失败。版本检查通过本身不代表兼容性已验证。`OPENCODE_BIN` 统一用于版本探测、隔离服务端与 TUI;相对路径在切换到临时项目之前解析,结果文件记录实际宿主版本与所选二进制。
|
|
16
|
+
|
|
17
|
+
本轮保留全部原有 token、费用、上下文、布局、子代理、TPS 与 TTFT 断言,并修正测试夹具的时序:实时场景提供多段、300ms 间隔的模拟文本,避免短片段被宿主批处理合并或跨出 2s TPS 窗口;模拟流在 TUI 观察到实时指标后才结束。隔离 CLI 配置关闭持久标签页,避免不同 TUI 进程复用其他会话的焦点;详细模式滚动持续等待真实目标行可见,避免旧宿主在重新排版前处理 End。压缩模拟响应使用宿主要求的结构化摘要格式。现有 OpenCode 配置未修改,也未调用付费模型。
|
|
18
|
+
|
|
19
|
+
两版真实宿主新增验证:分叉为独立根,继承 assistant ID 保留 `_序号` 后缀;继承消息仍占被查看会话的 Context,但不重复累计用量或 Steps;分叉自己的调用单独计价。真实压缩投影为 `status === "completed"`,`order: "asc"` 的完整历史仍保留压缩前消息,压缩后没有新 assistant 时隐藏旧 Context,新消息恢复 Context,compaction 不计为 assistant step。原有全树 Total 5,080、成本 `$0.00504`、上下文上限 128,000 → 32,000 与原厂回退价 `$0.000149` 均保持通过。
|
|
20
|
+
|
|
21
|
+
验证产物:
|
|
22
|
+
- OpenCode 2.0.22:`/private/var/folders/rw/bmx6c8hd737brl55m0_ff_b80000gn/T/opencode/token-usage-smoke-93KAN2`。
|
|
23
|
+
- OpenCode 2.0.11:`/private/var/folders/rw/bmx6c8hd737brl55m0_ff_b80000gn/T/opencode/token-usage-smoke-p0SsRF`。
|
|
24
|
+
|
|
25
|
+
产物包含 `result.json`、终端捕获、已隐藏服务器密码的日志,以及流式事件、生成中的消息和压缩消息诊断文件。2.0.9、2.0.10 的历史记录保留在下方,本轮未重新执行这两个宿主;后续版本仍需实际运行 smoke,不能据版本范围宣称兼容。
|
|
26
|
+
|
|
3
27
|
## v0.4.3 开发验证(`/usage` 模型费率展示)
|
|
4
28
|
|
|
5
29
|
验证日期:2026-09-29。Node.js v22.23.2;SDK 2.0.11;真实宿主使用隔离的 `@opencode/cli-darwin-arm64@2.0.11`,包版本仍为 0.4.2。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenlongapps/opencode-token-usage",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Session-tree token usage, live performance, context window and estimated cost for OpenCode 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node scripts/build.mjs",
|
|
49
49
|
"typecheck": "tsc --noEmit",
|
|
50
|
-
"test": "tsx --test test/*.test.ts",
|
|
50
|
+
"test": "tsx --test test/*.test.ts test/*.test.mjs",
|
|
51
51
|
"test:smoke": "node scripts/smoke.mjs",
|
|
52
52
|
"prices:update": "tsx scripts/update-prices.ts",
|
|
53
53
|
"release:patch": "npm version patch",
|