opencode-model-price-intel 1.0.0 → 1.2.0
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 +50 -31
- package/package.json +13 -3
- package/src/aa-snapshot.ts +230 -154
- package/src/aa.ts +100 -45
- package/src/index.ts +22 -91
- package/src/pricing.ts +1 -2
- package/src/rpc.ts +65 -0
- package/src/table.ts +404 -0
- package/src/tui.tsx +207 -0
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# opencode-model-price-intel
|
|
2
2
|
|
|
3
3
|
[](https://github.com/chris15joseph/opencode-model-price-intel/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/opencode-model-price-intel)
|
|
4
5
|
[](LICENSE)
|
|
5
6
|
|
|
6
7
|
An OpenCode 2 plugin that puts **prices and the Artificial Analysis
|
|
7
|
-
Intelligence Index** next to every model in `/models`, and
|
|
8
|
-
`/model-pricing` table when you need the details.
|
|
8
|
+
Intelligence Index** next to every model in `/models`, and opens a full
|
|
9
|
+
`/model-pricing` table in a native TUI dialog when you need the details.
|
|
9
10
|
|
|
10
11
|
```text
|
|
11
12
|
/models
|
|
@@ -23,13 +24,6 @@ so the first `/models` render is instant and the network never blocks it.
|
|
|
23
24
|
Requires OpenCode 2.2.x (the plugin pins `@opencode/plugin` to `2.2.5`) and
|
|
24
25
|
Node.js 20 or newer.
|
|
25
26
|
|
|
26
|
-
> **npm status:** the package is staged but not yet published. Until it appears
|
|
27
|
-
> on npm, install from Git:
|
|
28
|
-
>
|
|
29
|
-
> ```sh
|
|
30
|
-
> opencode plugin add github:chris15joseph/opencode-model-price-intel
|
|
31
|
-
> ```
|
|
32
|
-
|
|
33
27
|
```sh
|
|
34
28
|
opencode plugin add opencode-model-price-intel
|
|
35
29
|
```
|
|
@@ -76,36 +70,57 @@ list the same plugin twice.
|
|
|
76
70
|
|
|
77
71
|
| Option | Default | Meaning |
|
|
78
72
|
| --- | --- | --- |
|
|
79
|
-
| `decorateNames` | `true` | Append the price/score summary to `/models` names. The `/model-pricing`
|
|
73
|
+
| `decorateNames` | `true` | Append the price/score summary to `/models` names. The `/model-pricing` dialog still works when this is off. |
|
|
80
74
|
| `costFormat` | `"detailed"` | `"detailed"` renders `in $2.5 out $15 · cache read $0.25 write $0`; `"compact"` renders `$2.5/$15/$0.25/$0`. |
|
|
81
|
-
| `aaApiKey` | unset | Artificial Analysis API key. Falls back to `ARTIFICIALANALYSIS_API_KEY`. Without either, the public
|
|
75
|
+
| `aaApiKey` | unset | Artificial Analysis API key. Falls back to `ARTIFICIALANALYSIS_API_KEY`. Without either, the public leaderboard page is used. |
|
|
82
76
|
| `refreshHours` | `12` | Score cache TTL and refresh interval, clamped to `1..596` hours. |
|
|
83
77
|
|
|
84
78
|
Invalid option values log one warning and fall back to the defaults.
|
|
85
79
|
|
|
86
|
-
##
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
Open the native model picker with `/models`. Each row's name carries the
|
|
83
|
+
one-line summary:
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
| `/prices` | Alias of `/model-pricing`. |
|
|
92
|
-
| `/models` | The native picker, now decorated with the one-line summary. |
|
|
85
|
+
```text
|
|
86
|
+
GPT 6 Astra · Turbo · in $2.5 out $15 · cache read $0.25 write $0 (2 tiers) · AA 56.9
|
|
87
|
+
```
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
Multi-tier models show the tier count; the `/models` row itself stays a single
|
|
90
|
+
line.
|
|
91
|
+
|
|
92
|
+
For the full table, run `/model-pricing` (or `/prices`). It opens a native TUI
|
|
93
|
+
dialog with an aligned, scrollable table of every provider, price tier, cache
|
|
94
|
+
price, and AA score. Click any column header to sort by it; click the same
|
|
95
|
+
header again to reverse the order. The active header shows `▲` (ascending) or
|
|
96
|
+
`▼` (descending), and multi-tier models stay together with their continuation
|
|
97
|
+
rows. The dialog can be dismissed with `Esc`, `Ctrl+C`, or a
|
|
98
|
+
click outside. The command handler is a toggle, so invoking it again while the
|
|
99
|
+
dialog is open closes it (the dialog is modal, so `Esc` is the usual path from
|
|
100
|
+
the prompt). The table is a TUI feature; the `/models` decoration is
|
|
101
|
+
server-side and works in every client.
|
|
102
|
+
|
|
103
|
+
The TUI part asks the server for structured rows over RPC, so the dialog uses
|
|
104
|
+
the same live registry and score cache as `/models`. It does not send a prompt
|
|
105
|
+
or make a model call. The table is laid out for the current terminal width and
|
|
106
|
+
scrolls vertically (and horizontally when the window is narrow).
|
|
96
107
|
|
|
97
108
|
## How it works
|
|
98
109
|
|
|
99
110
|
- Prices come from `Model.Info.cost` in the live OpenCode registry. The plugin
|
|
100
111
|
does not bundle a price table and does not convert currencies.
|
|
101
112
|
- Scores are fetched from the Artificial Analysis Free Data API when a key is
|
|
102
|
-
configured, otherwise from the public
|
|
103
|
-
|
|
113
|
+
configured, otherwise from the public leaderboard page. The index version
|
|
114
|
+
(including patch releases such as v5.0.1) is read from the live payload, so
|
|
115
|
+
new releases are adopted automatically.
|
|
116
|
+
- A bundled v5.0.1 snapshot (captured 2026-11-14) is registered before any
|
|
104
117
|
network or storage work, so the first render is immediate. It is only merged
|
|
105
|
-
with live data from the same
|
|
118
|
+
with live data from the exact same index version.
|
|
106
119
|
- The last good result is cached in OpenCode plugin storage for `refreshHours`.
|
|
107
120
|
A cache older than 30 days is ignored.
|
|
108
121
|
- The model registry reloads only when the score data actually changes.
|
|
122
|
+
- The TUI part is registered through the package's `./tui` export and fetches
|
|
123
|
+
the table through the server-side RPC in `./rpc`.
|
|
109
124
|
- Unscored models show `AA n/a`. A model with no registry cost shows
|
|
110
125
|
`pricing n/a` (or `n/a` in compact mode).
|
|
111
126
|
|
|
@@ -115,10 +130,12 @@ models get one row per price entry (`base`, then `>N` for context overrides).
|
|
|
115
130
|
the model **name**. Set `decorateNames: false` to leave names untouched.
|
|
116
131
|
- Prices are catalog prices, not your invoice. Providers can add surcharges,
|
|
117
132
|
discounts, or regional pricing that the registry does not carry.
|
|
118
|
-
- AA scores are comparative within one index
|
|
119
|
-
|
|
120
|
-
- The plugin only decorates the list and
|
|
121
|
-
requests or change model selection.
|
|
133
|
+
- AA scores are comparative within one index version. The plugin never mixes
|
|
134
|
+
scores from different versions, including patch releases.
|
|
135
|
+
- The plugin only decorates the model list and renders the pricing dialog. It
|
|
136
|
+
does not route requests or change model selection.
|
|
137
|
+
- The `/model-pricing` dialog requires the TUI. Other clients still get the
|
|
138
|
+
`/models` decoration.
|
|
122
139
|
|
|
123
140
|
## Development
|
|
124
141
|
|
|
@@ -131,16 +148,18 @@ npm test
|
|
|
131
148
|
npm pack --dry-run
|
|
132
149
|
```
|
|
133
150
|
|
|
134
|
-
The package exports raw TypeScript (`src/index.ts`
|
|
135
|
-
it at load. Plain Node cannot import
|
|
151
|
+
The package exports raw TypeScript (`src/index.ts`, `src/rpc.ts`, and
|
|
152
|
+
`src/tui.tsx`); OpenCode 2.2.x transpiles it at load. Plain Node cannot import
|
|
153
|
+
the installed package from `node_modules`. The TUI part uses the host's
|
|
154
|
+
`@opentui` packages, declared as peer dependencies.
|
|
136
155
|
|
|
137
156
|
## Attribution
|
|
138
157
|
|
|
139
158
|
Scores and related model data are produced by
|
|
140
159
|
[Artificial Analysis](https://artificialanalysis.ai/). The `/model-pricing`
|
|
141
|
-
|
|
142
|
-
link. See [`NOTICE`](NOTICE) and [`SNAPSHOT-NOTICE.md`](SNAPSHOT-NOTICE.md)
|
|
143
|
-
provenance.
|
|
160
|
+
dialog carries the source, index version, capture/fetch date, and attribution
|
|
161
|
+
link. See [`NOTICE`](NOTICE) and [`SNAPSHOT-NOTICE.md`](SNAPSHOT-NOTICE.md)
|
|
162
|
+
for further provenance.
|
|
144
163
|
|
|
145
164
|
## License
|
|
146
165
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-model-price-intel",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "OpenCode 2 plugin that adds input/output/cache prices and Artificial Analysis Intelligence Index scores to /models, plus a full /model-pricing
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "OpenCode 2 plugin that adds input/output/cache prices and Artificial Analysis Intelligence Index scores to /models, plus a full /model-pricing TUI dialog.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./src/index.ts"
|
|
7
|
+
".": "./src/index.ts",
|
|
8
|
+
"./rpc": "./src/rpc.ts",
|
|
9
|
+
"./tui": "./src/tui.tsx"
|
|
8
10
|
},
|
|
9
11
|
"types": "./src/index.ts",
|
|
10
12
|
"files": [
|
|
@@ -19,8 +21,16 @@
|
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@opencode/plugin": "2.2.5"
|
|
21
23
|
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@opentui/core": ">=0.6.6",
|
|
26
|
+
"@opentui/solid": ">=0.6.6",
|
|
27
|
+
"solid-js": ">=1.9.0"
|
|
28
|
+
},
|
|
22
29
|
"devDependencies": {
|
|
30
|
+
"@opentui/core": "^0.8.3",
|
|
31
|
+
"@opentui/solid": "^0.8.3",
|
|
23
32
|
"@types/node": "22.20.5",
|
|
33
|
+
"solid-js": "^1.9.18",
|
|
24
34
|
"typescript": "5.9.3"
|
|
25
35
|
},
|
|
26
36
|
"scripts": {
|