Created
September 1, 2026 10:06
-
-
Save sekedus/ca1b67af37d3f2d5ad1048c0f6f057ad to your computer and use it in GitHub Desktop.
Claude.ai Free Usage Checker (bookmarklet)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async function freeTierClaudeUsageSummary() { | |
| /* https://github.com/lugia19/Claude-Usage-Extension/blob/1338250fc3bdcdcd2ccc4dda188d45cb7953b17a/content-components/content_utils.js#L132-L134 */ | |
| function getCookie(name) { | |
| const c = document.cookie.split('; ').find(s => s.trim().startsWith(name + '=')); | |
| return c ? decodeURIComponent(c.split('=')[1]) : null; | |
| } | |
| function pctText(n) { | |
| return Number(n).toFixed(0) + '%'; | |
| } | |
| function formatReset(resets_at) { | |
| if (!resets_at) return '– '; | |
| const ts = new Date(resets_at).getTime(); | |
| const diff = ts - Date.now(); | |
| if (diff <= 0) return 'Resetting...'; | |
| const totalMinutes = Math.round(diff / (1000 * 60)); | |
| if (totalMinutes < 1) return '<1m'; | |
| const totalHours = Math.floor(totalMinutes / 60); | |
| if (totalHours >= 24) { | |
| const days = Math.floor(totalHours / 24); | |
| const remHours = totalHours % 24; | |
| return `${days}d ${remHours}h`; | |
| } | |
| if (totalHours > 0) { | |
| const mins = totalMinutes % 60; | |
| return `${totalHours}h ${mins}m`; | |
| } | |
| return `${totalMinutes}m`; | |
| } | |
| /* https://github.com/lugia19/Claude-Usage-Extension/blob/1338250fc3bdcdcd2ccc4dda188d45cb7953b17a/bg-components/claude-api.js#L165-L186 */ | |
| function mapTierFromOrg(org) { | |
| if (!org) return 'Free'; | |
| if (org.raven_type) return 'Team'; | |
| const caps = org.capabilities || []; | |
| const rateLimit = org.rate_limit_tier || ''; | |
| if (caps.includes('claude_max')) return rateLimit.includes('5x') ? 'Max (5x)' : 'Max (20x)'; | |
| if (caps.includes('claude_pro')) return 'Pro'; | |
| return 'Free'; | |
| } | |
| try { | |
| let orgId = getCookie('lastActiveOrg'); | |
| if (!orgId) { | |
| orgId = prompt('Could not find lastActiveOrg cookie. Paste your orgId (or Cancel):'); | |
| if (!orgId) { alert('No orgId provided. Aborting.'); return; } | |
| } | |
| /* https://github.com/lugia19/Claude-Usage-Extension/blob/1338250fc3bdcdcd2ccc4dda188d45cb7953b17a/bg-components/claude-api.js#L58-L60 */ | |
| const usageResp = await fetch(`/api/organizations/${orgId}/usage`, { credentials: 'include' }) | |
| .then(r => { if (!r.ok) throw new Error('usage fetch failed: ' + r.status); return r.json(); }); | |
| /* https://github.com/lugia19/Claude-Usage-Extension/blob/1338250fc3bdcdcd2ccc4dda188d45cb7953b17a/bg-components/claude-api.js#L148-L163 */ | |
| const appStart = await fetch(`/api/bootstrap/${orgId}/app_start?statsig_hashing_algorithm=djb2`, { credentials: 'include' }) | |
| .then(r => r.ok ? r.json() : null) | |
| .catch(() => null); | |
| const org = appStart?.account?.memberships?.find(m => m.organization?.uuid === orgId)?.organization | |
| || appStart?.account?.memberships?.[0]?.organization || null; | |
| const tier = mapTierFromOrg(org); | |
| if (tier !== 'Free') { | |
| alert(`Tier: ${tier}\nThis summary script runs only for the Free tier.`); | |
| console.log('Claude usage (not Free tier):', { tier, usageResp, appStart }); | |
| return; | |
| } | |
| const lines = []; | |
| const five = usageResp.five_hour; | |
| const seven = usageResp.seven_day; | |
| if (five) lines.push(`- 5 Hours: ${pctText(five.utilization)} (reset in: ${formatReset(five.resets_at)})`); | |
| if (seven) lines.push(`- 7 Days: ${pctText(seven.utilization)} (reset in: ${formatReset(seven.resets_at)})`); | |
| const message = `Tier: ${tier}\nUsage:\n${lines.join('\n') || 'No active limits found.'}`; | |
| alert(message); | |
| console.log(`[CFUC] summary:\n` + message); | |
| console.log(`[CFUC] response:`, { tier, usageResp, appStart }); | |
| } catch (err) { | |
| console.error('Error fetching usage:', err); | |
| alert('Error fetching usage: ' + (err && err.message ? err.message : err)); | |
| } | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Free plan:
/usagereturns all-null limits as of 2026-08-22.