claude-code-cost 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/release.md +54 -0
- package/.github/workflows/pages.yml +39 -0
- package/.husky/pre-commit +1 -0
- package/CLAUDE.md +42 -0
- package/LICENSE +21 -0
- package/PLAN-CONTEXT.md +83 -0
- package/README.md +102 -0
- package/assets/overview-dark.png +0 -0
- package/assets/overview-light.png +0 -0
- package/assets/projects-dark.png +0 -0
- package/assets/projects-light.png +0 -0
- package/assets/session-dark.png +0 -0
- package/assets/sesssion-light.png +0 -0
- package/biome.json +33 -0
- package/docs/assets/overview-dark.png +0 -0
- package/docs/assets/overview-light.png +0 -0
- package/docs/assets/projects-dark.png +0 -0
- package/docs/assets/projects-light.png +0 -0
- package/docs/assets/session-dark.png +0 -0
- package/docs/assets/sesssion-light.png +0 -0
- package/docs/index.html +896 -0
- package/package.json +25 -0
- package/public/app.js +1213 -0
- package/public/icons/icon-svg.svg +7 -0
- package/public/index.html +112 -0
- package/public/manifest.json +14 -0
- package/public/style.css +809 -0
- package/public/sw.js +47 -0
- package/server.js +734 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<rect width="512" height="512" rx="96" fill="#e86f33"/>
|
|
3
|
+
<g fill="none" stroke="white" stroke-width="32" stroke-linecap="round" stroke-linejoin="round">
|
|
4
|
+
<line x1="256" y1="96" x2="256" y2="416"/>
|
|
5
|
+
<path d="M336 176H216a48 48 0 000 96h80a48 48 0 010 96H176"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Claude Code Cost</title>
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
|
+
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Playfair+Display:wght@400;500;600&display=swap" rel="stylesheet">
|
|
10
|
+
<link rel="stylesheet" href="style.css">
|
|
11
|
+
<script defer src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
12
|
+
<link rel="manifest" href="/manifest.json">
|
|
13
|
+
<link rel="icon" type="image/svg+xml" href="/icons/icon-svg.svg">
|
|
14
|
+
<meta name="theme-color" content="#101114" media="(prefers-color-scheme: dark)">
|
|
15
|
+
<meta name="theme-color" content="#e8e6e3" media="(prefers-color-scheme: light)">
|
|
16
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
17
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
18
|
+
<link rel="apple-touch-icon" href="/icons/icon-192.png">
|
|
19
|
+
<script defer src="/app.js"></script>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<div class="topbar">
|
|
23
|
+
<div class="topbar-logo">
|
|
24
|
+
<div class="logo-mark">
|
|
25
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
26
|
+
<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"/>
|
|
27
|
+
</svg>
|
|
28
|
+
</div>
|
|
29
|
+
<span class="logo-text">Cost Dashboard</span>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="spacer"></div>
|
|
32
|
+
<div class="topbar-nav" id="viewNav">
|
|
33
|
+
<button class="topbar-nav-btn active" data-view="overview" onclick="navigate('overview')">Overview</button>
|
|
34
|
+
<button class="topbar-nav-btn" data-view="projects" onclick="navigate('projects')">Projects</button>
|
|
35
|
+
</div>
|
|
36
|
+
<select class="topbar-select" id="rangeSelect" onchange="onRangeChange(this.value)">
|
|
37
|
+
<option value="1">1 day</option>
|
|
38
|
+
<option value="3">3 days</option>
|
|
39
|
+
<option value="7" selected>7 days</option>
|
|
40
|
+
<option value="30">30 days</option>
|
|
41
|
+
<option value="90">90 days</option>
|
|
42
|
+
<option value="365">1 year</option>
|
|
43
|
+
</select>
|
|
44
|
+
<button class="topbar-btn" id="refreshBtn" title="Refresh data" onclick="refreshData()">
|
|
45
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg>
|
|
46
|
+
Refresh
|
|
47
|
+
</button>
|
|
48
|
+
<button class="topbar-btn" id="themeBtn" title="Toggle theme" onclick="toggleTheme()">
|
|
49
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" id="themeIcon"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>
|
|
50
|
+
</button>
|
|
51
|
+
<button class="topbar-btn" id="infoBtn" title="Help & About (?)" onclick="toggleHelpModal()">
|
|
52
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><circle cx="12" cy="17" r="0.5" fill="currentColor"/></svg>
|
|
53
|
+
</button>
|
|
54
|
+
<a class="topbar-btn" href="https://github.com/NikiforovAll/claude-code-cost" target="_blank" rel="noopener" title="GitHub">
|
|
55
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/></svg>
|
|
56
|
+
</a>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div class="modal-overlay" id="helpModal" onclick="if(event.target===this)toggleHelpModal()">
|
|
60
|
+
<div class="modal-box">
|
|
61
|
+
<div class="modal-header">
|
|
62
|
+
<div class="modal-title">Cost Dashboard</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="modal-body">
|
|
65
|
+
<div class="modal-section">
|
|
66
|
+
<p>All costs shown are <strong>estimates</strong> based on token counts and publicly available model pricing from <a href="https://github.com/BerriAI/litellm" target="_blank" rel="noopener">LiteLLM</a>. They may differ from your actual Anthropic billing.</p>
|
|
67
|
+
<p>Pricing is fetched live and cached for 6 hours. If the fetch fails, a bundled offline snapshot is used as fallback. This dashboard is read-only.</p>
|
|
68
|
+
</div>
|
|
69
|
+
<hr class="modal-divider">
|
|
70
|
+
<h4 class="shortcut-section">Keyboard Shortcuts</h4>
|
|
71
|
+
<div class="shortcut-grid">
|
|
72
|
+
<div>
|
|
73
|
+
<h4 class="shortcut-section">Navigation</h4>
|
|
74
|
+
<table class="shortcut-table">
|
|
75
|
+
<tr><td><kbd>1</kbd></td><td>Overview</td></tr>
|
|
76
|
+
<tr><td><kbd>2</kbd></td><td>Projects</td></tr>
|
|
77
|
+
<tr><td><kbd>Backspace</kbd></td><td>Go back</td></tr>
|
|
78
|
+
<tr><td><kbd>Esc</kbd></td><td>Close modal / go back</td></tr>
|
|
79
|
+
</table>
|
|
80
|
+
</div>
|
|
81
|
+
<div>
|
|
82
|
+
<h4 class="shortcut-section">Table</h4>
|
|
83
|
+
<table class="shortcut-table">
|
|
84
|
+
<tr><td><kbd>j</kbd> / <kbd>↓</kbd></td><td>Next row</td></tr>
|
|
85
|
+
<tr><td><kbd>k</kbd> / <kbd>↑</kbd></td><td>Previous row</td></tr>
|
|
86
|
+
<tr><td><kbd>Enter</kbd></td><td>Open selected row</td></tr>
|
|
87
|
+
</table>
|
|
88
|
+
</div>
|
|
89
|
+
<div>
|
|
90
|
+
<h4 class="shortcut-section">Actions</h4>
|
|
91
|
+
<table class="shortcut-table">
|
|
92
|
+
<tr><td><kbd>r</kbd></td><td>Refresh data</td></tr>
|
|
93
|
+
<tr><td><kbd>t</kbd></td><td>Toggle theme</td></tr>
|
|
94
|
+
<tr><td><kbd>?</kbd></td><td>Show this help</td></tr>
|
|
95
|
+
</table>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<button class="modal-close" onclick="toggleHelpModal()">Close</button>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="dashboard" id="app">
|
|
104
|
+
<div class="loading-state" id="loadingState">
|
|
105
|
+
<div class="loading-spinner"></div>
|
|
106
|
+
<span>Loading cost data...</span>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div class="toast-container" id="toast"></div>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Claude Code Cost",
|
|
3
|
+
"short_name": "CC Cost",
|
|
4
|
+
"description": "Cost dashboard for Claude Code usage",
|
|
5
|
+
"start_url": "/",
|
|
6
|
+
"display": "standalone",
|
|
7
|
+
"theme_color": "#101114",
|
|
8
|
+
"background_color": "#101114",
|
|
9
|
+
"icons": [
|
|
10
|
+
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png" },
|
|
11
|
+
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png" },
|
|
12
|
+
{ "src": "/icons/icon-svg.svg", "sizes": "any", "type": "image/svg+xml" }
|
|
13
|
+
]
|
|
14
|
+
}
|