DeepSHPlugins
dsh-llm-balance 项目预览
GITHUB / COMMUNITY PROJECT

dsh-llm-balance

安全与运维JavaScriptMIT

聊天输入框下方显示多个 LLM API 账户余额,内置 DeepSeek、OpenRouter、SiliconFlow 预设。

1 StarsJonyChan8394 更新时间 2026-08-17
访问 GitHub 仓库
dsh-llm-balance 项目预览

项目介绍

中文

聊天输入框下方显示多个 LLM API 账户余额,内置 DeepSeek、OpenRouter、SiliconFlow 预设。

English

Multi-provider LLM API balances under the chat input, with presets for DeepSeek, OpenRouter and SiliconFlow.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
JonyChan8394
仓库
JonyChan8394/dsh-llm-balance
GitHub Stars
1
Forks
0
开发语言
JavaScript
许可证
MIT
最近推送
2026-08-17
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

48/ 100
维护活跃
83
文档与实用信息
74
生态关注度
9
安装便捷信号
55
项目声明信号
100

关注度尚低(1)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

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

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

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 routeBalance 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

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目