Some checks failed
CI / node 22.19 (push) Has been skipped
CI / node 26 (push) Has been skipped
CI / python 3.10 / keyless SDK (push) Has been skipped
CI / python runtime / release-shaped Linux x64 (push) Has been skipped
CI / windows node 24 / wine blocking (push) Has been skipped
CI / wine apt cache (push) Successful in 58s
CI / serial / linux (push) Has been skipped
Deploy documentation / build (push) Failing after 2m46s
Deploy documentation / deploy (push) Has been skipped
E2E (real DeepSeek API) / e2e (push) Failing after 1m18s
Sandbox / sandbox e2e (bwrap, ubuntu-latest) (push) Failing after 1m18s
Landlock Run / Matrix (push) Successful in 13s
Release (vendor) / Pack npm tarballs (push) Failing after 3m43s
Release (dsh) / Pack npm tarballs (push) Failing after 1m53s
Sandbox / sandbox e2e (landlock, ubuntu-24.04) (push) Failing after 1m51s
Release (vendor) / Publish to npm (push) Has been skipped
Release (dsh) / Publish to npm (push) Has been skipped
CI / node 24 / static (push) Has been cancelled
CI / node 24 / coverage (push) Has been cancelled
CI / node 24 / snapshots and artifacts (push) Has been cancelled
CI / windows node 24 / native complete (push) Has been cancelled
CI / serial / linux (self-hosted standby) (push) Has been cancelled
CI / serial / macos (push) Has been cancelled
CI / serial / windows (self-hosted standby) (push) Has been cancelled
CI / larger-runner-benchmark (16, linux, dsh-ubuntu-24-04-16core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (16, windows, dsh-windows-2025-16core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (32, linux, dsh-ubuntu-24-04-32core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (32, windows, dsh-windows-2025-32core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (4, linux, dsh-ubuntu-24-04-4core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (4, windows, dsh-windows-2025-4core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (64, linux, dsh-ubuntu-24-04-64core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (64, windows, dsh-windows-2025-64core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (8, linux, dsh-ubuntu-24-04-8core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (8, windows, dsh-windows-2025-8core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (96, linux, dsh-ubuntu-24-04-96core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (96, windows, dsh-windows-2025-96core, production-site) (push) Has been cancelled
CI / consolidated-runner-benchmark (16, linux, dsh-ubuntu-24-04-16core, 16) (push) Has been cancelled
CI / consolidated-runner-benchmark (16, windows, dsh-windows-2025-16core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (32, linux, dsh-ubuntu-24-04-32core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (32, windows, dsh-windows-2025-32core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (4, linux, dsh-ubuntu-24-04-4core, 4) (push) Has been cancelled
CI / consolidated-runner-benchmark (4, windows, dsh-windows-2025-4core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (64, linux, dsh-ubuntu-24-04-64core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (64, windows, dsh-windows-2025-64core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (8, linux, dsh-ubuntu-24-04-8core, 8) (push) Has been cancelled
CI / consolidated-runner-benchmark (8, windows, dsh-windows-2025-8core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (96, linux, dsh-ubuntu-24-04-96core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (96, windows, dsh-windows-2025-96core, 2) (push) Has been cancelled
CI / all checks passed (push) Has been cancelled
Sandbox / sandbox e2e (seatbelt, macos-latest) (push) Has been cancelled
Sandbox / sandbox e2e (landlock, ubuntu-24.04-arm) (push) Has been cancelled
Landlock Run / ${{ matrix.platform }} (push) Has been cancelled
Landlock Run / darwin (no platform package — degradation proof) (push) Has been cancelled
47 lines
2.2 KiB
Markdown
47 lines
2.2 KiB
Markdown
# @deepseek-ai/dsh-client-ui-openrouter-usage
|
|
|
|
English | [中文](README.zh.md)
|
|
|
|
OpenRouter spend surface plugin, browser half: the per-session 会话费用
|
|
readout (`CostDock`) in the `conversation.composer.dock` strip (order 5, right
|
|
after the shipped stats line) plus the account 余额 badge (`BalanceBadge`) at
|
|
the sidebar foot (`sidebar.footer.action`).
|
|
|
|
`CostDock` reads the durable `openRouterCost` projection (seeded by the history
|
|
tail page, updated by `session/projection` frames), showing `会话费用 $X.XX`
|
|
only once a step actually priced — no zero-cost group. An unknown-pricing step
|
|
count surfaces in a tooltip so the figure's coverage stays visible. `CostDock`
|
|
therefore owns no store, refresh chain, or event listener.
|
|
|
|
`BalanceBadge` is account-global, so it is not a session projection: the slot
|
|
inject face carries a `snapshot()` callback that polls the host
|
|
`ctx.remote.openRouterUsage.snapshot()` Remote on a 60s interval and drives
|
|
local state. In the collapsed rail it renders only the balance marker; in the
|
|
wide column a labeled pill. Unknown or absent figures render the empty
|
|
placeholder. Both entries render nothing before real data exists, so an
|
|
assembly without the OpenRouter gateway or key costs no layout.
|
|
|
|
The `/client` exports are the plugin body (`apply`/`inject`), the
|
|
`CostDock`/`BalanceBadge` components, and the injected face types.
|
|
|
|
## Model Experience
|
|
|
|
Indirectly, none. Neither the cost readout nor the balance badge injects any
|
|
model context; they are pure client-side read models over the `openRouterCost`
|
|
projection and the `openRouterUsage` Remote snapshot. The agent loop and all
|
|
prompts are unchanged.
|
|
|
|
#### KV Cache effect
|
|
|
|
None. Cost derives from existing logged usage events and balance is a fetched
|
|
account figure; neither is a new model-visible input.
|
|
|
|
## Known Limitations and Deferred Work
|
|
|
|
- **Priced as of the fold** — `CostDock` renders whatever the durable
|
|
projection holds; figures for already-folded history reflect the pricing
|
|
table at fold time (see `dsh-openrouter-usage`).
|
|
- **Polled, not pushed** — `BalanceBadge` polls the host snapshot; there is
|
|
no `openRouterUsage` forwarded-event channel, so the figure updates on the
|
|
poll interval rather than instantly.
|