dsh-openrouter-spend 0.1.0 → 0.1.2
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/CHANGELOG.md +15 -2
- package/README.md +34 -17
- package/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.2] - 2026-10-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Screenshots of the composer chip and the spend popover in the README.
|
|
13
|
+
|
|
14
|
+
## [0.1.1] - 2026-10-05
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `credentialRef` rejects a blank reference at activation (schema pattern).
|
|
19
|
+
- README states the real placement of each figure (chip popover vs. Settings), the Management API key path in the OpenRouter dashboard, UTC-day semantics, and `historyDays` range coverage.
|
|
20
|
+
|
|
8
21
|
## [0.1.0] - 2026-10-05
|
|
9
22
|
|
|
10
23
|
### Added
|
|
11
24
|
|
|
12
|
-
- Spend chip under the composer
|
|
13
|
-
- Settings page:
|
|
25
|
+
- Spend chip under the composer with today's cost; popover with 7/30-day ranges, per-API-key filter, per-model table, daily bar chart, prepaid balance, and lifetime spend.
|
|
26
|
+
- Settings page: management-key storage and clear, browser-local refresh interval and per-key filter.
|
|
14
27
|
- `config` schema (`credentialRef`, `apiBase`, `refreshSeconds`, `historyDays`, `timeoutMs`) validated at activation.
|
|
15
28
|
- English, Russian, and Chinese display metadata and UI copy.
|
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<h1 align="center">dsh-openrouter-spend</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
|
|
8
|
+
OpenRouter spend inside
|
|
9
9
|
<a href="https://github.com/deepseek-ai/deepseek-harness">DeepSeek Harness</a> —
|
|
10
|
-
billed
|
|
10
|
+
billed USD from OpenRouter's own analytics API, not token estimates priced from a local table.
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
@@ -16,30 +16,44 @@
|
|
|
16
16
|
<img src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-2f6feb?style=flat-square" alt="DeepSeek Harness plugin">
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
## What you get
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="https://raw.githubusercontent.com/RyabykinIlya/dsh-openrouter-spend/v0.1.2/docs/chip.png" width="640" alt="Spend chip under the composer"><br>
|
|
23
|
+
<sub>The chip under the composer: billed spend for the selected range, next to the session's token and context stats.</sub>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<img src="https://raw.githubusercontent.com/RyabykinIlya/dsh-openrouter-spend/v0.1.2/docs/popover.png" width="340" alt="Spend popover"><br>
|
|
28
|
+
<sub>The popover: range and API-key filters, today's spend per model, daily bars, prepaid balance and lifetime spend.</sub>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
- **Chip under the composer** — spend for the selected range and API key: today, 7 days, or 30 days.
|
|
32
|
+
- **Chip popover** — range and API-key filters, today's spend per model, a daily bar chart across the window, prepaid balance and lifetime spend.
|
|
33
|
+
- **Settings → OpenRouter spend** — store or clear the management key, set the refresh interval, filter by API key.
|
|
34
|
+
|
|
35
|
+
The host half caches the summary for `refreshSeconds` and coalesces concurrent refreshes, so any number of open tabs cost one OpenRouter query per refresh window. When a refresh fails, the last good figures stay on screen and the reason is shown instead of an empty panel.
|
|
22
36
|
|
|
23
37
|
## Requirements
|
|
24
38
|
|
|
25
|
-
- DeepSeek Harness
|
|
26
|
-
- An OpenRouter **
|
|
39
|
+
- DeepSeek Harness web profile. The plugin needs the `credentials`, `webServer`, and `connection` services and stays inactive in profiles without them (for example, headless).
|
|
40
|
+
- An OpenRouter **Management API key** — OpenRouter dashboard → Settings → Management API Keys → Create New Key ([OpenRouter docs](https://openrouter.ai/docs/guides/overview/auth/management-api-keys)). A regular inference key is rejected: `403 Only management keys can perform this operation`.
|
|
27
41
|
|
|
28
42
|
## Install
|
|
29
43
|
|
|
30
|
-
From npm:
|
|
44
|
+
From npm (`web` is the default web-GUI profile; use your own profile name instead if you run one):
|
|
31
45
|
|
|
32
46
|
```sh
|
|
33
|
-
dsh plugin --profile
|
|
47
|
+
dsh plugin --profile web add dsh-openrouter-spend
|
|
34
48
|
```
|
|
35
49
|
|
|
36
|
-
From GitHub (no build step
|
|
50
|
+
From GitHub (plain JavaScript, no build step and no build-script permission):
|
|
37
51
|
|
|
38
52
|
```sh
|
|
39
|
-
dsh plugin --profile
|
|
53
|
+
dsh plugin --profile web add github:RyabykinIlya/dsh-openrouter-spend#v0.1.2
|
|
40
54
|
```
|
|
41
55
|
|
|
42
|
-
Then open Settings → OpenRouter spend
|
|
56
|
+
Then open Settings → OpenRouter spend and paste the management key.
|
|
43
57
|
|
|
44
58
|
## Configuration
|
|
45
59
|
|
|
@@ -53,16 +67,19 @@ Every field can be overridden in the profile's `cordis.patch.yml` row; the schem
|
|
|
53
67
|
| `historyDays` | `30` | 2–366, integer | Days of history the summary window covers, today included |
|
|
54
68
|
| `timeoutMs` | `15000` | 1000–120000, integer | Per-request deadline against OpenRouter |
|
|
55
69
|
|
|
56
|
-
Viewing preferences (per-key filter, refresh interval override) are browser-local
|
|
70
|
+
Viewing preferences (per-key filter, refresh interval override) are browser-local (`localStorage`).
|
|
57
71
|
|
|
58
|
-
##
|
|
72
|
+
## What the numbers are
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
- Figures are `total_usage` — USD OpenRouter actually billed — from `POST /api/v1/analytics/query`, grouped per UTC day by API key and model.
|
|
75
|
+
- "Today" is the current UTC day.
|
|
76
|
+
- Balance is `total_credits − total_usage` from `GET /api/v1/credits`: what remains of prepaid credits.
|
|
77
|
+
- The 7-day and 30-day ranges cover at most `historyDays` days; keep `historyDays ≥ 30` for full coverage.
|
|
61
78
|
|
|
62
79
|
## Security
|
|
63
80
|
|
|
64
81
|
- The management key is stored through the Harness credentials service (`credentials.set`), not in this package's files, and is never echoed back to the browser.
|
|
65
|
-
- The summary and credential routes are fenced by the connection trust check. Anyone who
|
|
82
|
+
- The summary and credential routes are fenced by the connection trust check. Anyone who passes that check — by default, the browser session on your local Harness port — can read your spend figures. Do not expose the Harness web port publicly without its own authentication.
|
|
66
83
|
|
|
67
84
|
## License
|
|
68
85
|
|
|
@@ -70,4 +87,4 @@ The host half queries `POST /api/v1/analytics/query` (`total_usage` and `request
|
|
|
70
87
|
|
|
71
88
|
## По-русски
|
|
72
89
|
|
|
73
|
-
Плагин для DeepSeek Harness
|
|
90
|
+
Плагин для DeepSeek Harness показывает реальные списания аккаунта OpenRouter (данные из аналитики OpenRouter, в долларах, по UTC-дням): чип под полем ввода с выбором периода сегодня / 7 дней / 30 дней, в поповере — разбивка по моделям за сегодня, график по дням, фильтр по API-ключам и остаток предоплаченных кредитов. В Settings → OpenRouter spend задаётся управляющий ключ и интервал обновления. Установка: `dsh plugin --profile web add dsh-openrouter-spend`; нужен Management API key из кабинета OpenRouter (Settings → Management API Keys) — обычный ключ модели для аналитики не подходит.
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const MAX_ANALYTICS_ROWS = 500
|
|
|
37
37
|
* the API, the credential, or the cadence without an edit to this file.
|
|
38
38
|
*/
|
|
39
39
|
export const Config = Schema.object({
|
|
40
|
-
credentialRef: Schema.string().default('OPENROUTER_MGMT_API_KEY')
|
|
40
|
+
credentialRef: Schema.string().pattern(/^\S+$/).default('OPENROUTER_MGMT_API_KEY')
|
|
41
41
|
.description('Credentials reference holding the OpenRouter management API key.'),
|
|
42
42
|
apiBase: Schema.string().pattern(/^https:\/\//).default('https://openrouter.ai/api/v1')
|
|
43
43
|
.description('OpenRouter REST API root; https only.'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-openrouter-spend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DeepSeek Harness plugin: shows what the OpenRouter account actually charged today — under the composer and in Settings, split by model and API key.",
|
|
5
5
|
"keywords": ["dsh", "dsh-plugin", "cordis", "openrouter", "spend", "cost", "analytics"],
|
|
6
6
|
"license": "MIT",
|