From 4be4dc4d033852c0d4466bcb9814ce7d21b05e0f Mon Sep 17 00:00:00 2001 From: inference-bot Date: Thu, 1 Oct 2026 15:47:59 -0600 Subject: [PATCH] Usage: My usage / Co-op usage mode switch; leaderboard strict descending + cost per request; docs link; drop explainer text --- app/main.py | 92 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/app/main.py b/app/main.py index a7751dc..e64ece4 100644 --- a/app/main.py +++ b/app/main.py @@ -325,6 +325,18 @@ PAGE_HTML = """ .model-sub { color: var(--muted); font-size: 12px; } .model-spend { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; } + /* Usage mode switch */ + .usage-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; } + .usage-header h2 { margin-bottom: 0; } + .mode-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; } + .mode-btn { + font-family: inherit; cursor: pointer; border: none; background: #fff; color: var(--muted); + font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 0; + } + .mode-btn.active { background: var(--green-deep); color: #fff; } + .docs-link { display: inline-block; margin-top: 14px; color: var(--green-deep); font-size: 13px; font-weight: 600; text-decoration: none; } + .docs-link:hover { text-decoration: underline; } + /* Leaderboard */ .board-row { display: flex; align-items: flex-start; gap: 14px; @@ -338,6 +350,8 @@ PAGE_HTML = """ } .board-row:first-child .board-rank { background: var(--green-deep); color: #fff; } .board-main { flex: 1; min-width: 0; } + .board-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; } + .board-cost { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; } .board-name { font-weight: 600; font-size: 13px; margin-bottom: 5px; } .board-bar { height: 6px; background: #eef0ea; border-radius: 4px; overflow: hidden; } .board-fill { height: 100%; background: var(--green-mid); border-radius: 4px; } @@ -468,27 +482,36 @@ PAGE_HTML = """
-

Usage

-
- — - of your balance used +
+

Usage

+ + + +
-
-
—
remaining
-
—
monthly allowance left
-
—
credits (never expire)
-
—
tokens used
-
—
requests
-
-
-
Shared across chat and API.
-
-
-
-

Popular in the co-op

-

Which models members are using most, across the whole co-op. A starting point when choosing one.

-
+
+
+ — + of your balance used +
+
+
—
remaining
+
—
monthly allowance left
+
—
credits (never expire)
+
—
tokens used
+
—
requests
+
+
+
Shared across chat and API.
+
+
+ + + + About these models →
@@ -578,7 +601,8 @@ async function load() { function renderModels(models) { const el = $('models'); if (!models.length) { el.innerHTML = ''; return; } - el.innerHTML = models.map(m => { + const rows = [...models].sort((a, b) => (b.calls || 0) - (a.calls || 0)); + el.innerHTML = rows.map(m => { const sub = (m.calls || 0).toLocaleString() + ' requests · ' + (m.tokens || 0).toLocaleString() + ' tokens'; return '
' + '
' + escapeHtml(m.model) + '
' + @@ -588,22 +612,38 @@ function renderModels(models) { }).join(''); } +let usageMode = 'mine'; // 'mine' | 'coop' + +function setUsageMode(mode) { + usageMode = mode; + $('mode-mine').className = 'mode-btn' + (mode === 'mine' ? ' active' : ''); + $('mode-coop').className = 'mode-btn' + (mode === 'coop' ? ' active' : ''); + $('view-mine').style.display = mode === 'mine' ? '' : 'none'; + $('view-coop').style.display = mode === 'coop' ? '' : 'none'; +} + function renderBoard(models) { const el = $('coop-board'); if (!models.length) { el.innerHTML = '
Not enough usage data yet — check back soon.
'; return; } - // Rank bar widths are relative to the top model's request count. - const top = Math.max(...models.map(m => m.requests || 0), 1); - el.innerHTML = models.map((m, i) => { - const pct = Math.round(((m.requests || 0) / top) * 100); + // Strictly descending by usage (requests); bar widths relative to the top. + const rows = [...models].sort((a, b) => (b.requests || 0) - (a.requests || 0)); + const top = Math.max(...rows.map(m => m.requests || 0), 1); + el.innerHTML = rows.map((m, i) => { + const req = m.requests || 0; + const cpr = req > 0 ? (m.spend || 0) / req : 0; // cost per request + const pct = Math.round((req / top) * 100); return '
' + '
' + (i + 1) + '
' + '
' + - '
' + escapeHtml(m.model) + '
' + + '
' + + '
' + escapeHtml(m.model) + '
' + + '
' + fmtMoney(cpr) + ' / request
' + + '
' + '
' + - '
' + (m.requests || 0).toLocaleString() + ' requests by members
' + + '
' + req.toLocaleString() + ' requests by members
' + '
' + '
'; }).join('');