๐ด This is a fork. It builds on zxzxn3/deepseek-status-bar-for-copilot (MIT) โ all credit for the original extension goes to @zxzxn3.
What this fork adds
- Peak / off-peak rate badge with a countdown in the status bar โ
๐ 2h14mvsโก 0h45mโ so you know when you're paying double before you spend it.- Fixed the Flash price table, which was still on the pre-2026-09-10 rates (
0.05/1.5/4.5โ0.02/1/4CNY). Every Flash cost estimate was ~2.5ร too high.- Peak detection rewritten on UTC as a single source of truth, matching the official
01:00โ04:00and06:00โ10:00 UTC, MonโFriwindows instead of a hardcoded Beijing offset.See PATCH-NOTES.md for the complete delta.
See exactly what DeepSeek is costing you โ live, in the status bar, without leaving VS Code.
This extension puts a lightweight local proxy between Copilot Chat (via the DeepSeek V4 for Copilot Chat extension) and the DeepSeek API. It captures the real usage object from every response and turns it into today's cost and token totals โ Beijing time, peak pricing included.
- Real numbers, not estimates. It reads the
usageDeepSeek returns on every request (prompt_tokens/completion_tokens/ cache tokens) and prices it with the official rates. The totals match your DeepSeek bill โ no heuristic token counting. - Lives in the status bar. One glance: cost, cache-hit cost, total and cached tokens. Click it to switch between six display formats.
- A real dashboard when you need it. A webview panel with
Day / Week / Month / Allranges, a stacked usage chart, per-model breakdown, recent requests, and CSV export. - Your API key never touches this extension. The proxy forwards the
Authorizationheader straight through to DeepSeek; the key stays wherever the Copilot extension stores it. - No external services. Chart.js and dayjs are bundled into the extension itself โ no separate service, no Python, no Docker.
Every other DeepSeek usage tool answers "how much is left in my account?" โ they poll the /user/balance endpoint and show your credit balance. This extension answers a different question: "what did that request actually cost me?"
It sits in the traffic path โ a local proxy that captures the real usage object DeepSeek returns on every request and prices it with the official rate card:
- Ground truth, not estimates.
usageis the exact field DeepSeek bills from (prompt_tokens/completion_tokens/cache_hit/cache_miss). No heuristic token counting. - Three-way pricing. Cache hit vs miss, input vs output, and Beijing peak vs off-peak (ร2) โ the same axes as your real bill.
- Aborted generations still count. Cancel mid-stream and the proxy keeps reading until it captures the final
usageโ so the numbers match what you're billed. - Your API key never touches this extension. The proxy forwards the
Authorizationheader straight through and never stores it.
The status bar shows today's totals (Beijing time) and updates automatically:
- Cost โ
๏ฟฅ9.8626/4.4522total / cache-hit cost - Tokens โ
91.69M/89.04Mtotal / cached tokens - Balance โ
๏ฟฅxx.xxaccount balance, refreshed by the proxy on each request - Peak pricing aware โ costs double during peak hours (Beijing weekdays 09:00โ12:00 and 14:00โ18:00)
- Six display formats โ click the status bar to pick:
full(cost + tokens),cost,tokens,totalT(total tokens only),totalCost(total cost only), orbalance - Low-balance warning โ the status bar turns amber when the balance drops below
deepseekStatusBar.lowBalanceWarnCny
Click through to a full webview dashboard:
- Range selector โ
Day/Week/Month/All, with a date picker to view any specific day, week, or month - Usage-over-time chart โ Chart.js stacked bars (cache hit / cache miss / output) for cost or tokens, bucketed by hour for today & week and by day for month & all
- Balance & latency curves โ toggleable overlays for the account balance and the average request latency over time, each on its own axis with a legend
- Per-model breakdown โ cost & tokens per model (Flash / Pro / Vision), plus average latency per model
- Recent requests โ timestamp, model, prompt/completion, total/cache, cost, latency, status, error
- Export CSV โ dump the selected range to a CSV with cost columns
A local OpenAI-compatible proxy that forwards chat/completions with real streaming:
- Chunked streaming passthrough โ responses stream to Copilot as DeepSeek produces them, no buffering
- SSE-safe โ handles usage chunks split across network boundaries
- Disconnect-safe โ if the client cancels, the proxy keeps reading upstream to capture the final
usage(aborted generations still cost money and are still counted) - Auto-start โ starts with VS Code (
autoStart) and takes overdeepseek-copilot.baseUrl, restoring it when stopped
The proxy already holds your API key on every forwarded request, so it also queries /user/balance along the way and shows your balance in the status bar and the panel:
- No extra key setup โ the key is used in-flight and never stored
- Throttled โ at most once per minute; forced immediately after an HTTP 402
- 402 awareness โ insufficient-balance responses are surfaced in the detail panel, together with a fresh balance query
The proxy timestamps every request, so the panel knows how long each one took:
- Per-request latency โ shown in the recent-requests table
- Average latency โ an overall summary card, a per-model column, and an optional curve overlaid on the usage chart
- No cost to old data โ latency is recorded from new requests onward; historical rows simply show
โ
- Pricing overrides โ the built-in price table (per model, yuan per million tokens) can be overridden per model in settings
- CNY or USD display โ switch currency with a single setting; USD uses a live exchange rate fetched from a public API, falling back to a configurable rate when offline
- Language โ the UI follows your VS Code display language (English / ็ฎไฝไธญๆ)
Copilot Chat (DeepSeek V4 for Copilot)
โ baseUrl โ http://127.0.0.1:8080
โผ
local proxy (Node.js, spawned by this extension)
โ forwards with your Authorization header
โผ
api.deepseek.com
โ response.usage captured
โผ
usage.jsonl โ status bar + detail panel (cost computed on display)
Data is stored as one JSON line per request in VS Code's global storage: raw facts only (UTC timestamp + token counts). Cost is computed at display time, so price or currency changes are reflected immediately โ no re-processing of history.
- VS Code 1.85 or later
- DeepSeek V4 for Copilot Chat โ installed automatically as a dependency of this extension
- A DeepSeek API key configured in that extension (this extension never sees it)
- Install from the VS Code Marketplace (or build from source below).
- Reload VS Code. The proxy starts automatically.
- Open Copilot Chat and pick a DeepSeek V4 model (the companion extension).
- Chat as usual โ the status bar starts showing today's cost and tokens.
- Click the status bar to switch its format, or run DeepSeek Status Bar: Today's Details for the full panel.
| Setting | Default | Description |
|---|---|---|
deepseekStatusBar.port |
8080 |
Local proxy listen port |
deepseekStatusBar.autoStart |
true |
Start the proxy automatically when VS Code launches |
deepseekStatusBar.manageBaseUrl |
true |
Point deepseek-copilot.baseUrl at the proxy while running, and restore it when stopped |
deepseekStatusBar.pollIntervalSeconds |
10 |
Status bar refresh interval (seconds, min 2) |
deepseekStatusBar.statusBarFormat |
full |
Status bar format: full / cost / tokens / totalT / totalCost / balance |
deepseekStatusBar.pricing |
{} |
Per-model price overrides (yuan / 1M tokens): {"deepseek-v4-flash": {"cache_hit": 0.05, "cache_miss": 1.5, "output": 4.5}} |
deepseekStatusBar.currency |
cny |
Cost currency: cny (๏ฟฅ) or usd ($) |
deepseekStatusBar.cnyPerUsd |
6.74 |
Fallback CNY-per-USD rate, used when the live rate can't be fetched |
deepseekStatusBar.lowBalanceWarnCny |
10 |
Account balance (yuan) below which the status bar warns; 0 disables |
Pricing model โ built-in defaults + your overrides; peak = off-peak ร 2 during Beijing weekdays 09:00โ12:00 and 14:00โ18:00. USD display uses a live rate (fetched from a public API, refreshed every 6 hours) and falls back to cnyPerUsd offline.
| Command | Description |
|---|---|
DeepSeek Status Bar: Today's Details |
Open the detail panel |
DeepSeek Status Bar: Start Proxy / Stop Proxy |
Toggle the proxy (the palette entry reflects the current state) |
DeepSeek Status Bar: Display Format |
Choose the status bar display format |
- Vision requests are not counted. The companion extension's vision feature uses a separate
/v1/responsesendpoint configured independently ofbaseUrl, so it doesn't pass through this proxy. baseUrlis global. Taking overdeepseek-copilot.baseUrlaffects all windows. It's restored when the proxy stops, but if VS Code is force-killed the value may be left pointing at the proxy โ it recovers on next launch sinceautoStartis on.- The official dashboard is authoritative. Costs are computed from the same pricing model, but always trust
platform.deepseek.comfor billing.
npm install
npm run compile # or npm run watch
npm run typecheck
npm run smoke
npm test
# package into a .vsix
powershell -ExecutionPolicy Bypass -File .\package.ps1
# install / reinstall (--force overwrites the same version)
code --install-extension .\deepseek-status-bar-for-copilot.vsix --force


