dsh-green-meter
by dclichang2022
DeepSeek Harness 能耗与碳排放计量:按轮次/按请求统计能耗、缓存减碳量与电费成本
Energy & carbon metering for DeepSeek Harness: per-turn/per-request energy, cache carbon savings, electricity cost.
安装
dsh plugin --profile web add github:dclichang2022/dsh-green-meterGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
目录
Energy & carbon metering for DeepSeek Harness — see what your agentic sessions cost.
A dsh-plugin that turns every model call into energy (J/kWh), carbon footprint (g CO2e) and electricity cost (CNY) — estimated from token accounting, so it works with any API-backed provider (DeepSeek API, OpenAI-compatible endpoints, local vLLM) without touching hardware.
Install it, chat as usual, and watch your session's energy bill in real time.
✨ Features
| Surface | What you see |
|---|---|
| Composer dock (always visible under the input box) | live 能耗 1.5 kJ · 碳 0.2 g readout + per-turn energy sparkline |
| Detail panel (click the readout) | floating draggable drawer with per-turn energy chart, per-request energy list, session totals (tokens / energy / carbon / electricity cost), carbon saved by caching ≈ N trees per year |
/green |
one-command session energy report |
green_meter tool |
the agent can query its own energy, carbon, cost and budget at any time |
| Energy budget | optional per-session budget — over-budget steps are rejected with a warning |
| JSONL ledger | every model call recorded, ready for your own analysis |
🚀 Quick start
# 1. Install into your dsh profile
cd ~/.dsh/profiles/web # (Windows: %USERPROFILE%\.dsh\profiles\web)
pnpm add dsh-green-meter dsh-client-ui-green-meter
# 2. Mount the plugins in your profile's cordis.patch.yml (see examples/)
- insert:
- id: green-meter
name: 'dsh-green-meter'
- id: ui-green-meter
name: 'dsh-client-ui-green-meter'
config:
panelPlacement: overlay # overlay (default) = floating draggable drawer, zero-config
Restart dsh web, refresh, and the readout appears under the composer. Type /green anytime.
The detail panel opens as a floating drawer you can drag anywhere — no changes
to the DeepSeek Harness repo are needed. panelPlacement can be omitted
(overlay is the default); popover is another patch-free option.
Sidebar panel (optional, needs a one-time DSH edit)
panelPlacement: sidebar renders the detail panel inside the sidebar's blank
space. Skip this section if the drawer above is enough — it is the recommended
setup. The seat needs one small addition to packages/client/ui-sidebar
(everything else stays untouched). Two ways, pick one:
A. Patch (fresh checkout of deepseek-harness)
cd /path/to/deepseek-harness
git apply /path/to/dsh-green-meter/patches/ui-sidebar-sidebar-energy.patch
pnpm --filter @deepseek-ai/dsh-client-ui-sidebar bundle
B. Anchor-based installer (any version; use this when git apply fails)
cd /path/to/deepseek-harness
powershell -ExecutionPolicy Bypass -File /path/to/dsh-green-meter/patches/apply-sidebar-energy.ps1
pnpm --filter @deepseek-ai/dsh-client-ui-sidebar bundle
The installer edits by unique code anchors (no line numbers), so it works even when the patch's context no longer matches your checkout, and it is idempotent — running it twice is safe.
⚙️ Configuration
| Key | Default | Meaning |
|---|---|---|
profile |
proxy |
calibration profile (proxy, qwen-h20-*, gemma-h20-*, qwen3-4b-*) |
carbonFactorKgPerKwh |
0.5777 |
grid carbon intensity |
electricityPriceCnyPerKwh |
0.56 |
electricity price (CNY/kWh) |
dir |
<DSH_HOME>/green-meter |
ledger directory |
budgetJ |
0 (off) |
session energy budget in joules |
Environment fallbacks: DSH_GREEN_PROFILE, DSH_GREEN_CARBON_FACTOR, DSH_GREEN_PRICE_CNY, DSH_GREEN_DIR, DSH_GREEN_BUDGET_J.
📌 Method notes
- Estimate, not measurement — energy is modeled from token accounting with calibrated per-model profiles; carbon and cost are energy × configurable factors.
- GPU operational energy only — CPU, memory, cooling and embodied carbon are out of scope.
- Cache savings are counterfactual — cached tokens that would otherwise be recomputed.
💎 thebestai
thebestai is our AI platform. 欢迎大家通过反馈意见可以使用我们的 AI Greentoken 系列服务。
Development
pnpm install
pnpm test
License
原始 README: https://github.com/dclichang2022/dsh-green-meter/blob/main/README.md ↗
同类插件
查看全部 →
dsh-anchored-standard
两阶段 DeepSeek Harness 预设:先 Minimal 对齐的 bootstrap,再切完整 Standard 工具(Project2 98/99)

PicGo-Core
极致的图片上传引擎,CLI 与 API 双支持

awesome-deepseek-harness
DeepSeek Harness(DSH)及其优秀社区插件的精选指南。

awesome-deepseek-harness
DeepSeek Harness (DSH)生态系统:来自dsh-external/hub和公共dsh-plugin主题的精选插件、工具和基础设施。

AI-Novel-Writer
本地优先 AI 小说创作工作台,提供 Windows/macOS 桌面版与 DeepSeek Harness 插件开发预览,支持角色、大纲、章节蓝图、审稿修稿和本地模型。

mcp-for-stata
MCP-for-Stata:把 Stata 集成进你的 agent