dshbase

插件目录 / Developer / dsh-llm-balance

dsh-llm-balance

未验证 JonyChan8394

✓ 持续维护 基于 3 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

1Stars
0Forks
0未关闭 issue
语言
2026-08-17最近推送
跨平台平台

功能简介

Show LLM API balances under the chat input: DeepSeek, OpenRouter, SiliconFlow and any custom provider with a balance endpoint. DSH plugin.

我们的评价
未验证 — 尚未实测

Show LLM API balances under the chat input: DeepSeek, OpenRouter, SiliconFlow and any custom provider with a balance endpoint. DSH plugin. 尚未验证——请自行安装测试。

「未验证」表示我们的自动化 CI 尚未安装过该插件。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

你是插件作者? 想拿到「已验证」标签——提交你自己的验证证据(截图、日志或短视频),我们审核通过后即改为「已验证」。

提交验证证据 ↗

README

dsh-llm-balance

English | 中文

Show the balances of exactly the LLM providers you have configured in dsh, right below the chat input box.

  • Below the chat input — a compact readout in the composer's footer band (the seat under the input card, where the stats line lives) that refreshes automatically (default every 60 s) with a manual refresh link.
  • Click to recharge — click any provider's balance (or "未开放查询API" label) to open its recharge/top-up page in a new browser tab.
  • Driven by your dsh configuration — the strip shows exactly the providers registered in dsh (the Models page / llm-pi-ai settings + the built-in adapters you use). Configure a new LLM in dsh and it appears on the next refresh; remove it and it disappears. No restart, no config editing.
  • No public balance API? — providers like Qwen/DashScope, OpenAI and Anthropic have a public API key but no public balance endpoint. When such a provider is configured with a key, the strip shows "未开放查询API / no balance API" instead of hiding it.
  • Keys stay on the host — API keys are resolved from DSH credentials (or environment) host-side; the browser only ever sees the fetched balances.

Install

dsh plugin --profile web add github:JonyChan8394/dsh-llm-balance

Restart dsh web. The balance readout appears under the chat input as soon as at least one configured provider has a key.

Configure

Nothing to configure — the plugin follows the providers you already set up in dsh. Balance endpoints are known for these routes:

Provider route Balance API
DeepSeek (deepseek, deepseek-official)
OpenRouter (openrouter)
SiliconFlow (siliconflow)
Moonshot / Kimi (moonshotai-cn, moonshotai)
MiniMax (minimax)
StepFun (stepfun)
Zhipu / GLM (zhipu)
Any other configured provider ❌ shows "未开放查询API"

Each preset also ships a rechargeUrl — the provider's top-up page — opened in a new tab when you click the balance in the strip. To add a balance endpoint for a provider not in the list (e.g. an aggregator route with its own balance endpoint), override the plugin config in your profile's cordis.patch.yml:

- id: llm-balance
  config:
    refreshMs: 30000
    endpoints:
      - id: myprovider
        name: MyProvider
        apiKeyEnv: MYPROVIDER_API_KEY
        url: https://api.example.com/v1/balance
        balancePath: data.remaining
        currencyPath: data.currency
        rechargeUrl: https://console.example.com/recharge

A provider without a configured key is hidden from the strip; a provider whose request fails shows "获取失败 / fetch failed".

How it works

  • Host half (lib/index.js) reads ctx.llm.listProviders() — the exact set of LLM routes configured in dsh — on every request. For each provider with a known balance endpoint it resolves the key through ctx.credentials and calls the endpoint; for a configured provider with a key but no endpoint it reports error: 'no-api'. Results are served as GET /llm-balance JSON through the webserver route registry.
  • Browser half (lib/client.js) registers a conversation.composer.dock entry (order 10) that polls /llm-balance and renders the readout under the input card.

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-llm-balance」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:JonyChan8394/dsh-llm-balance

Headless(CLI)profile:

dsh plugin --profile headless add github:JonyChan8394/dsh-llm-balance

实测报告

尚未 L3 验证——若已跑过,见下方失败备注。

状态:pending · 最近测试 2026-08-26
备注:验证: install-fail 浏览全部待验证失败 →
安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7795 个插件 →