dsh-session-fee 0.4.3 → 0.4.5
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/PRICES.md +4 -3
- package/README.md +6 -6
- package/client.js +6 -6
- package/cordis.patch.yml +1 -1
- package/index.js +5 -5
- package/lib/config.js +1 -1
- package/lib/pricing.js +1 -1
- package/lib/projection.js +1 -1
- package/package.json +3 -3
- package/prices.json +9 -2
package/PRICES.md
CHANGED
|
@@ -17,17 +17,18 @@
|
|
|
17
17
|
| DeepSeek-V4.1-Flash 闲时 | Qoder `dfmodel`、任意 `deepseek-flash` / `deepseek-v4.1-flash` | 1 | 0.02 | 0 | 4 |
|
|
18
18
|
| DeepSeek-V4-Pro 闲时 | Qoder `dmodel`、任意 `deepseek-v4-pro` | 4.5 | 0.15 | 0 | 13.5 |
|
|
19
19
|
| Kimi-K3.1-Pro | Qoder `kmodel_latest`、任意 `kimi-k3.1-pro` | 13 | 1.3 | 13 | 68 |
|
|
20
|
-
| Kimi-K3 | 任意 `kimi-k3` | 20 | 2 | 20 | 100 |
|
|
20
|
+
| Kimi-K3 | 任意 `kimi-k3`、`kimi-k3-1` | 20 | 2 | 20 | 100 |
|
|
21
21
|
| Kimi-K2.8-Preview | Qoder `kmodel`、任意 `kimi-k2.8-preview` | 6.5 | 1.3 | 0 | 27 |
|
|
22
22
|
| GLM-5.3 | Qoder `gmodel`、任意 `glm-5.3` | 8 | 2 | 0 | 28 |
|
|
23
23
|
| GLM-5.3-Flash | Qoder `gfmodel`、任意 `glm-5.3-flash` | 0.8 | 0.23 | 0 | 2.8 |
|
|
24
24
|
| Qwen3.8-Max | Qoder `qmodel_38max`、任意 `qwen3.8-max` | 12 | 1.5 | 0 | 36 |
|
|
25
25
|
| Qwen3.8-Flash | Qoder `qfmodel`、任意 `qwen3.8-flash` | 1 | 0.1 | 0 | 3 |
|
|
26
|
+
| Qwen3.8-27B | 任意 `qwen3.8-27b` | 3 | 0.6 | 0 | 12 |
|
|
26
27
|
| MiniMax-M3.1-Flash | Qoder `mmodel`、任意 `minimax-m3.1-flash` | 1 | 0.1 | 0 | 4 |
|
|
27
28
|
| Step-5-Preview | Qoder `jmodel`、任意 `step-5-preview` | 7 | 0.35 | 7 | 20 |
|
|
28
29
|
| MiMo-V2.6-Pro | 任意 `mimo-v2.6-pro` | 3 | 0.025 | 0 | 6 |
|
|
29
30
|
| MiMo-V2.6-Flash | 任意 `mimo-v2.6-flash` | 1 | 0.02 | 0 | 2 |
|
|
30
|
-
| Hy4(腾讯混元 4) | 任意 `hy4-preview`、`hy4` | 6 | 0.3 | 0 | 18 |
|
|
31
|
+
| Hy4(腾讯混元 4) | 任意 `hy4-preview`、`hy4`、`hy4std` | 6 | 0.3 | 0 | 18 |
|
|
31
32
|
|
|
32
33
|
Qoder(经 [dsh-provider-qoder](https://www.npmjs.com/package/dsh-provider-qoder) 接入,中国区)内部代号与模型名的对应取自 Qoder 的模型目录接口。Qoder 的 Auto、Fast 是路由,没有市面价,不写。
|
|
33
34
|
|
|
@@ -76,4 +77,4 @@ Qoder(经 [dsh-provider-qoder](https://www.npmjs.com/package/dsh-provider-qode
|
|
|
76
77
|
- [Gemini 4 Argon on Google Cloud](https://cloud.google.com/blog/products/ai-machine-learning/gemini-4-argon-available-on-google-cloud)
|
|
77
78
|
- [Moonshot 模型推理价格](https://platform.kimi.com/docs/pricing/chat)、[阿里云 Qwen3.8-Max](https://help.aliyun.com/zh/model-studio/qwen3-8-max)
|
|
78
79
|
|
|
79
|
-
修改 `prices.json` 并保存即可,立即生效;校验失败的文件不会替换上一份有效价格(错误写进 DSH 数据目录下的 `plugins/session-
|
|
80
|
+
修改 `prices.json` 并保存即可,立即生效;校验失败的文件不会替换上一份有效价格(错误写进 DSH 数据目录下的 `plugins/session-fee/status.json`)。
|
package/README.md
CHANGED
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
桌面版「插件」→「添加插件」,粘贴:
|
|
18
18
|
|
|
19
19
|
```text
|
|
20
|
-
git+https://github.com/fujingzhai/youxia-dsh-plugins.git#dsh-session-
|
|
20
|
+
git+https://github.com/fujingzhai/youxia-dsh-plugins.git#dsh-session-fee@0.4.5&path:/dsh-session-fee
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
或用命令行(Web 版将 `desktop` 换成 `web`):
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
dsh plugin --profile desktop add "git+https://github.com/fujingzhai/youxia-dsh-plugins.git#dsh-session-
|
|
26
|
+
dsh plugin --profile desktop add "git+https://github.com/fujingzhai/youxia-dsh-plugins.git#dsh-session-fee@0.4.5&path:/dsh-session-fee"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
若终端找不到 `dsh`,macOS 官方桌面版可用 `"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh"` 替代命令名。也可参照[仓库首页](../README.md)克隆后安装本子目录。
|
|
30
30
|
|
|
31
|
-
连不上 GitHub 时填 npm 包名 `dsh-session-fee`。不要填 `dsh-session-cost
|
|
31
|
+
连不上 GitHub 时填 npm 包名 `dsh-session-fee`。不要填 `dsh-session-cost`,那是别人的包。已安装旧目录或旧包名的,先卸载再装这一版。
|
|
32
32
|
|
|
33
33
|
安装后重启 DSH。有 token 用量的会话,会在统计条的用时、用量两项之后显示费用。版本更新与卸载见[仓库首页](../README.md)。
|
|
34
34
|
|
|
@@ -39,7 +39,7 @@ dsh plugin --profile desktop add "git+https://github.com/fujingzhai/youxia-dsh-p
|
|
|
39
39
|
- **要自己改价或加模型**:把 `prices.json` 复制到自己的目录,在 DSH profile 的 `cordis.patch.yml` 里指过去(文件里若只有一行 `[]`,先删掉它);这份文件不会被插件更新覆盖,保存即生效:
|
|
40
40
|
|
|
41
41
|
```yaml
|
|
42
|
-
- id: session-
|
|
42
|
+
- id: session-fee
|
|
43
43
|
name: dsh-session-fee
|
|
44
44
|
config:
|
|
45
45
|
priceBook: /你的目录/prices.json
|
|
@@ -55,7 +55,7 @@ dsh plugin --profile desktop add "git+https://github.com/fujingzhai/youxia-dsh-p
|
|
|
55
55
|
| profile 补丁里的插件配置 | DSH 约 2 秒后重新组合 | 不用 |
|
|
56
56
|
| 插件代码 | 下一次重新组合时换上:改一下补丁、在插件页开关一次插件,或重启 | 不必 |
|
|
57
57
|
|
|
58
|
-
金额在每次模型调用结束、拿到用量后更新,不在流式输出中途估算。价格表写坏或校验失败时保留上一份有效价格。每次加载结果(价格表条数、目录来源与版本、最近错误)写在 DSH 数据目录(默认 `~/.dsh`)下的 `plugins/session-
|
|
58
|
+
金额在每次模型调用结束、拿到用量后更新,不在流式输出中途估算。价格表写坏或校验失败时保留上一份有效价格。每次加载结果(价格表条数、目录来源与版本、最近错误)写在 DSH 数据目录(默认 `~/.dsh`)下的 `plugins/session-fee/status.json`,排查用。
|
|
59
59
|
|
|
60
60
|
## 配置参考
|
|
61
61
|
|
|
@@ -150,7 +150,7 @@ dsh plugin --profile desktop add "git+https://github.com/fujingzhai/youxia-dsh-p
|
|
|
150
150
|
插件配置写在 DSH profile 的 `cordis.patch.yml`(文件里若只有一行 `[]`,先删掉它),都可省略:
|
|
151
151
|
|
|
152
152
|
```yaml
|
|
153
|
-
- id: session-
|
|
153
|
+
- id: session-fee
|
|
154
154
|
name: dsh-session-fee
|
|
155
155
|
config:
|
|
156
156
|
priceBook: /你的目录/prices.json # 自己维护的价格表
|
package/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({
|
|
2
|
-
id: "dsh-session-
|
|
2
|
+
id: "dsh-session-fee",
|
|
3
3
|
factory(require) {
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const ReactDOM = require("react-dom");
|
|
6
6
|
const h = React.createElement;
|
|
7
|
-
const NS = "session-
|
|
7
|
+
const NS = "session-fee";
|
|
8
8
|
const CURRENCY_SYMBOLS = {
|
|
9
9
|
CNY: "¥",
|
|
10
10
|
USD: "$",
|
|
@@ -43,7 +43,7 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
"cost.none": "no model calls"
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const css = ".dshsc_anchor{min-width:0;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));display:inline-flex}.dshsc_pill{box-sizing:border-box;border-radius:var(--dsw-radius-sm);max-width:min(460px,42vw);color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;background:0 0;border:none;cursor:pointer;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.dshsc_pill:hover,.dshsc_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.dshsc_pill svg{flex:none;width:14px;height:14px}.dshsc_label{text-overflow:ellipsis;min-width:0;overflow:hidden}[data-composer-dock]>span{order:1}[data-composer-dock] [data-composer-stat=cost]{order:2}.dshsc_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:max-content;min-width:min(300px,100vw - 24px);max-width:min(440px,100vw - 24px);max-height:min(70vh,560px);overflow:auto;backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:16px;font-size:12px;line-height:18px;position:fixed}.dshsc_title{color:var(--dsw-alias-label-primary);justify-content:space-between;gap:16px;margin-bottom:8px;font-weight:500;display:flex}.dshsc_titleLabel{align-items:center;gap:6px;min-width:0;display:inline-flex}.dshsc_titleLabel svg{flex:none;width:14px;height:14px}.dshsc_titleValue{font-variant-numeric:tabular-nums;text-align:right}.dshsc_rule{border-top:.5px solid var(--dsw-alias-border-l2);margin:10px 0}.dshsc_rule:first-child{margin-top:0}.dshsc_details{color:var(--dsw-alias-label-tertiary);grid-template-columns:minmax(76px,
|
|
46
|
+
const css = ".dshsc_anchor{min-width:0;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));display:inline-flex}.dshsc_pill{box-sizing:border-box;border-radius:var(--dsw-radius-sm);max-width:min(460px,42vw);color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;background:0 0;border:none;cursor:pointer;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.dshsc_pill:hover,.dshsc_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.dshsc_pill svg{flex:none;width:14px;height:14px}.dshsc_label{text-overflow:ellipsis;min-width:0;overflow:hidden}[data-composer-dock]>span{order:1}[data-composer-dock] [data-composer-stat=cost]{order:2}.dshsc_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:max-content;min-width:min(300px,100vw - 24px);max-width:min(440px,100vw - 24px);max-height:min(70vh,560px);overflow:auto;backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:16px;font-size:12px;line-height:18px;position:fixed}.dshsc_title{color:var(--dsw-alias-label-primary);justify-content:space-between;gap:16px;margin-bottom:8px;font-weight:500;display:flex}.dshsc_titleLabel{align-items:center;gap:6px;min-width:0;display:inline-flex}.dshsc_titleLabel svg{flex:none;width:14px;height:14px}.dshsc_titleValue{font-variant-numeric:tabular-nums;text-align:right}.dshsc_rule{border-top:.5px solid var(--dsw-alias-border-l2);margin:10px 0}.dshsc_rule:first-child{margin-top:0}.dshsc_details{color:var(--dsw-alias-label-tertiary);grid-template-columns:minmax(76px,1fr) max-content;gap:6px 16px;margin:0;display:grid}.dshsc_details dt,.dshsc_details dd{min-width:0;margin:0}.dshsc_details dt{overflow-wrap:anywhere}.dshsc_details dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap}.dshsc_meta{grid-column:1/-1;overflow-wrap:anywhere;margin-top:-4px;color:var(--dsw-alias-label-tertiary);opacity:.85}.dshsc_details .dshsc_route{margin-top:-4px;color:var(--dsw-alias-label-tertiary);opacity:.85}.dshsc_details .dshsc_spaced{margin-top:6px}.dshsc_strong{color:var(--dsw-alias-label-secondary)}";
|
|
47
47
|
|
|
48
48
|
function decimal(amount) {
|
|
49
49
|
const maximumFractionDigits = amount > 0 && amount < 0.01 ? 6 : 4;
|
|
@@ -352,15 +352,15 @@ window.__ModuleLoader__.load({
|
|
|
352
352
|
return {
|
|
353
353
|
inject: ["slots", "locale", "sessions"],
|
|
354
354
|
apply(ctx) {
|
|
355
|
-
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-session-
|
|
355
|
+
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-session-fee: dictionaries");
|
|
356
356
|
ctx.effect(() => {
|
|
357
357
|
if (typeof document === "undefined") return void 0;
|
|
358
358
|
const style = document.createElement("style");
|
|
359
|
-
style.dataset.plugin = "dsh-session-
|
|
359
|
+
style.dataset.plugin = "dsh-session-fee";
|
|
360
360
|
style.textContent = css;
|
|
361
361
|
document.head.appendChild(style);
|
|
362
362
|
return () => style.remove();
|
|
363
|
-
}, "dsh-session-
|
|
363
|
+
}, "dsh-session-fee: styles");
|
|
364
364
|
const actions = () => ({
|
|
365
365
|
refreshProjections(sessionId) {
|
|
366
366
|
return ctx.sessions.refreshProjections(sessionId);
|
package/cordis.patch.yml
CHANGED
package/index.js
CHANGED
|
@@ -8,14 +8,14 @@ import { createPricer, normalizePriceBook } from "./lib/pricing.js";
|
|
|
8
8
|
import { createSessionCostProjection } from "./lib/projection.js";
|
|
9
9
|
import { watchPriceBook } from "./lib/reload.js";
|
|
10
10
|
|
|
11
|
-
export const name = "session-
|
|
11
|
+
export const name = "session-fee";
|
|
12
12
|
export const inject = ["sessionProjections"];
|
|
13
13
|
|
|
14
14
|
export { Config };
|
|
15
15
|
|
|
16
16
|
const packageDirectory = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
const { name: packageName, version: packageVersion } = JSON.parse(readFileSync(join(packageDirectory, "package.json"), "utf8"));
|
|
18
|
-
const statusPath = join(process.env.DSH_HOME || join(homedir(), ".dsh"), "plugins", "session-
|
|
18
|
+
const statusPath = join(process.env.DSH_HOME || join(homedir(), ".dsh"), "plugins", "session-fee", "status.json");
|
|
19
19
|
|
|
20
20
|
function freeze(value) {
|
|
21
21
|
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
@@ -29,7 +29,7 @@ export function loadPriceBook(path) {
|
|
|
29
29
|
try {
|
|
30
30
|
json = JSON.parse(source);
|
|
31
31
|
} catch (error) {
|
|
32
|
-
throw new Error(`Unable to parse session-
|
|
32
|
+
throw new Error(`Unable to parse session-fee price book ${path}: ${error.message}`, { cause: error });
|
|
33
33
|
}
|
|
34
34
|
return freeze(normalizePriceBook(json));
|
|
35
35
|
}
|
|
@@ -78,10 +78,10 @@ export function apply(ctx, rawConfig) {
|
|
|
78
78
|
writeStatus(lastGood);
|
|
79
79
|
},
|
|
80
80
|
onError: (error) => {
|
|
81
|
-
console.error(`[dsh-session-
|
|
81
|
+
console.error(`[dsh-session-fee] Keeping the last valid price book: ${error.message}`);
|
|
82
82
|
writeStatus({ ...lastGood, lastError: { at: new Date().toISOString(), message: error.message } });
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
return () => reloader.close();
|
|
86
|
-
}, "dsh-session-
|
|
86
|
+
}, "dsh-session-fee: price-book watcher");
|
|
87
87
|
}
|
package/lib/config.js
CHANGED
package/lib/pricing.js
CHANGED
|
@@ -5,7 +5,7 @@ const localFormatters = new Map();
|
|
|
5
5
|
const globCache = new Map();
|
|
6
6
|
|
|
7
7
|
function fail(path, message) {
|
|
8
|
-
throw new Error(`Invalid session-
|
|
8
|
+
throw new Error(`Invalid session-fee price book at ${path}: ${message}`);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function object(value, path, allowedKeys = null) {
|
package/lib/projection.js
CHANGED
|
@@ -11,7 +11,7 @@ const shape = (fields) => (value) => typeof value === "object" && value !== null
|
|
|
11
11
|
function schema(name, check) {
|
|
12
12
|
return {
|
|
13
13
|
parse(value) {
|
|
14
|
-
if (!check(value)) throw new TypeError(`Invalid session-
|
|
14
|
+
if (!check(value)) throw new TypeError(`Invalid session-fee ${name}`);
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
17
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-fee",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "在 DSH 输入框下显示当前会话(含子代理)按市面 token 价折算的费用:自维护价格表(别名、峰闲时、节假日、限时、长上下文阶梯)+ pi-ai 模型目录兜底。",
|
|
5
5
|
"author": "youxia",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/fujingzhai/youxia-dsh-plugins.git",
|
|
9
|
-
"directory": "dsh-session-
|
|
9
|
+
"directory": "dsh-session-fee"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/fujingzhai/youxia-dsh-plugins/tree/main/dsh-session-
|
|
11
|
+
"homepage": "https://github.com/fujingzhai/youxia-dsh-plugins/tree/main/dsh-session-fee#readme",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/fujingzhai/youxia-dsh-plugins/issues"
|
|
14
14
|
},
|
package/prices.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"name": "Kimi-K3",
|
|
50
|
-
"match": ["*/kimi-k3"],
|
|
50
|
+
"match": ["*/kimi-k3", "*/kimi-k3-1"],
|
|
51
51
|
"rules": [
|
|
52
52
|
{"name": "Kimi-K3", "currency": "CNY", "input": 20, "cacheRead": 2, "cacheWrite": 20, "output": 100}
|
|
53
53
|
]
|
|
@@ -87,6 +87,13 @@
|
|
|
87
87
|
{"name": "Qwen3.8-Flash", "currency": "CNY", "input": 1, "cacheRead": 0.1, "cacheWrite": 0, "output": 3}
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
|
+
{
|
|
91
|
+
"name": "Qwen3.8-27B",
|
|
92
|
+
"match": ["*/qwen3.8-27b"],
|
|
93
|
+
"rules": [
|
|
94
|
+
{"name": "Qwen3.8-27B", "currency": "CNY", "input": 3, "cacheRead": 0.6, "cacheWrite": 0, "output": 12}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
90
97
|
{
|
|
91
98
|
"name": "MiniMax-M3.1-Flash",
|
|
92
99
|
"match": ["dsh-provider-qoder/mmodel", "*/minimax-m3.1-flash"],
|
|
@@ -117,7 +124,7 @@
|
|
|
117
124
|
},
|
|
118
125
|
{
|
|
119
126
|
"name": "Hy4",
|
|
120
|
-
"match": ["*/hy4-preview", "*/hy4"],
|
|
127
|
+
"match": ["*/hy4-preview", "*/hy4", "*/hy4std"],
|
|
121
128
|
"rules": [
|
|
122
129
|
{"name": "Hy4", "currency": "CNY", "input": 6, "cacheRead": 0.3, "cacheWrite": 0, "output": 18}
|
|
123
130
|
]
|