sandbase-harness
sandbaseai
Local-first, self-hosted AI agent runtime and MCP bridge with sandboxed sessions, memory, credentials, audit/replay, and a local Console.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:hoyyang/dsh-agent-billing
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Agent 计费与用量可观测插件 — 多账号计费档案 + 玻璃拟态双层 UI(实时徽标 + 详细面板)+ 中转站余额实查 + 预算告警。
Agent billing & usage observability for DeepSeek Harness — multi-account billing profiles, glassmorphism dual-layer UI (live badge + full dashboard), relay-station balance queries, and budget alerts.
provider + model 双归属落账(Node 内建 SQLite),零额外模型请求?session= 精确账单——多窗口各自显示自己的成本,切会话实时更新/user/balance)与 New API 兼容中转站(/v1/dashboard/billing/*)两种适配器,按档案配置settings.json),无需改代码# 本机开发(super-injector 快路径)
dev_build_plugin { dir: "<本插件目录>" } # host tsc + client tsdown
dev_inject_plugin { dir: "<本插件目录>" } # 免重启热注入
# 打包安装(bundle 形态)
dsh plugin add <tgz 或仓库地址>
要求 / Requirements:DSH web 实例(host 需含 webServer 服务);Node ≥ 22(内建 node:sqlite)。
kiro*、zhipuai、relay-*)、币种、四档费率(每 1M token)→ 保存档案Σ(tokens × 费率) × 折扣 重算历史与实时;未匹配档案的用量按 0 计费并在「(未匹配)」行提示{
"id": "zhipuai-direct", // 稳定唯一 id
"label": "智谱直连", // 展示名
"providerMatch": "zhipuai", // 精确 / * / 前缀* / *后缀 / *含*(大小写不敏感)
"currency": "CNY",
"discount": 0.9, // 可选,1 = 原价
"rates": { "input": 2, "output": 8, "cacheRead": 0.5, "cacheWrite": 2 }, // 每 1M token
"byModel": { "glm-4.7*": { "input": 2, "output": 6, "cacheRead": 0.2, "cacheWrite": 2 } },
"balance": { // 可选
"adapter": "deepseek", // 'deepseek' | 'openai-billing'
"baseUrl": "https://api.deepseek.com",
"apiKey": "sk-..." // 仅存本地 settings
}
}
| 文件 | 内容 |
|---|---|
DSH_HOME/dsh-agent-billing/ledger.sqlite |
用量样本(ts/session/provider/model/四档 tokens)+ 水位表(防重放/重启双计) |
DSH_HOME/dsh-agent-billing/profiles.json |
费率档案(原子写) |
DSH_HOME/dsh-agent-billing/settings.json |
预算、刷新频率、汇率、智能配置 |
DSH_HOME/dsh-agent-billing/model-rules.json |
模型计费规则(手动 + 智能生成) |
DSH_HOME/dsh-agent-billing/smart-log.jsonl |
智能配置运行日志 |
卸载不删数据:卸载插件后上述文件保留,重装即恢复历史账本。彻底清除请手动删除 DSH_HOME/dsh-agent-billing/ 目录。
# super-injector 快路径
dev_uninject_plugin { match: "dsh-agent-billing" }
# bundle 安装
dsh plugin remove dsh-agent-billing
从 profile 的 cordis.patch.yml 移除 dsh-agent-billing-patch 条目并删除对应 junction 后重启 dsh web 即净;账本数据 ~/.dsh/dsh-agent-billing/ 保留,可手动删除。
卸载即净:loader entry / junction / 注入清单 / client 模块全部移除,profile patch 写入 disabled 阻断条目防自装配加回。
BSD-3-Clause
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: billing。