Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aiusage/cli",
"version": "1.7.7",
"version": "1.7.8",
"description": "Track and sync AI tool token usage across devices.",
"license": "MIT",
"private": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/pricing-catalog.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2026-07-18-kimi-k3-v1",
"version": "2026-07-20-gpt-5.6-kimi-k3-v1",
"fx": {
"CNY": 7.2
},
Expand Down
17 changes: 2 additions & 15 deletions packages/cli/src/scanners/__tests__/copilot-vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ describe('scanCopilotVscodeDates', () => {
'2026-02-12 09:39:03.512 [info] Got Copilot token for hubeiqiao',
'2026-02-12 09:39:05.000 [info] Open workspace file:///Users/test/project-one',
'2026-02-12 09:40:20.336 [info] ccreq:4380bcbb.copilotmd | success | gpt-4.1 -> gpt-4.1-2025-04-14 | 2277ms | [settingsEditorSearchSuggestions]',
'2026-02-12 09:40:25.336 [info] ccreq:4480bcbb.copilotmd | success | copilot-suggestions-lysithea-0022 | 2277ms | [XtabProvider]',
'2026-02-12 09:40:30.000 [info] ccreq:4390bcbb.copilotmd | error | gpt-4.1 -> gpt-4.1-2025-04-14 | 300ms | [settingsEditorSearchSuggestions]',
'2026-02-12 09:41:20.336 [info] ccreq:4490bcbb.copilotmd | success | claude-sonnet-4.5 | 199ms | [chat]',
]);
Expand All @@ -105,21 +106,7 @@ describe('scanCopilotVscodeDates', () => {
);

const breakdowns = result.get('2026-02-12') ?? [];
expect(breakdowns).toHaveLength(2);

expect(breakdowns).toContainEqual({
provider: 'github',
product: 'copilot-vscode',
channel: 'ide',
model: 'gpt-4.1-2025-04-14',
project: 'Project One',
eventCount: 1,
inputTokens: 0,
cachedInputTokens: 0,
cacheWriteTokens: 0,
outputTokens: 0,
reasoningOutputTokens: 0,
});
expect(breakdowns).toHaveLength(1);

expect(breakdowns).toContainEqual({
provider: 'github',
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/scanners/copilot-vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,19 @@ function extractSuccessEvent(line: string): { requestId: string; timestamp: Date
const requestId = requestIdMatch?.[1] ?? `${timestamp.getTime()}`;
const model = normalizeModel(parts[2]);
if (!model) return null;
if (isBackgroundRequest(parts[4], model)) return null;

return { requestId, timestamp, model };
}

function isBackgroundRequest(rawScope: string | undefined, model: string): boolean {
const scope = rawScope?.replace(/^\[|\]$/g, '').trim().toLowerCase();
if (scope === 'xtabprovider' || scope === 'settingseditorsearchsuggestions') return true;
return model.startsWith('copilot-suggestions-')
|| model.startsWith('copilot-nes-')
|| model.startsWith('dd_');
}

function normalizeModel(raw: string): string {
const parts = raw.split('->').map((part) => part.trim()).filter(Boolean);
return parts[parts.length - 1] ?? raw.trim();
Expand Down
1 change: 1 addition & 0 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@aiusage/shared": "workspace:*",
"@lobehub/icons-static-svg": "^1.94.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.542.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/dashboard/scripts/generate-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ async function main() {
filters: {
selection: {
range: 'all',
deviceId: null,
provider: null,
product: null,
channel: null,
model: null,
project: null,
deviceId: [],
provider: [],
product: [],
channel: [],
model: [],
project: [],
},
options: {
devices: [{
Expand Down
Loading