<div align="center">

# 📊 dsh-usage-stats

**DeepSeek Harness के लिए API खर्च निगरानी: प्रति-अनुरोध विवरण, पिछली-अवधि तुलनाएँ और चार्ट-समर्थित इतिहास — एक ही पैनल में।**

*हर टोकन देखें जिसके लिए आप भुगतान करते हैं।*

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![DSH plugin](https://img.shields.io/badge/dsh-plugin-✅-green)](https://github.com/topics/dsh-plugin)
[![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)

[English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)

</div>

---

## संगतता

| पहलू | स्थिति |
|---|---|
| Harness | DeepSeek Harness `0.1.0-rc.8` |
| Node | `^22.19.0 \|\| >=24.0.0` |
| सतहें | Host + वेब क्लाइंट (Settings → Usage टैब); `/usage` कमांड |

## आपको क्या मिलता है

`dsh-usage-stats` सत्र इवेंट स्ट्रीम को एक संपूर्ण खर्च-निगरानी पैनल में बदल देता है:

- **सारांश कार्ड** — आज / इस सप्ताह / इस महीने / कुल मिलाकर, प्रत्येक पर पिछली अवधि (कल / पिछला सप्ताह / पिछला महीना) के सापेक्ष हस्ताक्षरित प्रतिशत अंतर।
- **प्रति-अनुरोध वार्तालाप विवरण** — हर कीमत-निर्धारित अनुरोध का आरंभ समय, टर्न/स्टेप, मॉडल, इनपुट / आउटपुट / कैश-रीड / कैश-राइट टोकन, अनुरोध-समय की कीमत पर लागत और पीक बैज; सत्र प्रोजेक्शन सीम के जरिए रीस्टार्ट के बाद भी टिकाऊ (सीमित रिंग, `requestLog` कॉन्फ़िग)।
- **दिन / सप्ताह / महीना दृश्य** — वर्तमान-बनाम-पिछला तुलना पैनल (लागत, टोकन, कॉल, पीक कॉल + अंतर) अवधि की दैनिक लाइनों के साथ।
- **इतिहास पैनल** — बिना-निर्भरता का दैनिक-लागत बार चार्ट (पीक-रंगीन बार, होवर विवरण) साथ में दैनिक तालिका (लागत / टोकन / कॉल / पीक, प्रति-मॉडल ड्रिल-डाउन), डिफ़ॉल्ट 90 दिन (टिकाऊ परत में ~एक वर्ष)।
- **कस्टम रेंज** — कोई भी तारीख से/तक: रेंज कुल, दैनिक चार्ट, साप्ताहिक लाइनें, प्रति-मॉडल विवरण।
- **कीमतें** — बिल्ट-इन USD तालिका `config.prices` से मर्ज होती है; **पीक-घंटे की कीमत** अनुरोध आरंभ पर लागू होती है (`peak.hours` विंडो × `multiplier`, या स्पष्ट `peak.prices`); कैलेंडर बकेटिंग `peak.timezone` का अनुसरण करती है।
- **कार्बन और लेटेंसी** — टोकन→कार्बन पुल (टोकन × kWh/टोकन × PUE × क्षेत्रीय ग्रिड तीव्रता) और प्रति-मॉडल लेटेंसी प्रतिशतक।

## त्वरित शुरुआत

```sh
# 1. पैकेज को अपने प्रोफ़ाइल में जोड़ें (tarball चैनल)
pnpm pack
dsh plugin --profile web add ./dsh-usage-stats-<version>.tgz

# 2. पुनः आरंभ करें और पंक्ति सत्यापित करें
dsh web --restart
dsh --profile web --dump-config | grep -A2 'id: usage'
```

फिर वार्तालाप में `/usage` टाइप करें और Settings → Usage टैब खोलें।

## इंस्टॉल और अनइंस्टॉल

- **npm चैनल** (प्रकाशित संस्करण): `dsh plugin --profile web add dsh-usage-stats-alhabor` — npm रजिस्ट्री, टैग्स से प्रकाशित।
- **git चैनल** (नवीनतम `main`): `dsh plugin --profile web add "github:PerryLink/dsh-budget#main"` — `prepare` स्क्रिप्ट केवल प्रोडक्शन निर्भरताओं से बनाती है।
- **tarball चैनल**: इस रिपॉज़िटरी में `pnpm pack` चलाएँ, फिर `dsh plugin --profile web add ./dsh-usage-stats-<version>.tgz`।
- **अनइंस्टॉल**: `dsh plugin --profile web remove dsh-usage-stats`।

## कॉन्फ़िगरेशन

हर कुंजी एक Schemastery `Config` फ़ील्ड है (cordis.yml से संपादन योग्य)। `cordis.patch.yml` हर कुंजी को इनलाइन दस्तावेज़ित करता है।

| कुंजी | डिफ़ॉल्ट | अर्थ |
|---|---|---|
| `prices` | `{}` | प्रति-मॉडल प्रति-1M-टोकन कीमतें, बिल्ट-इन USD तालिका पर मर्ज होती हैं |
| `defaultPrice` | `{input: 1.0, output: 3.0}` | दोनों तालिकाओं से अनुपस्थित मॉडलों के लिए फ़ॉलबैक |
| `peak.enabled` / `timezone` / `hours` / `weekendOffpeak` / `multiplier` / `prices` | `true` / `Asia/Shanghai` / `[[9,12],[14,18]]` / `true` / `{input:2, output:2, cacheRead:2, cacheWrite:2}` / `{}` | पीक-घंटे की कीमत: विंडो के भीतर शुरू होने वाले अनुरोध (केवल सोम–शुक्र; 2026-08-23 से डीपसीक नियम के अनुसार सप्ताहांत पूरा दिन ऑफ़-पीक) `peak.prices` (या आधार × `multiplier`) से कीमत-निर्धारित होते हैं; दिन/माह बकेटिंग `peak.timezone` का अनुसरण करती है |
| `modelAliases` | `{}` | दिनांकित/विरासत मॉडल id → विहित मूल्य-निर्धारण id |
| `currency` | `{code: CNY, rate: 1.0, decimals: 2}` | प्रदर्शन मुद्रा (राशि = गणना × rate; सीधी CNY कीमतों के लिए `rate: 1.0` सेट करें और `prices` को CNY दरों से भरें) |
| `outputLanguage` | `zh` | `/usage` का आउटपुट भाषा: `en` / `zh` |
| `historyDays` | `90` | पैनल स्नैपशॉट में रखे गए दैनिक इतिहास के दिन (1..365; टिकाऊ परत प्रति सत्र ~एक वर्ष रखती है) |
| `requestLog.enabled` / `size` | `true` / `200` | प्रति-अनुरोध विवरण स्विच और प्रति-सत्र रिंग आकार (10..2000) |
| `carbon.enabled` / `region` / `pue` / `energyKwhPerToken` | `true` / `global` / `1.58` / `0.000007` | कार्बन पुल (क्षेत्र: global, us, eu, china, india, uk, france, iceland) |
| `latency.enabled` / `windowSize` | `true` / `200` | प्रति-मॉडल लेटेंसी प्रतिशतक और उनकी विंडो |
| `refreshIntervalMs` | `5000` | Settings टैब का पोलिंग अंतराल (आरक्षित) |

## टूल और सतहें

| सतह | प्रकार | नोट्स |
|---|---|---|
| `/usage` | कमांड | सारांश (सत्र / आज / कल / इस सप्ताह / पिछला सप्ताह / इस महीने / पिछला महीना / कुल) |
| `/usage models \| days \| sessions \| week <सोमवार> \| range <से> <तक>` | कमांड | प्रति-मॉडल विवरण / दैनिक इतिहास / सत्र सूची / एक सप्ताह / कस्टम रेंज |
| Settings → Plugins → Usage | Settings टैब | सारांश कार्ड, वार्तालाप विवरण, दिन/सप्ताह/माह तुलनाएँ, कस्टम रेंज, इतिहास चार्ट |
| `usage/status`, `usage/range` | Typert Remote | क्लाइंट चैनल (टैब इन दो विधियों का उपभोग करता है) |

## अनुमतियाँ और डेटा

- **अनुमतियाँ**: `session:append` (केवल कमांड ऑडिट), `native-code:none`; कोई बहिर्गामी नेटवर्क नहीं।
- **डेटा**: जो भी दिखाया जाता है वह आधिकारिक सत्र इवेंट्स पर केवल-पठनीय समुच्चय है; प्लगइन सत्र लॉग में कभी कस्टम इवेंट प्रकार नहीं जोड़ता (rc.8 का पठन पथ अज्ञात प्रकारों को अस्वीकार करता है) — टिकाऊ स्थिति पूरी तरह से सत्र प्रोजेक्शन में रहती है।
- **ज़ोरदार विफलता**: अमान्य कीमतें, टाइमज़ोन, अनुपात, क्षेत्र या सीमाएँ माउंट समय पर विफल होती हैं।

## ज्ञात सीमाएँ

- प्रति-अनुरोध विवरण प्रति सत्र सीमित है (डिफ़ॉल्ट रूप से नवीनतम 200); पुराने अनुरोध केवल समुच्चय में रहते हैं।
- जब टिकाऊ इतिहास एक पूर्ण अवधि से छोटा हो तो पिछली-अवधि अंतर "new"/"flat" दिखाते हैं।
- बिल्ट-इन कीमतें बहती रहती हैं; `config.prices` से प्रविष्टियाँ ओवरराइड करें।

## विकास

```sh
pnpm install        # node ^22.19 || >=24
pnpm run typecheck  # tsc: स्थानीय harness चेकआउट के विरुद्ध src + tests
pnpm run typecheck:ci  # प्रकाशित 0.1.0-rc.8 टाइप फेस के विरुद्ध tsc (बिना paths)
pnpm test           # vitest: 80 tests
pnpm run build      # tsc घोषणाएँ + tsdown बंडल (lib/)
pnpm run verify:self-contained  # निर्भरता specs रजिस्ट्री से हल होती हैं
pnpm run verify:artifacts       # निर्मित ESM फेस + typert मैनिफेस्ट + क्लाइंट बंडल
pnpm pack           # प्रकाशित tarball
```

## Topics

`dsh`, `dsh-plugin`, `deepseek-harness`, `deepseek`, `cordis`, `budget`, `cost-tracking`, `carbon-footprint`, `latency-benchmark`, `token-usage`

## Contributors

- [@PerryLink](https://github.com/PerryLink) — निर्माता और अनुरक्षक: समुच्चयन, बजट प्रशासन, कार्बन और लेटेंसी पोर्ट, Settings टैब और पाँच-भाषा दस्तावेज़।

## PerryLink DSH Plugin Family

यह प्रोजेक्ट [PerryLink](https://github.com/PerryLink) द्वारा अनुरक्षित [29 DeepSeek Harness प्लगइन्स](https://github.com/PerryLink) में से एक है। यदि यह आपकी मदद करता है, तो बाकी भी शायद करेंगे:

| Plugin | एक पंक्ति |
|---|---|
| [dsh-auto-review](https://github.com/PerryLink/dsh-auto-review) | Second-model auto-review on the approval chain, fail-closed by default |
| [dsh-background-agents](https://github.com/PerryLink/dsh-background-agents) | Durable background child agents with a Web UI sidebar, messaging and interrupt |
| **[dsh-budget](https://github.com/PerryLink/dsh-budget)** | Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel. |
| [dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind) | Claude Code /rewind-equivalent: snapshots, session forks, one-shot restore |
| [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH |
| [dsh-click](https://github.com/PerryLink/dsh-click) | Cross-platform native desktop control for DeepSeek Harness — Windows first. |
| [dsh-composer-history](https://github.com/PerryLink/dsh-composer-history) | Terminal-style input history for the web composer: arrows, Ctrl+R search |
| [dsh-defend](https://github.com/PerryLink/dsh-defend) | Prompt-injection, jailbreak, and secret-leak defense for DeepSeek Harness. |
| [dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck) | Engineering-discipline guard: requirements grill, test gates, adversary review |
| [dsh-draw](https://github.com/PerryLink/dsh-draw) | Unified static-image generation routing for DeepSeek Harness. |
| [dsh-fast](https://github.com/PerryLink/dsh-fast) | Read-only performance diagnostics for DeepSeek Harness. |
| [dsh-github](https://github.com/PerryLink/dsh-github) | GitHub PR/issues integration for DSH, every write gated by approval |
| [dsh-library](https://github.com/PerryLink/dsh-library) | Local document knowledge base for DeepSeek Harness. |
| [dsh-local-ai](https://github.com/PerryLink/dsh-local-ai) | Local-model (Ollama) integration for DeepSeek Harness. |
| [dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions) | LSP diagnostics, formatting, completion, code actions and rename over language servers |
| [dsh-mask](https://github.com/PerryLink/dsh-mask) | PII masking middleware for DeepSeek Harness — anonymize personal data before it reaches the model, restore it at the display layer. |
| [dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel) | Read-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors |
| [dsh-memento](https://github.com/PerryLink/dsh-memento) | Approval-gated cross-session memory: ctx.memory seam + SQLite + memory tool |
| [dsh-observe](https://github.com/PerryLink/dsh-observe) | OpenTelemetry and Langfuse observability exporter for DeepSeek Harness. |
| [dsh-output-styles](https://github.com/PerryLink/dsh-output-styles) | Claude Code outputStyles-equivalent runtime style switching |
| [dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules) | Claude Code-style declarative allow/deny/ask permission rules with audit |
| [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | Plugin-development knowledge base as an on-demand agent skill |
| [dsh-score](https://github.com/PerryLink/dsh-score) | Multi-dimensional quality scoring for DeepSeek Harness plugins. |
| [dsh-session-pin](https://github.com/PerryLink/dsh-session-pin) | Pin sessions in the Web sidebar with durable ordering |
| [dsh-session-sync](https://github.com/PerryLink/dsh-session-sync) | Cross-device session sync for DeepSeek Harness — a dedicated git mirror of your session store. |
| [dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security) | Security-audit skill pack: secret scan, dependency and supply-chain review |
| [dsh-talk](https://github.com/PerryLink/dsh-talk) | Voice-first session loop for DeepSeek Harness: talk to it, hear it answer. |
| [dsh-test-drive](https://github.com/PerryLink/dsh-test-drive) | Isolated install-and-smoke test drives for DeepSeek Harness plugins. |
| [dsh-translate](https://github.com/PerryLink/dsh-translate) | Vendor parameter translation and deterministic JSON repair for DeepSeek Harness. |

## License

[Apache License 2.0](LICENSE) © 2026 dsh-budget contributors
