dclichang2022 / dsh-green-meter

목록에 있음

Energy & carbon metering for DeepSeek Harness: per-turn/per-request energy, cache carbon savings, electricity cost.

main기타 소스 보기

설치

pnpm add dsh-green-meter dsh-client-ui-green-meter

이 명령은 GitHub 저장소 주소에서 생성됩니다. 실행 전에 업스트림 README와 소스를 검토하고 재현성이 필요하면 release 또는 commit을 고정하세요.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 c0be78d동기화 2026. 8. 17.

dsh-green-meter

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

SurfaceWhat 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
/greenone-command session energy report
green_meter toolthe agent can query its own energy, carbon, cost and budget at any time
Energy budgetoptional per-session budget — over-budget steps are rejected with a warning
JSONL ledgerevery 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.

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

KeyDefaultMeaning
profileproxycalibration profile (proxy, qwen-h20-*, gemma-h20-*, qwen3-4b-*)
carbonFactorKgPerKwh0.5777grid carbon intensity
electricityPriceCnyPerKwh0.56electricity price (CNY/kWh)
dir<DSH_HOME>/green-meterledger directory
budgetJ0 (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

MIT

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

테스트감지됨
예제감지됨

저장소 정보

언어
TypeScript
라이선스
MIT
마지막 업데이트
2026. 8. 17. AM 7:39

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.