opencode-plugin-model-cost 1.0.0 → 1.0.1
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 +2 -2
- package/dist/tui.js +9 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenCode Model Cost
|
|
2
2
|
|
|
3
|
-
An OpenCode TUI plugin that
|
|
3
|
+
An OpenCode TUI plugin that appends the selected model's input and output prices to the prompt status line. The compact display is formatted as `($0.10/$0.50)`; prices come from OpenCode's model catalog and are in USD per million tokens. If a model exposes tiered pricing without a standard rate, the plugin displays `tiered pricing`.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ After publishing the package to npm, add it to the `plugins` array in your OpenC
|
|
|
8
8
|
|
|
9
9
|
```jsonc
|
|
10
10
|
{
|
|
11
|
-
"plugins": ["opencode-plugin-model-cost@1.0.
|
|
11
|
+
"plugins": ["opencode-plugin-model-cost@1.0.1"]
|
|
12
12
|
}
|
|
13
13
|
```
|
|
14
14
|
|
package/dist/tui.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { insert as _$insert } from "@opentui/solid";
|
|
1
2
|
import { createTextNode as _$createTextNode } from "@opentui/solid";
|
|
2
3
|
import { insertNode as _$insertNode } from "@opentui/solid";
|
|
3
|
-
import { insert as _$insert } from "@opentui/solid";
|
|
4
|
-
import { memo as _$memo } from "@opentui/solid";
|
|
5
|
-
import { setProp as _$setProp } from "@opentui/solid";
|
|
6
4
|
import { createElement as _$createElement } from "@opentui/solid";
|
|
7
5
|
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
8
6
|
/** @jsxImportSource @opentui/solid */
|
|
@@ -12,7 +10,7 @@ export default Plugin.define({
|
|
|
12
10
|
id: "model-cost",
|
|
13
11
|
setup(ctx) {
|
|
14
12
|
return ctx.ui.slot({
|
|
15
|
-
append: "prompt.footer",
|
|
13
|
+
append: "prompt.footer.status",
|
|
16
14
|
render: input => {
|
|
17
15
|
const location = () => (input.sessionID ? ctx.data.session.get(input.sessionID)?.location : undefined) ?? ctx.location ?? ctx.data.location.default();
|
|
18
16
|
createEffect(() => {
|
|
@@ -36,7 +34,7 @@ export default Plugin.define({
|
|
|
36
34
|
minimumFractionDigits: 2,
|
|
37
35
|
maximumFractionDigits: 6
|
|
38
36
|
}).format(price);
|
|
39
|
-
return `${formatPrice(standardCost.input)}/${formatPrice(standardCost.output)}
|
|
37
|
+
return `${formatPrice(standardCost.input)}/${formatPrice(standardCost.output)}`;
|
|
40
38
|
}
|
|
41
39
|
return costs.length > 0 ? "tiered pricing" : "pricing unavailable";
|
|
42
40
|
};
|
|
@@ -44,17 +42,13 @@ export default Plugin.define({
|
|
|
44
42
|
get when() {
|
|
45
43
|
return selectedModel();
|
|
46
44
|
},
|
|
47
|
-
children:
|
|
48
|
-
var _el$ = _$createElement("
|
|
49
|
-
_el$2 = _$
|
|
50
|
-
_el$3 = _$createTextNode(`
|
|
51
|
-
_el$4 = _$createTextNode(`)`);
|
|
45
|
+
children: () => (() => {
|
|
46
|
+
var _el$ = _$createElement("text"),
|
|
47
|
+
_el$2 = _$createTextNode(` (`),
|
|
48
|
+
_el$3 = _$createTextNode(`)`);
|
|
52
49
|
_$insertNode(_el$, _el$2);
|
|
53
|
-
_$
|
|
54
|
-
_$
|
|
55
|
-
_$insertNode(_el$2, _el$4);
|
|
56
|
-
_$insert(_el$2, () => modelInfo()?.name ?? selected().modelID, _el$3);
|
|
57
|
-
_$insert(_el$2, pricing, _el$4);
|
|
50
|
+
_$insertNode(_el$, _el$3);
|
|
51
|
+
_$insert(_el$, pricing, _el$3);
|
|
58
52
|
return _el$;
|
|
59
53
|
})()
|
|
60
54
|
});
|