claude-code-cost 0.4.0 → 0.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-cost",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Cost dashboard for Claude Code usage",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -21,5 +21,30 @@
21
21
  "devDependencies": {
22
22
  "husky": "^9.0.0"
23
23
  },
24
- "license": "MIT"
24
+ "keywords": [
25
+ "claude",
26
+ "claude-code",
27
+ "cost",
28
+ "dashboard",
29
+ "anthropic",
30
+ "ai",
31
+ "cli",
32
+ "usage"
33
+ ],
34
+ "homepage": "https://github.com/NikiforovAll/claude-code-cost",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/NikiforovAll/claude-code-cost.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/NikiforovAll/claude-code-cost/issues"
41
+ },
42
+ "author": "NikiforovAll",
43
+ "license": "MIT",
44
+ "files": [
45
+ "server.js",
46
+ "public/",
47
+ "README.md",
48
+ "LICENSE"
49
+ ]
25
50
  }
package/public/app.js CHANGED
@@ -111,7 +111,7 @@ function focusPreviousRow(view) {
111
111
  if (!selector) return;
112
112
  requestAnimationFrame(() => {
113
113
  const rows = getVisibleRows();
114
- const idx = rows.findIndex(r => r.matches(selector));
114
+ const idx = rows.findIndex((r) => r.matches(selector));
115
115
  selectRow(idx >= 0 ? idx : 0);
116
116
  });
117
117
  }
@@ -149,7 +149,9 @@ function loadSort(view) {
149
149
  const { field, order } = JSON.parse(raw);
150
150
  if (field) sortField = field;
151
151
  if (order) sortOrder = order;
152
- } catch { /* ignore */ }
152
+ } catch {
153
+ /* ignore */
154
+ }
153
155
  }
154
156
  }
155
157
 
@@ -477,7 +479,8 @@ function renderSessions() {
477
479
  <th class="${thClass('lastTimestamp')}" onclick="sortBy('lastTimestamp')">Last Active ${sortArrow('lastTimestamp')}</th>
478
480
  </tr></thead>
479
481
  <tbody>
480
- ${[...sessionsData].sort((a, b) => sortCompare(a, b, sortField, sortOrder))
482
+ ${[...sessionsData]
483
+ .sort((a, b) => sortCompare(a, b, sortField, sortOrder))
481
484
  .map(
482
485
  (s) => `
483
486
  <tr data-clickable onclick="navigateToDetail('${esc(s.sessionId)}')">
package/public/index.html CHANGED
@@ -81,16 +81,16 @@
81
81
  <div>
82
82
  <h4 class="shortcut-section">Table</h4>
83
83
  <table class="shortcut-table">
84
- <tr><td><kbd>j</kbd> / <kbd>&darr;</kbd></td><td>Next row</td></tr>
85
- <tr><td><kbd>k</kbd> / <kbd>&uarr;</kbd></td><td>Previous row</td></tr>
84
+ <tr><td><kbd>J</kbd> / <kbd>&darr;</kbd></td><td>Next row</td></tr>
85
+ <tr><td><kbd>K</kbd> / <kbd>&uarr;</kbd></td><td>Previous row</td></tr>
86
86
  <tr><td><kbd>Enter</kbd></td><td>Open selected row</td></tr>
87
87
  </table>
88
88
  </div>
89
89
  <div>
90
90
  <h4 class="shortcut-section">Actions</h4>
91
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>
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
94
  <tr><td><kbd>?</kbd></td><td>Show this help</td></tr>
95
95
  </table>
96
96
  </div>
package/server.js CHANGED
@@ -538,7 +538,7 @@ async function getProjectSessionsData(encodedPath, days) {
538
538
  if (cutoff) cutoff.setDate(cutoff.getDate() - days);
539
539
  const projects = scanProjectDirs(cutoff);
540
540
  const proj = projects.get(encodedPath);
541
- if (!proj) return [];
541
+ if (!proj) return { sessions: [], daily: [], modelDistribution: [] };
542
542
 
543
543
  const sessions = await loadProjectData(proj.files, pricing);
544
544
  const cutoffStr = cutoff ? cutoff.toISOString() : null;
@@ -1,54 +0,0 @@
1
- ---
2
- description: Bump version, tag, push, and create a GitHub release with auto-generated notes
3
- argument-hint: "[version e.g. 1.13.0 or rc4]"
4
- ---
5
-
6
- # Release
7
-
8
- Create a new release for this project.
9
-
10
- ## Inputs
11
-
12
- - `$ARGUMENTS` — target version or shorthand. Examples:
13
- - `1.13.0` — full version
14
- - `rc4` — shorthand for next RC (e.g. if current is `1.19.0-rc.3`, becomes `1.19.0-rc.4`)
15
- - If not provided, ask the user.
16
-
17
- ## Steps
18
-
19
- 1. **Determine version**: Use `$ARGUMENTS` or ask user. Handle `rc<N>` shorthand by reading current version from `package.json` and replacing/appending the RC suffix. Validate it's different from the current version.
20
-
21
- 2. **Detect prerelease**: If version contains `-rc.`, `-alpha.`, `-beta.`, treat as prerelease.
22
-
23
- 3. **Check working tree**: Run `git status`. If there are uncommitted changes, warn the user and stop.
24
-
25
- 4. **Bump version**:
26
- ```
27
- npm version <version> --no-git-tag-version
28
- ```
29
-
30
- 5. **Commit & push** (push to current branch, not hardcoded `main`):
31
- ```
32
- git add package.json package-lock.json
33
- git commit -m "🔖 chore: Bump version to <version>"
34
- git push origin HEAD
35
- ```
36
-
37
- 6. **Tag & push tag**:
38
- ```
39
- git tag v<version>
40
- git push origin v<version>
41
- ```
42
-
43
- 7. **Generate release notes**: Collect commits since the previous tag using `git log --oneline <prev-tag>..HEAD`. Write a **user-facing summary** grouped by:
44
- - Features (✨) — describe what was added, not raw commit messages
45
- - Fixes (🐛)
46
- - Other notable changes
47
- Include a "Full Changelog" compare link at the bottom.
48
-
49
- 8. **Create GitHub release** (add `--prerelease` flag for RC/alpha/beta):
50
- ```
51
- gh release create v<version> --title "v<version>" --notes "<notes>" [--prerelease]
52
- ```
53
-
54
- 9. **Report**: Show the release URL to the user.
@@ -1,39 +0,0 @@
1
- name: Deploy to GitHub Pages
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths:
7
- - 'docs/**'
8
- - 'assets/**'
9
- workflow_dispatch:
10
-
11
- permissions:
12
- contents: read
13
- pages: write
14
- id-token: write
15
-
16
- concurrency:
17
- group: pages
18
- cancel-in-progress: false
19
-
20
- jobs:
21
- deploy:
22
- environment:
23
- name: github-pages
24
- url: ${{ steps.deployment.outputs.page_url }}
25
- runs-on: ubuntu-latest
26
- steps:
27
- - uses: actions/checkout@v4
28
-
29
- - name: Copy assets into docs for flat serving
30
- run: cp -r assets docs/assets
31
-
32
- - uses: actions/configure-pages@v5
33
-
34
- - uses: actions/upload-pages-artifact@v3
35
- with:
36
- path: docs
37
-
38
- - id: deployment
39
- uses: actions/deploy-pages@v4
package/.husky/pre-commit DELETED
@@ -1 +0,0 @@
1
- npx @biomejs/biome check --error-on-warnings public/app.js public/style.css
package/CLAUDE.md DELETED
@@ -1,42 +0,0 @@
1
- # Claude Code Cost Dashboard
2
-
3
- Cost visualization dashboard for Claude Code usage. Reads JSONL session files from `~/.claude/projects/` and displays costs with top-down drill-down: total → project → session → message.
4
-
5
- ## Commands
6
-
7
- ```bash
8
- npm start # Start server on port 3458
9
- npm run dev # Start with --open flag
10
- node server.js --port 3000 --open # Custom port
11
- ```
12
-
13
- ## Architecture
14
-
15
- - **server.js** — Express server with pricing module, JSONL parsing, data aggregation
16
- - **public/app.js** — Vanilla JS SPA with Chart.js, no build step
17
- - **public/style.css** — CSS variables, dark/light theme (matches cck + marketplace)
18
-
19
- ## Data Flow
20
-
21
- ```
22
- ~/.claude/projects/**/*.jsonl → server.js (parse + aggregate) → REST API → app.js (render + Chart.js)
23
- ```
24
-
25
- ## Pricing
26
-
27
- Dynamic pricing from LiteLLM (`model_prices_and_context_window.json`). Supports tiered pricing (200k threshold), cache token costs, fast mode multiplier. Offline fallback included.
28
-
29
- ## Conventions
30
-
31
- - Vanilla JS only, no frameworks, no build step
32
- - `#region` markers in all JS/CSS files
33
- - CSS variables for theming (shared with cck/marketplace)
34
- - Hub integration via `/hub-config` + `window.__HUB__`
35
-
36
- ## app.js Regions
37
-
38
- STATE, UTILS, URL_STATE, FETCH, RENDER_OVERVIEW, RENDER_PROJECTS, RENDER_SESSIONS, RENDER_DETAIL, CHARTS, THEME, ROUTER, TOAST, HUB_INTEGRATION, INIT
39
-
40
- ## style.css Regions
41
-
42
- VARIABLES, RESET, SCROLLBAR, TOPBAR, LAYOUT, CARDS, CHARTS, TABLE, BREADCRUMB, DETAIL, LOADING, TOAST, LIGHT_THEME, RESPONSIVE
package/PLAN-CONTEXT.md DELETED
@@ -1,83 +0,0 @@
1
- # Claude Code Cost Dashboard — Planning Context
2
-
3
- ## What
4
- Build `claude-code-cost` — a cost dashboard web app for Claude Code Hub. It visualizes Claude Code usage costs with a **top-down drill-down** approach: total costs → per-project → per-session.
5
-
6
- ## Why
7
- The ecosystem has 10+ CLI/TUI cost tools (ccusage, ccburn, ccost, tokscale) but **no polished embeddable web dashboard**. This fills that gap as a new tab in Claude Code Hub alongside kanban and marketplace.
8
-
9
- ## How
10
-
11
- ### Architecture (match sibling apps exactly)
12
- Follow the same Express + vanilla JS + no-build-step pattern used by:
13
- - `../cck/` — kanban app (Express + chokidar + SSE + vanilla JS)
14
- - `../claude-code-marketplace/` — marketplace app (Express + vanilla JS)
15
-
16
- Study these reference codebases (available via --add-dir):
17
- - **Server pattern**: `server.js` with Express, CLI args (--port, --open), `/hub-config` endpoint, static serving
18
- - **Frontend pattern**: `public/app.js` with #region markers, vanilla JS, HTML string rendering, no frameworks
19
- - **Theme system**: CSS variables, dark/light toggle, IBM Plex Mono + Playfair Display fonts, orange accent (#e86f33)
20
- - **Hub integration**: `/hub-config` endpoint, `window.__HUB__`, postMessage forwarding (Ctrl+Alt+Arrow, Alt+1-9)
21
- - **Real-time updates**: chokidar file watchers + SSE broadcasting (from cck)
22
-
23
- ### Pricing — CRITICAL
24
- **DO NOT hardcode model prices.** Study `../ccusage-reference/` source code to understand how ccusage handles pricing dynamically. Use the same approach (whether it's a pricing module, API fetch, or configurable table). The dashboard must stay accurate as models/prices evolve.
25
-
26
- ### Data Sources (all local filesystem, no external APIs)
27
-
28
- 1. **~/.claude/projects/{path}/{session-id}.jsonl** — Raw conversation logs. Each assistant message has:
29
- ```json
30
- "usage": {
31
- "input_tokens": 3,
32
- "cache_creation_input_tokens": 15696,
33
- "cache_read_input_tokens": 0,
34
- "output_tokens": 143
35
- }
36
- ```
37
- Plus `model`, `timestamp`, `sessionId`. This is the primary source for accurate cost calculation.
38
-
39
- 2. **~/.claude/stats-cache.json** — Pre-computed daily aggregates:
40
- - `dailyActivity[]`: date, messageCount, sessionCount, toolCallCount
41
- - `dailyModelTokens[]`: date, tokensByModel (model name → total tokens)
42
-
43
- 3. **~/.claude/usage-data/session-meta/{id}.json** — Per-session metadata:
44
- - input_tokens, output_tokens, project_path, start_time, duration_minutes
45
- - tool_counts, first_prompt, uses_mcp, uses_web_search, lines_added/removed
46
-
47
- 4. **~/.claude/usage-data/facets/{id}.json** — Session quality/outcome metadata
48
-
49
- ### UI — Top-Down Drill-Down
50
- The dashboard should flow top-down:
51
- 1. **Overview cards** — Total cost today/this week/this month, total sessions, total tokens
52
- 2. **Daily cost trend** — Line/bar chart with 7-day moving average
53
- 3. **Per-project breakdown** — Table/cards showing cost per project, sortable
54
- 4. **Per-session details** — Click project to see sessions, click session for message-level cost
55
- 5. **Supporting charts** — Token breakdown (input/output/cache stacked bar), model distribution (donut), cache efficiency ratio, activity heatmap
56
-
57
- ### Tech Stack
58
- - Express.js + chokidar + SSE (server)
59
- - Vanilla JS with #region markers (frontend)
60
- - Chart.js via CDN (charts)
61
- - CSS variables for dark/light theme
62
- - PWA-ready (manifest.json, sw.js, icons/)
63
-
64
- ## When (Scope)
65
- - Plan mode only — design the full implementation plan
66
- - Core cost dashboard features first
67
- - Hub integration included from the start
68
- - No external API dependencies (all local data)
69
-
70
- ## Target Structure
71
- ```
72
- claude-code-cost/
73
- ├── server.js
74
- ├── package.json
75
- ├── CLAUDE.md
76
- ├── public/
77
- │ ├── index.html
78
- │ ├── app.js
79
- │ ├── style.css
80
- │ ├── sw.js
81
- │ ├── manifest.json
82
- │ └── icons/
83
- ```
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/biome.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
3
- "formatter": {
4
- "enabled": true,
5
- "indentStyle": "space",
6
- "indentWidth": 2,
7
- "lineWidth": 120
8
- },
9
- "linter": {
10
- "enabled": true,
11
- "rules": {
12
- "style": {
13
- "noDescendingSpecificity": "off"
14
- },
15
- "suspicious": {
16
- "useIterableCallbackReturn": "off"
17
- }
18
- }
19
- },
20
- "javascript": {
21
- "formatter": {
22
- "quoteStyle": "single"
23
- }
24
- },
25
- "css": {
26
- "formatter": {
27
- "quoteStyle": "single"
28
- }
29
- },
30
- "files": {
31
- "includes": ["public/app.js", "public/style.css"]
32
- }
33
- }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/docs/index.html DELETED
@@ -1,896 +0,0 @@
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 — Know what Claude Code costs you</title>
7
- <meta name="description" content="A cost visualization dashboard for Claude Code. Track spending per day, per project, per session with dynamic pricing and drill-down views.">
8
- <meta property="og:title" content="Claude Code Cost">
9
- <meta property="og:description" content="Know what Claude Code costs you — per day, per project, per session.">
10
- <meta property="og:type" content="website">
11
- <meta property="og:url" content="https://nikiforovall.blog/claude-code-cost/">
12
- <meta property="og:image" content="https://raw.githubusercontent.com/NikiforovAll/claude-code-cost/main/assets/sesssion-light.png">
13
- <meta name="twitter:card" content="summary_large_image">
14
- <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%231a1a1a'/%3E%3Cpath d='M16 6v20M20 10h-5.5a3.5 3.5 0 000 7h3a3.5 3.5 0 010 7H12' stroke='%23e8927c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E">
15
- <link rel="preconnect" href="https://fonts.googleapis.com">
16
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
17
- <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Playfair+Display:wght@400;500;600;700&display=swap" rel="stylesheet">
18
- <style>
19
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
20
-
21
- :root {
22
- --bg: #faf9f7;
23
- --bg-alt: #f3f1ee;
24
- --bg-dark: #1a1a1a;
25
- --text: #2a2a2a;
26
- --text-secondary: #5a5a5a;
27
- --text-muted: #8a8a8a;
28
- --accent: #E86F33;
29
- --accent-light: #e8927c;
30
- --accent-dim: rgba(232, 111, 51, 0.1);
31
- --accent-glow: rgba(232, 111, 51, 0.25);
32
- --border: #e0ddd8;
33
- --mono: 'IBM Plex Mono', monospace;
34
- --serif: 'Playfair Display', serif;
35
- --max-w: 1120px;
36
- --section-gap: 120px;
37
- }
38
-
39
- html { scroll-behavior: smooth; }
40
-
41
- body {
42
- font-family: var(--mono);
43
- font-size: 15px;
44
- background: var(--bg);
45
- color: var(--text);
46
- line-height: 1.65;
47
- -webkit-font-smoothing: antialiased;
48
- overflow-x: hidden;
49
- }
50
-
51
- body::after {
52
- content: '';
53
- position: fixed;
54
- inset: 0;
55
- pointer-events: none;
56
- opacity: 0.03;
57
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
58
- background-size: 256px 256px;
59
- z-index: 9999;
60
- }
61
-
62
- .container { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
63
-
64
- /* -- NAV -- */
65
- nav {
66
- position: fixed;
67
- top: 0;
68
- left: 0;
69
- right: 0;
70
- z-index: 100;
71
- background: rgba(250, 249, 247, 0.85);
72
- backdrop-filter: blur(12px);
73
- -webkit-backdrop-filter: blur(12px);
74
- border-bottom: 1px solid var(--border);
75
- transition: box-shadow 0.3s;
76
- }
77
- nav.scrolled { box-shadow: 0 1px 8px rgba(0,0,0,0.06); }
78
- nav .container {
79
- display: flex;
80
- align-items: center;
81
- justify-content: space-between;
82
- height: 60px;
83
- }
84
- .nav-brand {
85
- display: flex;
86
- align-items: center;
87
- gap: 10px;
88
- text-decoration: none;
89
- color: var(--text);
90
- }
91
- .nav-brand svg { width: 28px; height: 28px; }
92
- .nav-brand span {
93
- font-family: var(--mono);
94
- font-weight: 600;
95
- font-size: 14px;
96
- letter-spacing: -0.02em;
97
- }
98
- .nav-links { display: flex; align-items: center; gap: 24px; }
99
- .nav-links a {
100
- font-size: 13px;
101
- color: var(--text-secondary);
102
- text-decoration: none;
103
- transition: color 0.2s;
104
- }
105
- .nav-links a:hover { color: var(--accent); }
106
- .nav-gh {
107
- display: flex;
108
- align-items: center;
109
- gap: 6px;
110
- padding: 6px 14px;
111
- border: 1px solid var(--border);
112
- border-radius: 6px;
113
- font-size: 13px;
114
- color: var(--text);
115
- text-decoration: none;
116
- transition: border-color 0.2s, background 0.2s;
117
- }
118
- .nav-gh:hover { border-color: var(--accent); background: var(--accent-dim); }
119
- .nav-gh svg { width: 16px; height: 16px; }
120
-
121
- /* -- HERO -- */
122
- .hero {
123
- padding-top: 140px;
124
- padding-bottom: var(--section-gap);
125
- text-align: center;
126
- }
127
- .hero-badge {
128
- display: inline-flex;
129
- align-items: center;
130
- gap: 8px;
131
- padding: 6px 16px;
132
- background: var(--accent-dim);
133
- border: 1px solid rgba(232, 111, 51, 0.2);
134
- border-radius: 100px;
135
- font-size: 12px;
136
- color: var(--accent);
137
- font-weight: 500;
138
- margin-bottom: 32px;
139
- letter-spacing: 0.02em;
140
- }
141
- .hero-badge .dot {
142
- width: 6px;
143
- height: 6px;
144
- border-radius: 50%;
145
- background: var(--accent);
146
- animation: pulse 2s ease-in-out infinite;
147
- }
148
- @keyframes pulse {
149
- 0%, 100% { opacity: 1; }
150
- 50% { opacity: 0.3; }
151
- }
152
- .hero h1 {
153
- font-family: var(--serif);
154
- font-size: clamp(40px, 6vw, 68px);
155
- font-weight: 700;
156
- line-height: 1.1;
157
- letter-spacing: -0.03em;
158
- color: var(--bg-dark);
159
- margin-bottom: 24px;
160
- }
161
- .hero h1 em {
162
- font-style: italic;
163
- color: var(--accent);
164
- }
165
- .hero-sub {
166
- font-size: 16px;
167
- color: var(--text-secondary);
168
- max-width: 560px;
169
- margin: 0 auto 40px;
170
- line-height: 1.7;
171
- }
172
-
173
- /* Install block */
174
- .install-block {
175
- display: inline-flex;
176
- align-items: center;
177
- gap: 0;
178
- background: var(--bg-dark);
179
- border-radius: 10px;
180
- overflow: hidden;
181
- margin-bottom: 56px;
182
- box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(255,255,255,0.05) inset;
183
- }
184
- .install-block code {
185
- display: block;
186
- padding: 14px 20px 14px 24px;
187
- font-family: var(--mono);
188
- font-size: 14px;
189
- color: #f0f1f3;
190
- white-space: nowrap;
191
- letter-spacing: -0.01em;
192
- }
193
- .install-block code .prompt { color: var(--accent-light); }
194
- .install-copy {
195
- padding: 14px 18px;
196
- background: none;
197
- border: none;
198
- border-left: 1px solid #333;
199
- color: #888;
200
- cursor: pointer;
201
- transition: color 0.2s, background 0.2s;
202
- display: flex;
203
- align-items: center;
204
- }
205
- .install-copy:hover { color: #fff; background: rgba(255,255,255,0.05); }
206
- .install-copy svg { width: 16px; height: 16px; }
207
- .install-copy.copied { color: #3ecf8e; }
208
-
209
- /* Hero screenshot */
210
- .hero-screenshot {
211
- max-width: 960px;
212
- margin: 0 auto;
213
- border-radius: 12px;
214
- overflow: hidden;
215
- box-shadow:
216
- 0 8px 40px rgba(0,0,0,0.12),
217
- 0 2px 8px rgba(0,0,0,0.06);
218
- transform: perspective(1200px) rotateX(2deg);
219
- transition: transform 0.4s ease;
220
- }
221
- .hero-screenshot:hover { transform: perspective(1200px) rotateX(0deg); }
222
- .hero-screenshot { cursor: pointer; }
223
- .hero-screenshot img {
224
- width: 100%;
225
- display: block;
226
- }
227
-
228
- /* -- FEATURES -- */
229
- .features { padding-bottom: var(--section-gap); }
230
- .section-label {
231
- font-size: 12px;
232
- font-weight: 600;
233
- text-transform: uppercase;
234
- letter-spacing: 0.1em;
235
- color: var(--accent);
236
- margin-bottom: 12px;
237
- }
238
- .section-title {
239
- font-family: var(--serif);
240
- font-size: clamp(28px, 4vw, 40px);
241
- font-weight: 600;
242
- color: var(--bg-dark);
243
- letter-spacing: -0.02em;
244
- margin-bottom: 56px;
245
- line-height: 1.2;
246
- }
247
- .features-grid {
248
- display: grid;
249
- grid-template-columns: repeat(3, 1fr);
250
- gap: 24px;
251
- }
252
- .feature-card {
253
- padding: 28px;
254
- background: var(--bg);
255
- border: 1px solid var(--border);
256
- border-radius: 10px;
257
- cursor: default;
258
- transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
259
- }
260
- .feature-card:hover {
261
- border-color: var(--accent-light);
262
- box-shadow: 0 4px 20px var(--accent-glow);
263
- transform: translateY(-2px);
264
- }
265
- .feature-icon {
266
- width: 40px;
267
- height: 40px;
268
- display: flex;
269
- align-items: center;
270
- justify-content: center;
271
- background: var(--accent-dim);
272
- border-radius: 8px;
273
- margin-bottom: 16px;
274
- color: var(--accent);
275
- font-size: 18px;
276
- }
277
- .feature-card h3 {
278
- font-family: var(--mono);
279
- font-size: 14px;
280
- font-weight: 600;
281
- margin-bottom: 8px;
282
- color: var(--bg-dark);
283
- }
284
- .feature-card p {
285
- font-size: 13px;
286
- color: var(--text-secondary);
287
- line-height: 1.6;
288
- }
289
-
290
- /* -- HOW IT WORKS -- */
291
- .how-it-works {
292
- padding-bottom: var(--section-gap);
293
- }
294
- .steps {
295
- display: grid;
296
- grid-template-columns: repeat(3, 1fr);
297
- gap: 32px;
298
- position: relative;
299
- }
300
- .steps::before {
301
- content: '';
302
- position: absolute;
303
- top: 32px;
304
- left: calc(33.33% / 2 + 32px);
305
- right: calc(33.33% / 2 + 32px);
306
- height: 2px;
307
- background: var(--border);
308
- }
309
- .step {
310
- text-align: center;
311
- position: relative;
312
- }
313
- .step-num {
314
- width: 64px;
315
- height: 64px;
316
- border-radius: 50%;
317
- display: flex;
318
- align-items: center;
319
- justify-content: center;
320
- font-family: var(--serif);
321
- font-size: 24px;
322
- font-weight: 700;
323
- color: var(--accent);
324
- background: var(--bg);
325
- border: 2px solid var(--border);
326
- margin: 0 auto 20px;
327
- position: relative;
328
- z-index: 1;
329
- transition: border-color 0.3s, background 0.3s;
330
- }
331
- .step:hover .step-num {
332
- border-color: var(--accent);
333
- background: var(--accent-dim);
334
- }
335
- .step-code {
336
- display: inline-block;
337
- padding: 8px 16px;
338
- background: var(--bg-dark);
339
- border-radius: 6px;
340
- font-size: 12px;
341
- color: #f0f1f3;
342
- margin-top: 12px;
343
- font-family: var(--mono);
344
- }
345
- .step h3 {
346
- font-family: var(--mono);
347
- font-size: 14px;
348
- font-weight: 600;
349
- margin-bottom: 8px;
350
- color: var(--bg-dark);
351
- }
352
- .step p {
353
- font-size: 13px;
354
- color: var(--text-secondary);
355
- max-width: 260px;
356
- margin: 0 auto;
357
- line-height: 1.6;
358
- }
359
-
360
- /* -- SCREENSHOTS -- */
361
- .screenshots {
362
- padding-bottom: var(--section-gap);
363
- }
364
- .screenshots-header {
365
- display: flex;
366
- align-items: flex-end;
367
- justify-content: space-between;
368
- margin-bottom: 40px;
369
- }
370
- .theme-toggle {
371
- display: flex;
372
- gap: 4px;
373
- padding: 4px;
374
- background: var(--bg-alt);
375
- border-radius: 8px;
376
- border: 1px solid var(--border);
377
- }
378
- .theme-toggle button {
379
- padding: 8px 16px;
380
- border: none;
381
- border-radius: 6px;
382
- font-family: var(--mono);
383
- font-size: 12px;
384
- font-weight: 500;
385
- cursor: pointer;
386
- background: transparent;
387
- color: var(--text-muted);
388
- transition: all 0.2s;
389
- }
390
- .theme-toggle button.active {
391
- background: var(--bg);
392
- color: var(--text);
393
- box-shadow: 0 1px 4px rgba(0,0,0,0.08);
394
- }
395
- .ss-grid {
396
- display: grid;
397
- grid-template-columns: 1fr 1fr;
398
- gap: 24px;
399
- }
400
- .screenshot-frame {
401
- border-radius: 12px;
402
- overflow: hidden;
403
- border: 1px solid var(--border);
404
- box-shadow: 0 8px 40px rgba(0,0,0,0.08);
405
- cursor: pointer;
406
- position: relative;
407
- }
408
- .screenshot-frame::after {
409
- content: 'Click to enlarge';
410
- position: absolute;
411
- bottom: 12px;
412
- right: 16px;
413
- padding: 4px 10px;
414
- background: rgba(0,0,0,0.6);
415
- color: #fff;
416
- font-size: 11px;
417
- border-radius: 4px;
418
- opacity: 0;
419
- transition: opacity 0.2s;
420
- pointer-events: none;
421
- }
422
- .screenshot-frame:hover::after { opacity: 1; }
423
- .screenshot-frame img {
424
- width: 100%;
425
- display: block;
426
- }
427
- .screenshot-frame img.hidden { display: none; }
428
- .ss-label {
429
- font-size: 12px;
430
- color: var(--text-muted);
431
- text-align: center;
432
- margin-top: 8px;
433
- font-weight: 500;
434
- }
435
-
436
- /* -- LIGHTBOX -- */
437
- .lightbox {
438
- position: fixed;
439
- inset: 0;
440
- z-index: 200;
441
- background: rgba(0, 0, 0, 0.85);
442
- backdrop-filter: blur(8px);
443
- display: flex;
444
- align-items: center;
445
- justify-content: center;
446
- padding: 40px;
447
- cursor: pointer;
448
- opacity: 0;
449
- visibility: hidden;
450
- transition: opacity 0.3s, visibility 0.3s;
451
- }
452
- .lightbox.open {
453
- opacity: 1;
454
- visibility: visible;
455
- }
456
- .lightbox img {
457
- max-width: 90vw;
458
- max-height: 90vh;
459
- border-radius: 12px;
460
- box-shadow: 0 16px 64px rgba(0,0,0,0.6);
461
- transform: scale(0.95);
462
- transition: transform 0.3s ease;
463
- }
464
- .lightbox.open img { transform: scale(1); }
465
- .lightbox-close {
466
- position: absolute;
467
- top: 24px;
468
- right: 32px;
469
- width: 40px;
470
- height: 40px;
471
- border: none;
472
- background: rgba(255,255,255,0.1);
473
- border-radius: 50%;
474
- color: #fff;
475
- font-size: 20px;
476
- cursor: pointer;
477
- display: flex;
478
- align-items: center;
479
- justify-content: center;
480
- transition: background 0.2s;
481
- }
482
- .lightbox-close:hover { background: rgba(255,255,255,0.2); }
483
-
484
- /* -- FAQ -- */
485
- .faq { padding-bottom: var(--section-gap); }
486
- .faq-list { max-width: 720px; }
487
- .faq-item {
488
- border-bottom: 1px solid var(--border);
489
- }
490
- .faq-item:first-child { border-top: 1px solid var(--border); }
491
- .faq-q {
492
- display: flex;
493
- align-items: center;
494
- justify-content: space-between;
495
- width: 100%;
496
- padding: 20px 0;
497
- background: none;
498
- border: none;
499
- font-family: var(--mono);
500
- font-size: 14px;
501
- font-weight: 500;
502
- color: var(--text);
503
- cursor: pointer;
504
- text-align: left;
505
- gap: 16px;
506
- }
507
- .faq-q:hover { color: var(--accent); }
508
- .faq-chevron {
509
- width: 20px;
510
- height: 20px;
511
- flex-shrink: 0;
512
- transition: transform 0.3s;
513
- color: var(--text-muted);
514
- }
515
- .faq-item.open .faq-chevron { transform: rotate(180deg); }
516
- .faq-a {
517
- max-height: 0;
518
- overflow: hidden;
519
- transition: max-height 0.35s ease, padding 0.35s ease;
520
- }
521
- .faq-item.open .faq-a {
522
- max-height: 200px;
523
- padding-bottom: 20px;
524
- }
525
- .faq-a p {
526
- font-size: 13px;
527
- color: var(--text-secondary);
528
- line-height: 1.7;
529
- }
530
-
531
- /* -- FOOTER -- */
532
- footer {
533
- padding: 40px 0;
534
- border-top: 1px solid var(--border);
535
- }
536
- footer .container {
537
- display: flex;
538
- align-items: center;
539
- justify-content: space-between;
540
- }
541
- .footer-left {
542
- display: flex;
543
- align-items: center;
544
- gap: 20px;
545
- font-size: 13px;
546
- color: var(--text-muted);
547
- }
548
- .footer-left a {
549
- color: var(--text-secondary);
550
- text-decoration: none;
551
- transition: color 0.2s;
552
- }
553
- .footer-left a:hover { color: var(--accent); }
554
- .footer-right {
555
- display: flex;
556
- align-items: center;
557
- gap: 16px;
558
- }
559
- .footer-right a {
560
- color: var(--text-muted);
561
- text-decoration: none;
562
- font-size: 13px;
563
- transition: color 0.2s;
564
- }
565
- .footer-right a:hover { color: var(--accent); }
566
-
567
- /* -- ANIMATIONS -- */
568
- .fade-in {
569
- opacity: 0;
570
- transform: translateY(20px);
571
- transition: opacity 0.6s ease, transform 0.6s ease;
572
- }
573
- .fade-in.visible {
574
- opacity: 1;
575
- transform: translateY(0);
576
- }
577
- .fade-in.delay-1 { transition-delay: 0.1s; }
578
- .fade-in.delay-2 { transition-delay: 0.2s; }
579
- .fade-in.delay-3 { transition-delay: 0.3s; }
580
- .fade-in.delay-4 { transition-delay: 0.4s; }
581
- .fade-in.delay-5 { transition-delay: 0.5s; }
582
-
583
- /* -- RESPONSIVE -- */
584
- @media (max-width: 768px) {
585
- :root { --section-gap: 80px; }
586
- .container { padding: 0 20px; }
587
- .hero { padding-top: 110px; }
588
- .hero-sub { font-size: 14px; }
589
- .features-grid { grid-template-columns: 1fr; gap: 16px; }
590
- .steps { grid-template-columns: 1fr; gap: 40px; }
591
- .steps::before { display: none; }
592
- .nav-links a:not(.nav-gh) { display: none; }
593
- .screenshots-header { flex-direction: column; align-items: flex-start; gap: 16px; }
594
- .hero-screenshot { transform: none; }
595
- .hero-screenshot:hover { transform: none; }
596
- .install-block code { font-size: 12px; padding: 12px 14px; }
597
- footer .container { flex-direction: column; gap: 16px; text-align: center; }
598
- .ss-grid { grid-template-columns: 1fr; }
599
- }
600
-
601
- @media (min-width: 769px) and (max-width: 1024px) {
602
- .features-grid { grid-template-columns: repeat(2, 1fr); }
603
- }
604
- </style>
605
- </head>
606
- <body>
607
-
608
- <!-- NAV -->
609
- <nav>
610
- <div class="container">
611
- <a href="#" class="nav-brand">
612
- <svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
613
- <rect width="32" height="32" rx="6" fill="#1a1a1a"/>
614
- <path d="M16 6v20M20 10h-5.5a3.5 3.5 0 000 7h3a3.5 3.5 0 010 7H12" stroke="#e8927c" stroke-width="2" fill="none" stroke-linecap="round"/>
615
- </svg>
616
- <span>Claude Code Cost</span>
617
- </a>
618
- <div class="nav-links">
619
- <a href="#features">Features</a>
620
- <a href="#how-it-works">How it works</a>
621
- <a href="#faq">FAQ</a>
622
- <a href="https://github.com/NikiforovAll/claude-code-cost" class="nav-gh" target="_blank" rel="noopener">
623
- <svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
624
- GitHub
625
- </a>
626
- </div>
627
- </div>
628
- </nav>
629
-
630
- <!-- HERO -->
631
- <section class="hero">
632
- <div class="container">
633
- <div class="fade-in">
634
- <div class="hero-badge">
635
- <span class="dot"></span>
636
- Open source &middot; MIT
637
- </div>
638
- </div>
639
- <h1 class="fade-in delay-1">Know what Claude Code<br><em>costs</em> you</h1>
640
- <p class="hero-sub fade-in delay-2">A cost visualization dashboard for Claude Code. Track spending per day, per project, per session -- with dynamic pricing and drill-down views.</p>
641
- <div class="fade-in delay-3">
642
- <div class="install-block">
643
- <code><span class="prompt">$</span> npx claude-code-cost --open</code>
644
- <button class="install-copy" onclick="copyInstall(this)" title="Copy to clipboard">
645
- <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="5" y="5" width="9" height="9" rx="1.5"/><path d="M5 11H3.5A1.5 1.5 0 012 9.5v-7A1.5 1.5 0 013.5 1h7A1.5 1.5 0 0112 2.5V5"/></svg>
646
- </button>
647
- </div>
648
- </div>
649
- <div class="hero-screenshot fade-in delay-4">
650
- <img src="assets/sesssion-light.png" alt="Claude Code Cost dashboard">
651
- </div>
652
- </div>
653
- </section>
654
-
655
- <!-- FEATURES -->
656
- <section class="features" id="features">
657
- <div class="container">
658
- <p class="section-label fade-in">Features</p>
659
- <h2 class="section-title fade-in">Everything you need to<br>understand your Claude Code spend</h2>
660
- <div class="features-grid">
661
- <div class="feature-card fade-in">
662
- <div class="feature-icon">
663
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 17V7l4-4h6l4 4v10H3z"/><path d="M7 17v-5h6v5"/></svg>
664
- </div>
665
- <h3>Top-down drill-down</h3>
666
- <p>Total cost to per-project to per-session to per-message. Click through to see exactly where your budget goes.</p>
667
- </div>
668
- <div class="feature-card fade-in delay-1">
669
- <div class="feature-icon">
670
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 2v16M14 6h-5.5a3 3 0 000 6h3a3 3 0 010 6H6"/></svg>
671
- </div>
672
- <h3>Dynamic pricing</h3>
673
- <p>Live model prices from LiteLLM. Tiered pricing at 200K tokens, cache token costs, and fast mode multipliers -- all handled automatically.</p>
674
- </div>
675
- <div class="feature-card fade-in delay-2">
676
- <div class="feature-icon">
677
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="6" width="3" height="12" rx="1"/><rect x="8.5" y="3" width="3" height="15" rx="1"/><rect x="15" y="8" width="3" height="10" rx="1"/></svg>
678
- </div>
679
- <h3>Daily cost chart</h3>
680
- <p>Bar chart with configurable date range: 1 day, 3 days, 7 days, 30 days, 90 days, or 1 year. See trends at a glance.</p>
681
- </div>
682
- <div class="feature-card fade-in delay-3">
683
- <div class="feature-icon">
684
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="8"/><path d="M10 10V4"/><path d="M10 10l5 5"/></svg>
685
- </div>
686
- <h3>Model breakdown</h3>
687
- <p>See cost distribution across models. Know how much you spend on Opus vs Sonnet vs Haiku.</p>
688
- </div>
689
- <div class="feature-card fade-in delay-4">
690
- <div class="feature-icon">
691
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="3"/><path d="M10 3v2M10 15v2M3 10h2M15 10h2M5.05 5.05l1.41 1.41M13.54 13.54l1.41 1.41M5.05 14.95l1.41-1.41M13.54 6.46l1.41-1.41"/></svg>
692
- </div>
693
- <h3>Dark / light theme</h3>
694
- <p>Styled with IBM Plex Mono and Playfair Display. Automatic theme detection or manual toggle. PWA installable.</p>
695
- </div>
696
- <div class="feature-card fade-in delay-5">
697
- <div class="feature-icon">
698
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h12v12H4z"/><path d="M4 8h12M8 4v12"/></svg>
699
- </div>
700
- <h3>Cache efficiency</h3>
701
- <p>Track how well prompt caching works across sessions. See cache read ratios and creation costs per message.</p>
702
- </div>
703
- </div>
704
- </div>
705
- </section>
706
-
707
- <!-- HOW IT WORKS -->
708
- <section class="how-it-works" id="how-it-works">
709
- <div class="container">
710
- <p class="section-label fade-in">Setup</p>
711
- <h2 class="section-title fade-in">One command. Full cost visibility.</h2>
712
- <div class="steps">
713
- <div class="step fade-in">
714
- <div class="step-num">1</div>
715
- <h3>Run it</h3>
716
- <p>One command to launch. No setup, no config, no hooks. Opens in your browser.</p>
717
- <div class="step-code">npx claude-code-cost --open</div>
718
- </div>
719
- <div class="step fade-in delay-2">
720
- <div class="step-num">2</div>
721
- <h3>Browse costs</h3>
722
- <p>Overview with daily chart, model distribution, and project breakdown. Click any project to drill down.</p>
723
- <div class="step-code">localhost:3458</div>
724
- </div>
725
- <div class="step fade-in delay-4">
726
- <div class="step-num">3</div>
727
- <h3>Drill down</h3>
728
- <p>Project to session to message. See token counts, costs, and cumulative spend for every API call.</p>
729
- <div class="step-code">total / project / session / message</div>
730
- </div>
731
- </div>
732
- </div>
733
- </section>
734
-
735
- <!-- SCREENSHOTS -->
736
- <section class="screenshots" id="screenshots">
737
- <div class="container">
738
- <div class="screenshots-header">
739
- <div>
740
- <p class="section-label fade-in">Preview</p>
741
- <h2 class="section-title fade-in" style="margin-bottom:0">See it in action</h2>
742
- </div>
743
- <div class="theme-toggle fade-in">
744
- <button onclick="showScreenshot('dark', this)">Dark</button>
745
- <button class="active" onclick="showScreenshot('light', this)">Light</button>
746
- </div>
747
- </div>
748
- <div class="ss-grid">
749
- <div>
750
- <div class="screenshot-frame fade-in">
751
- <img class="ss-dark hidden" src="assets/overview-dark.png" alt="Overview dark">
752
- <img class="ss-light" src="assets/overview-light.png" alt="Overview light">
753
- </div>
754
- <div class="ss-label">Overview</div>
755
- </div>
756
- <div>
757
- <div class="screenshot-frame fade-in delay-1">
758
- <img class="ss-dark hidden" src="assets/projects-dark.png" alt="Projects dark">
759
- <img class="ss-light" src="assets/projects-light.png" alt="Projects light">
760
- </div>
761
- <div class="ss-label">Projects</div>
762
- </div>
763
- <div>
764
- <div class="screenshot-frame fade-in delay-2">
765
- <img class="ss-dark hidden" src="assets/session-dark.png" alt="Session dark">
766
- <img class="ss-light" src="assets/sesssion-light.png" alt="Session light">
767
- </div>
768
- <div class="ss-label">Session Detail</div>
769
- </div>
770
- </div>
771
- </div>
772
- </section>
773
-
774
- <!-- FAQ -->
775
- <section class="faq" id="faq">
776
- <div class="container">
777
- <p class="section-label fade-in">FAQ</p>
778
- <h2 class="section-title fade-in">Common questions</h2>
779
- <div class="faq-list">
780
- <div class="faq-item fade-in">
781
- <button class="faq-q" onclick="toggleFaq(this)">
782
- Where does pricing data come from?
783
- <svg class="faq-chevron" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M5 8l5 5 5-5"/></svg>
784
- </button>
785
- <div class="faq-a"><p>Live from <a href="https://github.com/BerriAI/litellm" target="_blank" rel="noopener" style="color:var(--accent)">LiteLLM's pricing dataset</a> (2000+ models). Cached for 6 hours. If the fetch fails, a bundled offline snapshot of Claude model prices is used.</p></div>
786
- </div>
787
- <div class="faq-item fade-in delay-1">
788
- <button class="faq-q" onclick="toggleFaq(this)">
789
- Does it work offline?
790
- <svg class="faq-chevron" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M5 8l5 5 5-5"/></svg>
791
- </button>
792
- <div class="faq-a"><p>Yes. The offline pricing fallback covers all current Claude models. PWA support is included for installability.</p></div>
793
- </div>
794
- <div class="faq-item fade-in delay-2">
795
- <button class="faq-q" onclick="toggleFaq(this)">
796
- Does it modify any files?
797
- <svg class="faq-chevron" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M5 8l5 5 5-5"/></svg>
798
- </button>
799
- <div class="faq-a"><p>No. Completely read-only. It only reads JSONL session files from <code>~/.claude/projects/</code>. Nothing is written or modified.</p></div>
800
- </div>
801
- <div class="faq-item fade-in delay-3">
802
- <button class="faq-q" onclick="toggleFaq(this)">
803
- Are the costs accurate?
804
- <svg class="faq-chevron" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M5 8l5 5 5-5"/></svg>
805
- </button>
806
- <div class="faq-a"><p>Costs are estimates based on token counts and publicly available model pricing. They use pre-calculated <code>costUSD</code> when available in session files, otherwise calculate from tokens. Actual billing may differ slightly.</p></div>
807
- </div>
808
- </div>
809
- </div>
810
- </section>
811
-
812
- <!-- LIGHTBOX -->
813
- <div class="lightbox" id="lightbox" onclick="closeLightbox()">
814
- <button class="lightbox-close" onclick="closeLightbox()">&times;</button>
815
- <img id="lightbox-img" src="" alt="">
816
- </div>
817
-
818
- <!-- FOOTER -->
819
- <footer>
820
- <div class="container">
821
- <div class="footer-left">
822
- <span>MIT License</span>
823
- <a href="https://github.com/NikiforovAll/claude-code-cost" target="_blank" rel="noopener">GitHub</a>
824
- </div>
825
- <div class="footer-right">
826
- <a href="https://github.com/NikiforovAll" target="_blank" rel="noopener">Built by NikiforovAll</a>
827
- </div>
828
- </div>
829
- </footer>
830
-
831
- <script>
832
- const nav = document.querySelector('nav');
833
- window.addEventListener('scroll', () => {
834
- nav.classList.toggle('scrolled', window.scrollY > 10);
835
- }, { passive: true });
836
-
837
- const observer = new IntersectionObserver((entries) => {
838
- entries.forEach(e => {
839
- if (e.isIntersecting) {
840
- e.target.classList.add('visible');
841
- observer.unobserve(e.target);
842
- }
843
- });
844
- }, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' });
845
-
846
- document.querySelectorAll('.fade-in').forEach(el => observer.observe(el));
847
-
848
- function copyInstall(btn) {
849
- navigator.clipboard.writeText('npx claude-code-cost --open').then(() => {
850
- btn.classList.add('copied');
851
- btn.innerHTML = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8.5l3 3 7-7"/></svg>';
852
- setTimeout(() => {
853
- btn.classList.remove('copied');
854
- btn.innerHTML = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="5" y="5" width="9" height="9" rx="1.5"/><path d="M5 11H3.5A1.5 1.5 0 012 9.5v-7A1.5 1.5 0 013.5 1h7A1.5 1.5 0 0112 2.5V5"/></svg>';
855
- }, 2000);
856
- });
857
- }
858
-
859
- document.querySelectorAll('.screenshot-frame, .hero-screenshot').forEach(el => {
860
- el.addEventListener('click', () => {
861
- const img = el.querySelector('img:not(.hidden)');
862
- if (!img) return;
863
- const lb = document.getElementById('lightbox');
864
- document.getElementById('lightbox-img').src = img.src;
865
- lb.classList.add('open');
866
- document.body.style.overflow = 'hidden';
867
- });
868
- });
869
-
870
- function closeLightbox() {
871
- const lb = document.getElementById('lightbox');
872
- lb.classList.remove('open');
873
- document.body.style.overflow = '';
874
- }
875
-
876
- document.addEventListener('keydown', (e) => {
877
- if (e.key === 'Escape') closeLightbox();
878
- });
879
-
880
- function showScreenshot(theme, btn) {
881
- document.querySelectorAll('.ss-dark').forEach(el => el.classList.toggle('hidden', theme !== 'dark'));
882
- document.querySelectorAll('.ss-light').forEach(el => el.classList.toggle('hidden', theme !== 'light'));
883
- btn.parentElement.querySelectorAll('button').forEach(b => b.classList.remove('active'));
884
- btn.classList.add('active');
885
- }
886
-
887
- function toggleFaq(btn) {
888
- const item = btn.parentElement;
889
- const wasOpen = item.classList.contains('open');
890
- document.querySelectorAll('.faq-item.open').forEach(i => i.classList.remove('open'));
891
- if (!wasOpen) item.classList.add('open');
892
- }
893
- </script>
894
-
895
- </body>
896
- </html>