Skip to content

Monthly canonical token stat + fit all three cards side by side#2

Merged
LukasParke merged 1 commit into
mainfrom
fix/stats-monthly-tokens
Jul 8, 2026
Merged

Monthly canonical token stat + fit all three cards side by side#2
LukasParke merged 1 commit into
mainfrom
fix/stats-monthly-tokens

Conversation

@LukasParke

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1 with two fixes to the stats cards.

1. Token stat: canonical monthly definition (and a bucket bug)

Per the discussion with Robert/Devin, the token card now matches the homepage's canonical Monthly Tokens metric instead of an ad-hoc weekly figure:

  • Window: ?view=month (was ?view=week)
  • Formula: the site's canonical getTotalTokenstotal_prompt_tokens + (total_completion_tokens ?? 0), excluding reasoning/cached columns
  • Bucket fix: the rankings response contains ~15 date buckets, but only the latest is the trailing-month window. Summing all rows double-counts stale partial buckets (~200T vs the correct ~189T). We now filter to max(date) before reducing.
    • Note: openrouter-web#27454 has the same all-rows reduce in getMonthlyTokens() and will overcount until it applies the same filter — flagged separately.
  • Label: "Tokens / week" → "Tokens / month"; fallback bumped 40T → 100T (matches MarketingMetrics.MonthlyTokenCount)

2. Layout: cards now fit side by side

At width="290" the three cards + inline gaps overflowed the org profile's content column, wrapping the third card. Display width is now 272px — all three fit on a standard desktop profile, still stacking vertically on mobile. (Source GIFs unchanged at 880px; scaling only.)

Also: token card alt text updated to "per month", and all six GIFs (dark + light) re-rendered with the new label/value.

Preview

Tokens card (dark) Tokens card (light)

- Token card aligned with homepage's canonical 'Monthly Tokens':
  ?view=month, getTotalTokens formula (prompt + completion), summing
  only the latest trailing-month bucket (stale partial buckets were
  overcounting ~200T vs correct ~189T)
- Card label now 'Tokens / month' (~189T); GIFs re-rendered
- Display width 290 -> 272 so all three cards fit side by side on a
  standard-width org profile
@LukasParke LukasParke merged commit 0e5db5f into main Jul 8, 2026
1 check passed
@LukasParke LukasParke deleted the fix/stats-monthly-tokens branch July 8, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant