Skip to content

Commit e793ce6

Browse files
committed
feat: enhance token usage tracking with detailed cost breakdown and status bar improvements
1 parent 48ae374 commit e793ce6

5 files changed

Lines changed: 440 additions & 60 deletions

File tree

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ DeepSeek V4 is text-only. Drop a screenshot into chat and this extension automat
3737
Full support for DeepSeek V4's `reasoning_content`. Use Copilot Chat's native model picker menu to choose `none` (off), `high` (balanced, default), or `max` (deep reasoning for hard agent tasks).
3838

3939
### Token Usage Tracker
40-
Keep an eye on your token burn right from the status bar. A live counter shows total tokens consumed in the current session, with a hover tooltip breaking down prompt, completion, and cache-hit tokens. The bar changes colour as you approach the context limit — yellow at 80%, red at 95% — so you never hit a surprise truncation mid-task.
40+
Keep an eye on your token burn right from the status bar. A live counter shows the **last request's** prompt tokens (not the accumulated total — Copilot truncates history, so the meaningful number is what each request actually used), with a rich hover tooltip breaking down both the last request and session totals including **cost in USD and CNY**.
41+
42+
The bar changes colour as you approach the context limit — yellow at 80%, red at 95% — so you never hit a surprise truncation mid-task. **Click the status bar** to open a persistent detail panel with the full breakdown and a **Reset Session Counter** button.
43+
44+
<p align="center">
45+
<img src="resources/screenshots/05-token-count.png" alt="DeepSeek token usage status bar showing last-request token count and rich hover tooltip with cost breakdown" width="800">
46+
</p>
4147

4248
<p align="center">
43-
<img src="resources/screenshots/05-token-count.png" alt="DeepSeek token usage status bar showing live token count and hover tooltip with usage breakdown" width="800">
49+
<img src="resources/screenshots/06-token-count-detail.png" alt="DeepSeek token usage detail panel opened by clicking the status bar, showing last request, session totals, cost, and pricing table" width="600">
4450
</p>
4551

4652
### Inherits Every Copilot Capability
28.3 KB
Loading
33.8 KB
Loading

src/provider/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ export class DeepSeekChatProvider implements vscode.LanguageModelChatProvider {
169169
progress: vscode.Progress<vscode.LanguageModelResponsePart>,
170170
token: vscode.CancellationToken,
171171
): Promise<void> {
172+
// Set active model for cost calculation before proceeding.
173+
this.tokenUsageTracker.setModel(modelInfo.id);
174+
172175
const apiKey = await this.authManager.getApiKey();
173176
if (!apiKey) {
174177
throw new Error(

0 commit comments

Comments
 (0)