opencode-model-price-intel 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/NOTICE +37 -0
- package/README.md +146 -2
- package/package.json +53 -4
- package/src/aa-snapshot.ts +515 -0
- package/src/aa.ts +911 -0
- package/src/index.ts +480 -0
- package/src/pricing.ts +143 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christopher Joseph
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
NOTICE
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
Artificial Analysis data
|
|
5
|
+
------------------------
|
|
6
|
+
|
|
7
|
+
This package bundles a fallback snapshot of the Artificial Analysis Intelligence
|
|
8
|
+
Index (v5.0) captured on 2026-10-31 from the public model pages at:
|
|
9
|
+
|
|
10
|
+
https://artificialanalysis.ai/
|
|
11
|
+
|
|
12
|
+
At runtime the plugin prefers live data from the Artificial Analysis Data API
|
|
13
|
+
(when a key is configured) or the public Artificial Analysis pages. The bundled
|
|
14
|
+
snapshot is used only when live data and the plugin cache are unavailable.
|
|
15
|
+
|
|
16
|
+
Intelligence Index scores and related model data are produced by Artificial
|
|
17
|
+
Analysis. Attribution is provided in the plugin output and in this NOTICE.
|
|
18
|
+
Use of Artificial Analysis data is subject to their terms:
|
|
19
|
+
|
|
20
|
+
https://artificialanalysis.ai/terms
|
|
21
|
+
|
|
22
|
+
The snapshot is derived data and is not a substitute for the live Artificial
|
|
23
|
+
Analysis service. Do not remove this NOTICE or the attribution when
|
|
24
|
+
redistributing the package.
|
|
25
|
+
|
|
26
|
+
Some source comments in `src/aa-snapshot.ts` record that individual scores were
|
|
27
|
+
cross-checked against a third-party "llmcompare snapshot 2026-10-12". Those
|
|
28
|
+
comments are retained for provenance/traceability only; the authoritative
|
|
29
|
+
source and attribution for the bundled Intelligence Index data remains
|
|
30
|
+
Artificial Analysis.
|
|
31
|
+
|
|
32
|
+
Test fixtures
|
|
33
|
+
-------------
|
|
34
|
+
|
|
35
|
+
`test/fixtures/aa-payload.txt` is a capture of public Artificial Analysis model
|
|
36
|
+
data used only by the repository test suite. Fixtures are not included in the
|
|
37
|
+
published npm package. See `test/fixtures/README.md` for capture details.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# opencode-model-price-intel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/chris15joseph/opencode-model-price-intel/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
An OpenCode 2 plugin that puts **prices and the Artificial Analysis
|
|
7
|
+
Intelligence Index** next to every model in `/models`, and adds a full
|
|
8
|
+
`/model-pricing` table when you need the details.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
/models
|
|
12
|
+
GPT 6 Astra · in $2.5 out $15 · cache read $0.25 write $0 (2 tiers) · AA 56.9
|
|
13
|
+
Kimi K3 · in $3 out $15 · cache read $0.3 write $3 · AA n/a
|
|
14
|
+
Big Pickle · free · AA n/a
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Prices are USD per 1M tokens, read from the live OpenCode model registry. Scores
|
|
18
|
+
come from Artificial Analysis and refresh in the background. Scores are cached,
|
|
19
|
+
so the first `/models` render is instant and the network never blocks it.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
Requires OpenCode 2.2.x (the plugin pins `@opencode/plugin` to `2.2.5`) and
|
|
24
|
+
Node.js 20 or newer.
|
|
25
|
+
|
|
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
|
+
```sh
|
|
34
|
+
opencode plugin add opencode-model-price-intel
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or add it to `opencode.json(c)` yourself:
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
{
|
|
41
|
+
"$schema": "https://opencode.ai/config.json",
|
|
42
|
+
"plugins": ["opencode-model-price-intel"]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Local checkout:
|
|
47
|
+
|
|
48
|
+
```jsonc
|
|
49
|
+
{
|
|
50
|
+
"$schema": "https://opencode.ai/config.json",
|
|
51
|
+
"plugins": ["/absolute/path/to/opencode-model-price-intel"]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A plugin directory under `.opencode/plugins/` also loads automatically. Do not
|
|
56
|
+
list the same plugin twice.
|
|
57
|
+
|
|
58
|
+
### Options
|
|
59
|
+
|
|
60
|
+
```jsonc
|
|
61
|
+
{
|
|
62
|
+
"$schema": "https://opencode.ai/config.json",
|
|
63
|
+
"plugins": [
|
|
64
|
+
{
|
|
65
|
+
"package": "opencode-model-price-intel",
|
|
66
|
+
"options": {
|
|
67
|
+
"decorateNames": true,
|
|
68
|
+
"costFormat": "compact",
|
|
69
|
+
"aaApiKey": "{env:ARTIFICIALANALYSIS_API_KEY}",
|
|
70
|
+
"refreshHours": 12
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Option | Default | Meaning |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| `decorateNames` | `true` | Append the price/score summary to `/models` names. The `/model-pricing` table still works when this is off. |
|
|
80
|
+
| `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 model-list page is used. |
|
|
82
|
+
| `refreshHours` | `12` | Score cache TTL and refresh interval, clamped to `1..596` hours. |
|
|
83
|
+
|
|
84
|
+
Invalid option values log one warning and fall back to the defaults.
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
| Command | What it does |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `/model-pricing` | Prints a Markdown table with every model, provider, price tier, cache price, and AA score. |
|
|
91
|
+
| `/prices` | Alias of `/model-pricing`. |
|
|
92
|
+
| `/models` | The native picker, now decorated with the one-line summary. |
|
|
93
|
+
|
|
94
|
+
The table is a synthetic session message; no model call is made. Multi-tier
|
|
95
|
+
models get one row per price entry (`base`, then `>N` for context overrides).
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
- Prices come from `Model.Info.cost` in the live OpenCode registry. The plugin
|
|
100
|
+
does not bundle a price table and does not convert currencies.
|
|
101
|
+
- Scores are fetched from the Artificial Analysis Free Data API when a key is
|
|
102
|
+
configured, otherwise from the public model-list page.
|
|
103
|
+
- A bundled v5.0 snapshot (captured 2026-10-31) is registered before any
|
|
104
|
+
network or storage work, so the first render is immediate. It is only merged
|
|
105
|
+
with live data from the same **major** index version.
|
|
106
|
+
- The last good result is cached in OpenCode plugin storage for `refreshHours`.
|
|
107
|
+
A cache older than 30 days is ignored.
|
|
108
|
+
- The model registry reloads only when the score data actually changes.
|
|
109
|
+
- Unscored models show `AA n/a`. A model with no registry cost shows
|
|
110
|
+
`pricing n/a` (or `n/a` in compact mode).
|
|
111
|
+
|
|
112
|
+
## Limitations
|
|
113
|
+
|
|
114
|
+
- The built-in picker has no plugin column API, so the summary is appended to
|
|
115
|
+
the model **name**. Set `decorateNames: false` to leave names untouched.
|
|
116
|
+
- Prices are catalog prices, not your invoice. Providers can add surcharges,
|
|
117
|
+
discounts, or regional pricing that the registry does not carry.
|
|
118
|
+
- AA scores are comparative within one index major version. The plugin never
|
|
119
|
+
mixes a v5 snapshot into a v6 result.
|
|
120
|
+
- The plugin only decorates the list and prints a table. It does not route
|
|
121
|
+
requests or change model selection.
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
Requires Node.js 20 or newer.
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
npm ci
|
|
129
|
+
npm run typecheck
|
|
130
|
+
npm test
|
|
131
|
+
npm pack --dry-run
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The package exports raw TypeScript (`src/index.ts`); OpenCode 2.2.x transpiles
|
|
135
|
+
it at load. Plain Node cannot import the installed package from `node_modules`.
|
|
136
|
+
|
|
137
|
+
## Attribution
|
|
138
|
+
|
|
139
|
+
Scores and related model data are produced by
|
|
140
|
+
[Artificial Analysis](https://artificialanalysis.ai/). The `/model-pricing`
|
|
141
|
+
header carries the source, index version, capture/fetch date, and attribution
|
|
142
|
+
link. See [`NOTICE`](NOTICE) and [`SNAPSHOT-NOTICE.md`](SNAPSHOT-NOTICE.md) for
|
|
143
|
+
provenance.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT. See [LICENSE](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-model-price-intel",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.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 table.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"types": "./src/index.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"NOTICE"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@opencode/plugin": "2.2.5"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "22.20.5",
|
|
24
|
+
"typescript": "5.9.3"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "node --import ./scripts/register-ts.mjs --test test/*.test.ts",
|
|
29
|
+
"prepublishOnly": "npm run typecheck && npm test"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/chris15joseph/opencode-model-price-intel.git"
|
|
34
|
+
},
|
|
35
|
+
"author": "Christopher Joseph <chrisjoseph15496@gmail.com>",
|
|
36
|
+
"homepage": "https://github.com/chris15joseph/opencode-model-price-intel#readme",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/chris15joseph/opencode-model-price-intel/issues"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"opencode",
|
|
45
|
+
"opencode-plugin",
|
|
46
|
+
"pricing",
|
|
47
|
+
"model-pricing",
|
|
48
|
+
"model-cost",
|
|
49
|
+
"artificial-analysis",
|
|
50
|
+
"intelligence-index",
|
|
51
|
+
"llm",
|
|
52
|
+
"cost"
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|